[IslNodeBuilder] Move run-time check generation to NodeBuilder [NFC]

This improves the structure of the code and allows us to reuse the runtime
code generation in the PPCGCodeGeneration.

llvm-svn: 278017
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index b13118c..9fd1df7 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -66,19 +66,6 @@
   RegionInfo *RI;
   ///}
 
-  /// @brief Build the runtime condition.
-  ///
-  /// Build the condition that evaluates at run-time to true iff all
-  /// assumptions taken for the SCoP hold, and to false otherwise.
-  ///
-  /// @return A value evaluating to true/false if execution is save/unsafe.
-  Value *buildRTC(PollyIRBuilder &Builder, IslExprBuilder &ExprBuilder) {
-    Value *RTC = ExprBuilder.create(AI->getRunCondition());
-    if (!RTC->getType()->isIntegerTy(1))
-      RTC = Builder.CreateIsNotNull(RTC);
-    return RTC;
-  }
-
   void verifyGeneratedFunction(Scop &S, Function &F) {
     if (!verifyFunction(F, &errs()) || !Verify)
       return;
@@ -147,7 +134,6 @@
     PollyIRBuilder Builder = createPollyIRBuilder(EnteringBB, Annotator);
 
     IslNodeBuilder NodeBuilder(Builder, Annotator, this, *DL, *LI, *SE, *DT, S);
-    IslExprBuilder &ExprBuilder = NodeBuilder.getExprBuilder();
 
     // Only build the run-time condition and parameters _after_ having
     // introduced the conditional branch. This is important as the conditional
@@ -189,15 +175,8 @@
       isl_ast_node_free(AstRoot);
     } else {
       NodeBuilder.allocateNewArrays();
-
       NodeBuilder.addParameters(S.getContext());
-
-      ExprBuilder.setTrackOverflow(true);
-      Value *RTC = buildRTC(Builder, ExprBuilder);
-      Value *OverflowHappened = Builder.CreateNot(
-          ExprBuilder.getOverflowState(), "polly.rtc.overflown");
-      RTC = Builder.CreateAnd(RTC, OverflowHappened, "polly.rtc.result");
-      ExprBuilder.setTrackOverflow(false);
+      Value *RTC = NodeBuilder.createRTC(AI->getRunCondition());
 
       Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);
       Builder.SetInsertPoint(&StartBlock->front());