[NFC] Generate runtime checks after the SCoP
We now generate runtime checks __after__ the SCoP code generation and
not before, though they are still inserted at the same position int
the code. This allows to modify the runtime check during SCoP code
generation.
llvm-svn: 271894
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index ce1098f..b434144 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -191,7 +191,12 @@
} else {
NodeBuilder.addParameters(S.getContext());
+ SplitBlock = Builder.GetInsertBlock();
+ Builder.SetInsertPoint(&StartBlock->front());
+ NodeBuilder.create(AstRoot);
+
+ Builder.SetInsertPoint(SplitBlock->getTerminator());
ExprBuilder.setTrackOverflow(true);
Value *RTC = buildRTC(Builder, ExprBuilder);
Value *OverflowHappened = Builder.CreateNot(
@@ -199,10 +204,7 @@
RTC = Builder.CreateAnd(RTC, OverflowHappened, "polly.rtc.result");
ExprBuilder.setTrackOverflow(false);
- Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);
- Builder.SetInsertPoint(&StartBlock->front());
-
- NodeBuilder.create(AstRoot);
+ SplitBlock->getTerminator()->setOperand(0, RTC);
NodeBuilder.finalizeSCoP(S);
fixRegionInfo(EnteringBB->getParent(), R->getParent());