[PATCH] D70597: [PHIEliminate] skip dbg instruction when LowerPHINode

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 06:10:31 PST 2020


jmorse reopened this revision.
jmorse added a comment.
This revision is now accepted and ready to land.

Hi Chris,

All the public buildbots passed, however our (Sony) internal build of the compiler-rt unit tests found a problem, where the added PHIElimination assertion fired. I've uploaded a reproducer in [0] extracted from the failing program, when running llc over it I get:

  ../icedebug/bin/llc extracted2.ll -o extracted.o
  llc: /fast/fs/llvm-project/llvm/lib/CodeGen/PHIElimination.cpp:216: bool (anonymous namespace)::PHIElimination::EliminatePHINodes(llvm::MachineFunction &, llvm::MachineBasicBlock &): Assertion `(LastPHIIt == skipDebugInstructionsBackward( std::prev(MBB.SkipPHIsLabelsAndDebug(MBB.begin())), MBB.begin())) && "There must be no DBG_VALUEs between PHI and LABEL"' failed.
  Stack dump:
  0.      Program arguments: ../icedebug/bin/llc extracted2.ll -o extracted.o
  1.      Running pass 'Function Pass Manager' on module 'extracted2.ll'.
  2.      Running pass 'Eliminate PHI nodes for register allocation' on function '@_ZN7testing8internal8FilePath22GenerateUniqueFileNameERKS1_S3_PKc'
   #0 0x0000000005f912b9 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /fast/fs/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:11
   #1 0x0000000005f91469 PrintStackTraceSignalHandler(void*) /fast/fs/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:1
   #2 0x0000000005f8fbf6 llvm::sys::RunSignalHandlers() /fast/fs/llvm-project/llvm/lib/Support/Signals.cpp:67:5
   #3 0x0000000005f91bfb SignalHandler(int) /fast/fs/llvm-project/llvm/lib/Support/Unix/Signals.inc:406:1
   #4 0x00007f266e2fa890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
   #5 0x00007f266cda3e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
   #6 0x00007f266cda5801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
   #7 0x00007f266cd9539a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
   #8 0x00007f266cd95412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
   #9 0x00000000051369f1 (anonymous namespace)::PHIElimination::EliminatePHINodes(llvm::MachineFunction&, llvm::MachineBasicBlock&) /fast/fs/llvm-project/llvm/lib/CodeGen/PHIElimination.cpp:218:3
  #10 0x0000000005135d8f (anonymous namespace)::PHIElimination::runOnMachineFunction(llvm::MachineFunction&) /fast/fs/llvm-project/llvm/lib/CodeGen/PHIElimination.cpp:169:16
  #11 0x0000000004fbf0ef llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /fast/fs/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:8
  #12 0x0000000005503849 llvm::FPPassManager::runOnFunction(llvm::Function&) /fast/fs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1481:23
  #13 0x0000000005503c55 llvm::FPPassManager::runOnModule(llvm::Module&) /fast/fs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1517:16
  #14 0x00000000055043b8 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /fast/fs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1582:23
  #15 0x0000000005503ee5 llvm::legacy::PassManagerImpl::run(llvm::Module&) /fast/fs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1694:16
  #16 0x0000000005504941 llvm::legacy::PassManager::run(llvm::Module&) /fast/fs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1725:3
  #17 0x00000000030b4c9b compileModule(char**, llvm::LLVMContext&) /fast/fs/llvm-project/llvm/tools/llc/llc.cpp:611:41
  #18 0x00000000030b32c3 main /fast/fs/llvm-project/llvm/tools/llc/llc.cpp:356:13
  #19 0x00007f266cd86b97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
  #20 0x00000000030b2a0a _start (../icedebug/bin/llc+0x30b2a0a)
  [1]    15520 abort (core dumped)  ../icedebug/bin/llc extracted2.ll -o extracted.o

On ubuntu 18.04.

Would you be able to look at this? It's likely that some earlier faulty pass is re-ordering instructions. The failing block starts with:

  %2:gr32 = PHI %17:gr32, %bb.0, %3:gr32, %bb.5, debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0
  DBG_VALUE %2:gr32, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
  DBG_VALUE $noreg, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
  EH_LABEL <mcsymbol .Ltmp0>, debug-location !15502; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:23

[0] https://raw.githubusercontent.com/jmorse/llvm-project/fgasdf/extracted.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70597/new/

https://reviews.llvm.org/D70597





More information about the llvm-commits mailing list