[llvm] r238254 - [PlaceSafepoints] Entry safepoint location doesn't need to be a terminator

Philip Reames listmail at philipreames.com
Tue May 26 14:16:42 PDT 2015

Author: reames
Date: Tue May 26 16:16:42 2015
New Revision: 238254

URL: http://llvm.org/viewvc/llvm-project?rev=238254&view=rev
[PlaceSafepoints] Entry safepoint location doesn't need to be a terminator

Long ago, the poll insertion code assumed that the insertion site was a terminator.  As a result, the entry selection code would split a basic block to ensure it could pass a terminator.  The insertion code was updated quite a while ago - possibly before it ever landed upstream - but the now redundant work was never removed.  

While I'm at it, remove a comment which doesn't apply to the upstreamed code.  

NFC intended.


Modified: llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp?rev=238254&r1=238253&r2=238254&view=diff
--- llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp Tue May 26 16:16:42 2015
@@ -417,12 +417,6 @@ static Instruction *findLocationForEntry
   // that can grow the stack.  This, combined with backedge polls,
   // give us all the progress guarantees we need.
-  // Due to the way the frontend generates IR, we may have a couple of initial
-  // basic blocks before the first bytecode.  These will be single-entry
-  // single-exit blocks which conceptually are just part of the first 'real
-  // basic block'.  Since we don't have deopt state until the first bytecode,
-  // walk forward until we've found the first unconditional branch or merge.
   // hasNextInstruction and nextInstruction are used to iterate
   // through a "straight line" execution sequence.
@@ -465,17 +459,7 @@ static Instruction *findLocationForEntry
   assert((hasNextInstruction(cursor) || cursor->isTerminator()) &&
          "either we stopped because of a call, or because of terminator");
-  if (cursor->isTerminator()) {
-    return cursor;
-  }
-  BasicBlock *BB = cursor->getParent();
-  SplitBlock(BB, cursor, &DT);
-  // SplitBlock updates the DT
-  DEBUG(DT.verifyDomTree());
-  return BB->getTerminator();
+  return cursor;
 /// Identify the list of call sites which need to be have parseable state

More information about the llvm-commits mailing list