[llvm-commits] [llvm] r141726 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp

Bill Wendling isanbard at gmail.com
Tue Oct 11 15:42:31 PDT 2011


Author: void
Date: Tue Oct 11 17:42:31 2011
New Revision: 141726

URL: http://llvm.org/viewvc/llvm-project?rev=141726&view=rev
Log:
N.B. This is with the new EH scheme:

The blocks with invokes have branches to the dispatch block, because that more
correctly models the behavior of the CFG. The dispatch of course has edges to
the landing pads. Those landing pads could contain invokes, which then have
branches back to the dispatch. This creates a loop. The machine LICM pass looks
at this loop and thinks it can hoist elements out of it. But because the
dispatch is an alternate entry point into the program, the hoisted instructions
won't be executed.

I wasn't able to get a testcase which was small and could reproduce all of the
time. The function_try_block.cpp in llvm-test was where this showed up.

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

Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=141726&r1=141725&r2=141726&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Oct 11 17:42:31 2011
@@ -336,6 +336,11 @@
       continue;
     }
 
+    // If the header is a landing pad, then we don't want to hoist instructions
+    // out of it. This can happen with SjLj exception handling which has a
+    // dispatch table as the landing pad.
+    if (CurLoop->getHeader()->isLandingPad()) continue;
+
     if (!PreRegAlloc)
       HoistRegionPostRA();
     else {





More information about the llvm-commits mailing list