Zhang via llvm-dev
2021-Aug-20 03:04 UTC
[llvm-dev] Hints needed for debugging an X86 backend bug.
Hi: I have a IR file which has been reduced by bugpoint, the IR is originally compiled for X86_64 and has custom transforms applied. It compiles fine if I set the triple to aarch64-arm-none-eabi, but crashes when using the X86 backend , results in the following stack trace: ``` Assertion failed: (itr != mi2iMap.end() && "Instruction not found in maps."), function getInstructionIndex, file LLVM/llvm/include/llvm/CodeGen/SlotIndexes.h, line 399. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: bin/llc LLCCrash.bc -debug 1. Running pass 'Function Pass Manager' on module 'LLCCrash.bc'. 2. Running pass 'Simple Register Coalescing' on function '@_ZNK8CryptoPP15DL_VerifierBaseINS_8ECPPointEE17RecoverAndRestartEPhRNS_21PK_MessageAccumulatorE' 0 llc 0x0000000103289eca llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 58 1 llc 0x000000010328a459 PrintStackTraceSignalHandler(void*) + 25 2 llc 0x000000010328832b llvm::sys::RunSignalHandlers() + 123 3 llc 0x000000010328c209 SignalHandler(int) + 249 4 libsystem_platform.dylib 0x00007fff2052bd7d _sigtramp + 29 5 libdyld.dylib 0x00007fff20501473 dyldGlobalLockRelease() + 0 6 libsystem_c.dylib 0x00007fff2043a720 abort + 120 7 libsystem_c.dylib 0x00007fff204399d6 err + 0 8 llc 0x0000000101e67066 llvm::SlotIndexes::getInstructionIndex(llvm::MachineInstr const&, bool) const + 470 9 llc 0x0000000101e66e06 llvm::LiveIntervals::getInstructionIndex(llvm::MachineInstr const&) const + 38 10 llc 0x0000000101ec5da5 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) + 149 11 llc 0x0000000101ec2e5c (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) + 204 12 llc 0x0000000101ebdc34 (anonymous namespace)::RegisterCoalescer::joinAllIntervals() + 740 13 llc 0x0000000101ebad54 (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) + 804 ``` The IR passes``opt -verify``, and given AArch64 backend works fine, I assume it's a bug in the X86 backend, thus I modified SlotIndexes::getInstructionIndex to print the MachineInstr: ``` errs()<<"SlotIndex:\n"; BundleNonDebug.dump(); ``` which gives me: ``` SlotIndex: UNKNOWN , %59 ``` I'm now absolutely lost on where this "UNKNOWN" comes from. Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210820/4d4b751c/attachment.html>
Wang, Pengfei via llvm-dev
2021-Aug-20 07:35 UTC
[llvm-dev] Hints needed for debugging an X86 backend bug.
MachineInstr prints “UNKNOWN” only when “TII” in invalid. https://llvm.org/doxygen/MachineInstr_8cpp_source.html#l01669 It’s a bit strange that you generate IR using aarch64 while using X86 as backend. I think some target specific builtins won’t work, as well as many function attributes are not available. Thanks Pengfei From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Zhang via llvm-dev Sent: Friday, August 20, 2021 11:05 AM To: llvm-dev <llvm-dev at lists.llvm.org> Subject: [llvm-dev] Hints needed for debugging an X86 backend bug. Hi: I have a IR file which has been reduced by bugpoint, the IR is originally compiled for X86_64 and has custom transforms applied. It compiles fine if I set the triple to aarch64-arm-none-eabi, but crashes when using the X86 backend , results in the following stack trace: ``` Assertion failed: (itr != mi2iMap.end() && "Instruction not found in maps."), function getInstructionIndex, file LLVM/llvm/include/llvm/CodeGen/SlotIndexes.h, line 399. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: bin/llc LLCCrash.bc -debug 1. Running pass 'Function Pass Manager' on module 'LLCCrash.bc'. 2. Running pass 'Simple Register Coalescing' on function '@_ZNK8CryptoPP15DL_VerifierBaseINS_8ECPPointEE17RecoverAndRestartEPhRNS_21PK_MessageAccumulatorE' 0 llc 0x0000000103289eca llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 58 1 llc 0x000000010328a459 PrintStackTraceSignalHandler(void*) + 25 2 llc 0x000000010328832b llvm::sys::RunSignalHandlers() + 123 3 llc 0x000000010328c209 SignalHandler(int) + 249 4 libsystem_platform.dylib 0x00007fff2052bd7d _sigtramp + 29 5 libdyld.dylib 0x00007fff20501473 dyldGlobalLockRelease() + 0 6 libsystem_c.dylib 0x00007fff2043a720 abort + 120 7 libsystem_c.dylib 0x00007fff204399d6 err + 0 8 llc 0x0000000101e67066 llvm::SlotIndexes::getInstructionIndex(llvm::MachineInstr const&, bool) const + 470 9 llc 0x0000000101e66e06 llvm::LiveIntervals::getInstructionIndex(llvm::MachineInstr const&) const + 38 10 llc 0x0000000101ec5da5 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) + 149 11 llc 0x0000000101ec2e5c (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) + 204 12 llc 0x0000000101ebdc34 (anonymous namespace)::RegisterCoalescer::joinAllIntervals() + 740 13 llc 0x0000000101ebad54 (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) + 804 ``` The IR passes``opt -verify``, and given AArch64 backend works fine, I assume it's a bug in the X86 backend, thus I modified SlotIndexes::getInstructionIndex to print the MachineInstr: ``` errs()<<"SlotIndex:\n"; BundleNonDebug.dump(); ``` which gives me: ``` SlotIndex: UNKNOWN , %59 ``` I'm now absolutely lost on where this "UNKNOWN" comes from. Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210820/9d6aca99/attachment.html>