[llvm] r278344 - CodeGen: Check for a terminator in llvm::getFuncletMembership

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 08:29:02 PDT 2016


Author: dexonsmith
Date: Thu Aug 11 10:29:02 2016
New Revision: 278344

URL: http://llvm.org/viewvc/llvm-project?rev=278344&view=rev
Log:
CodeGen: Check for a terminator in llvm::getFuncletMembership

Check for an end iterator from MachineBasicBlock::getFirstTerminator in
llvm::getFuncletMembership.  If this is turned into an assertion, it
fires in 48 X86 testcases (for example,
CodeGen/X86/regalloc-spill-at-ehpad.ll).

Since this is likely a latent bug (shouldn't all basic blocks end with a
terminator?) I've filed PR28938.

Modified:
    llvm/trunk/lib/CodeGen/Analysis.cpp

Modified: llvm/trunk/lib/CodeGen/Analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Analysis.cpp?rev=278344&r1=278343&r2=278344&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Analysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/Analysis.cpp Thu Aug 11 10:29:02 2016
@@ -694,6 +694,11 @@ llvm::getFuncletMembership(const Machine
     }
 
     MachineBasicBlock::const_iterator MBBI = MBB.getFirstTerminator();
+
+    // FIXME: Should this be an assertion?  It fires all over in X86.
+    if (MBBI == MBB.end())
+      continue;
+
     // CatchPads are not funclets for SEH so do not consider CatchRet to
     // transfer control to another funclet.
     if (MBBI->getOpcode() != TII->getCatchReturnOpcode())




More information about the llvm-commits mailing list