Simplify the type adjustment in the IslExprBuilder

  We now have a simple function to adjust/unify the types of two (or three)
  operands before an operation that requieres the same type for all operands.
  Due to this change we will not promote parameters that are added to i64
  anymore if that is not needed.

llvm-svn: 271513
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index 566e460..960e0cc 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -61,6 +61,8 @@
   assert(LB->getType() == UB->getType() && "Types of loop bounds do not match");
   IntegerType *LoopIVType = dyn_cast<IntegerType>(UB->getType());
   assert(LoopIVType && "UB is not integer?");
+  assert((LoopIVType == LB->getType() && LoopIVType == Stride->getType()) &&
+         "LB, UB and Stride should have equal types.");
 
   BasicBlock *BeforeBB = Builder.GetInsertBlock();
   BasicBlock *GuardBB =
@@ -121,7 +123,6 @@
   Builder.SetInsertPoint(HeaderBB);
   PHINode *IV = Builder.CreatePHI(LoopIVType, 2, "polly.indvar");
   IV->addIncoming(LB, PreHeaderBB);
-  Stride = Builder.CreateZExtOrBitCast(Stride, LoopIVType);
   Value *IncrementedIV = Builder.CreateNSWAdd(IV, Stride, "polly.indvar_next");
   Value *LoopCondition;
   UB = Builder.CreateSub(UB, Stride, "polly.adjust_ub");
@@ -147,6 +148,12 @@
 Value *ParallelLoopGenerator::createParallelLoop(
     Value *LB, Value *UB, Value *Stride, SetVector<Value *> &UsedValues,
     ValueMapT &Map, BasicBlock::iterator *LoopBody) {
+
+  // Adjust the types to match the GOMP API.
+  LB = Builder.CreateSExt(LB, LongType);
+  UB = Builder.CreateSExt(UB, LongType);
+  Stride = Builder.CreateSExt(Stride, LongType);
+
   Function *SubFn;
 
   AllocaInst *Struct = storeValuesIntoStruct(UsedValues);