[polly] r271513 - Simplify the type adjustment in the IslExprBuilder

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 04:16:02 PDT 2016


Author: jdoerfert
Date: Thu Jun  2 06:15:57 2016
New Revision: 271513

URL: http://llvm.org/viewvc/llvm-project?rev=271513&view=rev
Log:
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.


Modified:
    polly/trunk/include/polly/CodeGen/IslExprBuilder.h
    polly/trunk/lib/CodeGen/IslExprBuilder.cpp
    polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
    polly/trunk/lib/CodeGen/LoopGenerators.cpp
    polly/trunk/test/Isl/CodeGen/invariant_load_base_pointer_conditional_2.ll
    polly/trunk/test/Isl/CodeGen/no-overflow-tracking.ll

Modified: polly/trunk/include/polly/CodeGen/IslExprBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslExprBuilder.h?rev=271513&r1=271512&r2=271513&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslExprBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslExprBuilder.h Thu Jun  2 06:15:57 2016
@@ -114,13 +114,19 @@ public:
   /// @return The llvm::Value* containing the result of the computation.
   llvm::Value *create(__isl_take isl_ast_expr *Expr);
 
-  /// @brief Return the largest of two types.
+  /// @brief Unify the types of @p V0 and @p V1 in-place.
   ///
-  /// @param T1 The first type.
-  /// @param T2 The second type.
+  /// The values @p V0 and @p V1 will be updated in place such that
+  ///   type(V0) == type(V1) == MaxType
+  /// where MaxType is the larger type of the initial @p V0 and @p V1.
+  void unifyTypes(llvm::Value *&V0, llvm::Value *&V1) {
+    unifyTypes(V0, V1, V1);
+  }
+
+  /// @brief Unify the types of @p V0, @p V1 and @p V2 in-place.
   ///
-  /// @return The largest of the two types.
-  llvm::Type *getWidestType(llvm::Type *T1, llvm::Type *T2);
+  /// The same as unifyTypes above but for three values instead of two.
+  void unifyTypes(llvm::Value *&V0, llvm::Value *&V1, llvm::Value *&V2);
 
   /// @brief Return the type with which this expression should be computed.
   ///

Modified: polly/trunk/lib/CodeGen/IslExprBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslExprBuilder.cpp?rev=271513&r1=271512&r2=271513&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslExprBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslExprBuilder.cpp Thu Jun  2 06:15:57 2016
@@ -74,6 +74,8 @@ Value *IslExprBuilder::getOverflowState(
 
 Value *IslExprBuilder::createBinOp(BinaryOperator::BinaryOps Opc, Value *LHS,
                                    Value *RHS, const Twine &Name) {
+  unifyTypes(LHS, RHS);
+
   // Handle the plain operation (without overflow tracking) first.
   if (!OverflowState) {
     switch (Opc) {
@@ -137,7 +139,7 @@ Value *IslExprBuilder::createMul(Value *
   return createBinOp(Instruction::Mul, LHS, RHS, Name);
 }
 
-Type *IslExprBuilder::getWidestType(Type *T1, Type *T2) {
+static Type *getWidestType(Type *T1, Type *T2) {
   assert(isa<IntegerType>(T1) && isa<IntegerType>(T2));
 
   if (T1->getPrimitiveSizeInBits() < T2->getPrimitiveSizeInBits())
@@ -146,23 +148,29 @@ Type *IslExprBuilder::getWidestType(Type
     return T1;
 }
 
+void IslExprBuilder::unifyTypes(Value *&V0, Value *&V1, Value *&V2) {
+  auto *T0 = V0->getType();
+  auto *T1 = V1->getType();
+  auto *T2 = V2->getType();
+  if (T0 == T1 && T1 == T2)
+    return;
+  auto *MaxT = getWidestType(T0, T1);
+  MaxT = getWidestType(MaxT, T2);
+  V0 = Builder.CreateSExt(V0, MaxT);
+  V1 = Builder.CreateSExt(V1, MaxT);
+  V2 = Builder.CreateSExt(V2, MaxT);
+}
+
 Value *IslExprBuilder::createOpUnary(__isl_take isl_ast_expr *Expr) {
   assert(isl_ast_expr_get_op_type(Expr) == isl_ast_op_minus &&
          "Unsupported unary operation");
 
-  Value *V;
-  Type *MaxType = getType(Expr);
-  assert(MaxType->isIntegerTy() &&
+  auto *V = create(isl_ast_expr_get_op_arg(Expr, 0));
+  assert(V->getType()->isIntegerTy() &&
          "Unary expressions can only be created for integer types");
 
-  V = create(isl_ast_expr_get_op_arg(Expr, 0));
-  MaxType = getWidestType(MaxType, V->getType());
-
-  if (MaxType != V->getType())
-    V = Builder.CreateSExt(V, MaxType);
-
   isl_ast_expr_free(Expr);
-  return createSub(ConstantInt::getNullValue(MaxType), V);
+  return createSub(ConstantInt::getNullValue(V->getType()), V);
 }
 
 Value *IslExprBuilder::createOpNAry(__isl_take isl_ast_expr *Expr) {
@@ -179,13 +187,7 @@ Value *IslExprBuilder::createOpNAry(__is
     Value *OpV;
     OpV = create(isl_ast_expr_get_op_arg(Expr, i));
 
-    Type *Ty = getWidestType(V->getType(), OpV->getType());
-
-    if (Ty != OpV->getType())
-      OpV = Builder.CreateSExt(OpV, Ty);
-
-    if (Ty != V->getType())
-      V = Builder.CreateSExt(V, Ty);
+    unifyTypes(V, OpV);
 
     switch (isl_ast_expr_get_op_type(Expr)) {
     default:
@@ -250,18 +252,8 @@ Value *IslExprBuilder::createAccessAddre
     assert(NextIndex->getType()->isIntegerTy() &&
            "Access index should be an integer");
 
-    if (!IndexOp) {
-      IndexOp = NextIndex;
-    } else {
-      Type *Ty = getWidestType(NextIndex->getType(), IndexOp->getType());
-
-      if (Ty != NextIndex->getType())
-        NextIndex = Builder.CreateIntCast(NextIndex, Ty, true);
-      if (Ty != IndexOp->getType())
-        IndexOp = Builder.CreateIntCast(IndexOp, Ty, true);
-
-      IndexOp = createAdd(IndexOp, NextIndex, "polly.access.add." + BaseName);
-    }
+    IndexOp = !IndexOp ? NextIndex : createAdd(IndexOp, NextIndex,
+                                               "polly.access.add." + BaseName);
 
     // For every but the last dimension multiply the size, for the last
     // dimension we can exit the loop.
@@ -276,14 +268,6 @@ Value *IslExprBuilder::createAccessAddre
         expandCodeFor(S, SE, DL, "polly", DimSCEV, DimSCEV->getType(),
                       &*Builder.GetInsertPoint());
 
-    Type *Ty = getWidestType(DimSize->getType(), IndexOp->getType());
-
-    if (Ty != IndexOp->getType())
-      IndexOp = Builder.CreateSExtOrTrunc(IndexOp, Ty,
-                                          "polly.access.sext." + BaseName);
-    if (Ty != DimSize->getType())
-      DimSize = Builder.CreateSExtOrTrunc(DimSize, Ty,
-                                          "polly.access.sext." + BaseName);
     IndexOp = createMul(IndexOp, DimSize, "polly.access.mul." + BaseName);
   }
 
@@ -301,7 +285,6 @@ Value *IslExprBuilder::createOpAccess(is
 
 Value *IslExprBuilder::createOpBin(__isl_take isl_ast_expr *Expr) {
   Value *LHS, *RHS, *Res;
-  Type *MaxType;
   isl_ast_op_type OpType;
 
   assert(isl_ast_expr_get_type(Expr) == isl_ast_expr_op &&
@@ -314,41 +297,25 @@ Value *IslExprBuilder::createOpBin(__isl
   LHS = create(isl_ast_expr_get_op_arg(Expr, 0));
   RHS = create(isl_ast_expr_get_op_arg(Expr, 1));
 
-  Type *LHSType = LHS->getType();
-  Type *RHSType = RHS->getType();
-
-  MaxType = getWidestType(LHSType, RHSType);
-
-  // Take the result into account when calculating the widest type.
-  //
-  // For operations such as '+' the result may require a type larger than
-  // the type of the individual operands. For other operations such as '/', the
-  // result type cannot be larger than the type of the individual operand. isl
-  // does not calculate correct types for these operations and we consequently
-  // exclude those operations here.
+  // For possibly overflowing operations we will later adjust types but
+  // for others we do it now as we will directly create the operations.
   switch (OpType) {
   case isl_ast_op_pdiv_q:
   case isl_ast_op_pdiv_r:
   case isl_ast_op_div:
   case isl_ast_op_fdiv_q:
   case isl_ast_op_zdiv_r:
-    // Do nothing
+    unifyTypes(LHS, RHS);
     break;
   case isl_ast_op_add:
   case isl_ast_op_sub:
   case isl_ast_op_mul:
-    MaxType = getWidestType(MaxType, getType(Expr));
+    // Do nothing
     break;
   default:
     llvm_unreachable("This is no binary isl ast expression");
   }
 
-  if (MaxType != RHS->getType())
-    RHS = Builder.CreateSExt(RHS, MaxType);
-
-  if (MaxType != LHS->getType())
-    LHS = Builder.CreateSExt(LHS, MaxType);
-
   switch (OpType) {
   default:
     llvm_unreachable("This is no binary isl ast expression");
@@ -379,13 +346,15 @@ Value *IslExprBuilder::createOpBin(__isl
     //       incorrect overflow in some bordercases.
     //
     // floord(n,d) ((n < 0) ? (n - d + 1) : n) / d
-    Value *One = ConstantInt::get(MaxType, 1);
-    Value *Zero = ConstantInt::get(MaxType, 0);
     Value *Sum1 = createSub(LHS, RHS, "pexp.fdiv_q.0");
+    Value *One = ConstantInt::get(Sum1->getType(), 1);
     Value *Sum2 = createAdd(Sum1, One, "pexp.fdiv_q.1");
+    Value *Zero = ConstantInt::get(LHS->getType(), 0);
     Value *isNegative = Builder.CreateICmpSLT(LHS, Zero, "pexp.fdiv_q.2");
+    unifyTypes(LHS, Sum2);
     Value *Dividend =
         Builder.CreateSelect(isNegative, Sum2, LHS, "pexp.fdiv_q.3");
+    unifyTypes(Dividend, RHS);
     Res = Builder.CreateSDiv(Dividend, RHS, "pexp.fdiv_q.4");
     break;
   }
@@ -410,7 +379,6 @@ Value *IslExprBuilder::createOpSelect(__
   assert(isl_ast_expr_get_op_type(Expr) == isl_ast_op_select &&
          "Unsupported unary isl ast expression");
   Value *LHS, *RHS, *Cond;
-  Type *MaxType = getType(Expr);
 
   Cond = create(isl_ast_expr_get_op_arg(Expr, 0));
   if (!Cond->getType()->isIntegerTy(1))
@@ -418,17 +386,8 @@ Value *IslExprBuilder::createOpSelect(__
 
   LHS = create(isl_ast_expr_get_op_arg(Expr, 1));
   RHS = create(isl_ast_expr_get_op_arg(Expr, 2));
+  unifyTypes(LHS, RHS);
 
-  MaxType = getWidestType(MaxType, LHS->getType());
-  MaxType = getWidestType(MaxType, RHS->getType());
-
-  if (MaxType != RHS->getType())
-    RHS = Builder.CreateSExt(RHS, MaxType);
-
-  if (MaxType != LHS->getType())
-    LHS = Builder.CreateSExt(LHS, MaxType);
-
-  // TODO: Do we want to truncate the result?
   isl_ast_expr_free(Expr);
   return Builder.CreateSelect(Cond, LHS, RHS);
 }
@@ -461,16 +420,7 @@ Value *IslExprBuilder::createOpICmp(__is
   if (RHSTy->isPointerTy())
     RHS = Builder.CreatePtrToInt(RHS, PtrAsIntTy);
 
-  if (LHS->getType() != RHS->getType()) {
-    Type *MaxType = LHS->getType();
-    MaxType = getWidestType(MaxType, RHS->getType());
-
-    if (MaxType != RHS->getType())
-      RHS = Builder.CreateSExt(RHS, MaxType);
-
-    if (MaxType != LHS->getType())
-      LHS = Builder.CreateSExt(LHS, MaxType);
-  }
+  unifyTypes(LHS, RHS);
 
   isl_ast_op_type OpType = isl_ast_expr_get_op_type(Expr);
   assert(OpType >= isl_ast_op_eq && OpType <= isl_ast_op_gt &&

Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=271513&r1=271512&r2=271513&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Thu Jun  2 06:15:57 2016
@@ -390,14 +390,7 @@ void IslNodeBuilder::createForVector(__i
   Value *ValueLB = ExprBuilder.create(Init);
   Value *ValueInc = ExprBuilder.create(Inc);
 
-  Type *MaxType = ExprBuilder.getType(Iterator);
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
-
-  if (MaxType != ValueLB->getType())
-    ValueLB = Builder.CreateSExt(ValueLB, MaxType);
-  if (MaxType != ValueInc->getType())
-    ValueInc = Builder.CreateSExt(ValueInc, MaxType);
+  ExprBuilder.unifyTypes(ValueLB, ValueInc);
 
   std::vector<Value *> IVS(VectorWidth);
   IVS[0] = ValueLB;
@@ -472,17 +465,7 @@ void IslNodeBuilder::createForSequential
   ValueUB = ExprBuilder.create(UB);
   ValueInc = ExprBuilder.create(Inc);
 
-  MaxType = ExprBuilder.getType(Iterator);
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueUB->getType());
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
-
-  if (MaxType != ValueLB->getType())
-    ValueLB = Builder.CreateSExt(ValueLB, MaxType);
-  if (MaxType != ValueUB->getType())
-    ValueUB = Builder.CreateSExt(ValueUB, MaxType);
-  if (MaxType != ValueInc->getType())
-    ValueInc = Builder.CreateSExt(ValueInc, MaxType);
+  ExprBuilder.unifyTypes(ValueLB, ValueUB, ValueInc);
 
   // If we can show that LB <Predicate> UB holds at least once, we can
   // omit the GuardBB in front of the loop.
@@ -583,17 +566,7 @@ void IslNodeBuilder::createForParallel(_
     ValueUB = Builder.CreateAdd(
         ValueUB, Builder.CreateSExt(Builder.getTrue(), ValueUB->getType()));
 
-  MaxType = ExprBuilder.getType(Iterator);
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueUB->getType());
-  MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
-
-  if (MaxType != ValueLB->getType())
-    ValueLB = Builder.CreateSExt(ValueLB, MaxType);
-  if (MaxType != ValueUB->getType())
-    ValueUB = Builder.CreateSExt(ValueUB, MaxType);
-  if (MaxType != ValueInc->getType())
-    ValueInc = Builder.CreateSExt(ValueInc, MaxType);
+  ExprBuilder.unifyTypes(ValueLB, ValueUB, ValueInc);
 
   BasicBlock::iterator LoopBody;
 

Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.cpp?rev=271513&r1=271512&r2=271513&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Thu Jun  2 06:15:57 2016
@@ -61,6 +61,8 @@ Value *polly::createLoop(Value *LB, Valu
   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 @@ Value *polly::createLoop(Value *LB, Valu
   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 *polly::createLoop(Value *LB, Valu
 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);

Modified: polly/trunk/test/Isl/CodeGen/invariant_load_base_pointer_conditional_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/invariant_load_base_pointer_conditional_2.ll?rev=271513&r1=271512&r2=271513&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/invariant_load_base_pointer_conditional_2.ll (original)
+++ polly/trunk/test/Isl/CodeGen/invariant_load_base_pointer_conditional_2.ll Thu Jun  2 06:15:57 2016
@@ -14,34 +14,32 @@
 ; CHECK-NEXT:            Execution Context: [N, p, q] -> {  : N > 0 }
 ; CHECK-NEXT:    }
 ;
-; IR:      polly.preload.merge:
+; IR:  polly.preload.merge:
 ; IR-NEXT:   %polly.preload.tmp1.merge = phi i32* [ %polly.access.I.load, %polly.preload.exec ], [ null, %polly.preload.cond ]
 ; IR-NEXT:   store i32* %polly.preload.tmp1.merge, i32** %tmp1.preload.s2a
-; IR-NEXT:   %12 = sext i32 %N to i64
-; IR-NEXT:   %13 = icmp sge i64 %12, 1
-; IR-NEXT:   %14 = sext i32 %q to i64
-; IR-NEXT:   %15 = sext i32 %p to i64
-; IR-NEXT:   %16 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %15, i64 %14)
-; IR-NEXT:   %.obit4 = extractvalue { i64, i1 } %16, 1
+; IR-NEXT:   %10 = sext i32 %N to i64
+; IR-NEXT:   %11 = icmp sge i64 %10, 1
+; IR-NEXT:   %12 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %p, i32 %q)
+; IR-NEXT:   %.obit4 = extractvalue { i32, i1 } %12, 1
 ; IR-NEXT:   %polly.overflow.state5 = or i1 false, %.obit4
-; IR-NEXT:   %.res6 = extractvalue { i64, i1 } %16, 0
-; IR-NEXT:   %17 = icmp sle i64 %.res6, 2147483647
-; IR-NEXT:   %18 = and i1 %13, %17
-; IR-NEXT:   %19 = sext i32 %q to i64
-; IR-NEXT:   %20 = sext i32 %p to i64
-; IR-NEXT:   %21 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %20, i64 %19)
-; IR-NEXT:   %.obit7 = extractvalue { i64, i1 } %21, 1
+; IR-NEXT:   %.res6 = extractvalue { i32, i1 } %12, 0
+; IR-NEXT:   %13 = sext i32 %.res6 to i64
+; IR-NEXT:   %14 = icmp sle i64 %13, 2147483647
+; IR-NEXT:   %15 = and i1 %11, %14
+; IR-NEXT:   %16 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %p, i32 %q)
+; IR-NEXT:   %.obit7 = extractvalue { i32, i1 } %16, 1
 ; IR-NEXT:   %polly.overflow.state8 = or i1 %polly.overflow.state5, %.obit7
-; IR-NEXT:   %.res9 = extractvalue { i64, i1 } %21, 0
-; IR-NEXT:   %22 = icmp sge i64 %.res9, -2147483648
-; IR-NEXT:   %23 = and i1 %18, %22
+; IR-NEXT:   %.res9 = extractvalue { i32, i1 } %16, 0
+; IR-NEXT:   %17 = sext i32 %.res9 to i64
+; IR-NEXT:   %18 = icmp sge i64 %17, -2147483648
+; IR-NEXT:   %19 = and i1 %15, %18
 ; IR-NEXT:   %polly.preload.cond.overflown10 = xor i1 %polly.overflow.state8, true
-; IR-NEXT:   %polly.preload.cond.result11 = and i1 %23, %polly.preload.cond.overflown10
+; IR-NEXT:   %polly.preload.cond.result11 = and i1 %19, %polly.preload.cond.overflown10
 ; IR-NEXT:   br label %polly.preload.cond12
 ;
-; IR:      polly.preload.cond12:
-; IR-NEXT:   br i1 %polly.preload.cond.result11
-;
+; IR:       polly.preload.cond12:
+; IR-NEXT:    br i1 %polly.preload.cond.result11, label %polly.preload.exec14, label %polly.preload.merge13
+
 ; IR:      polly.preload.exec14:
 ; IR-NEXT:   %polly.access.polly.preload.tmp1.merge = getelementptr i32, i32* %polly.preload.tmp1.merge, i64 0
 ; IR-NEXT:   %polly.access.polly.preload.tmp1.merge.load = load i32, i32* %polly.access.polly.preload.tmp1.merge, align 4
@@ -49,24 +47,22 @@
 ; IRA:      polly.preload.merge:
 ; IRA-NEXT:   %polly.preload.tmp1.merge = phi i32* [ %polly.access.I.load, %polly.preload.exec ], [ null, %polly.preload.cond ]
 ; IRA-NEXT:   store i32* %polly.preload.tmp1.merge, i32** %tmp1.preload.s2a
-; IRA-NEXT:   %12 = sext i32 %N to i64
-; IRA-NEXT:   %13 = icmp sge i64 %12, 1
-; IRA-NEXT:   %14 = sext i32 %q to i64
-; IRA-NEXT:   %15 = sext i32 %p to i64
-; IRA-NEXT:   %16 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %15, i64 %14)
-; IRA-NEXT:   %.obit5 = extractvalue { i64, i1 } %16, 1
-; IRA-NEXT:   %.res6 = extractvalue { i64, i1 } %16, 0
-; IRA-NEXT:   %17 = icmp sle i64 %.res6, 2147483647
-; IRA-NEXT:   %18 = and i1 %13, %17
-; IRA-NEXT:   %19 = sext i32 %q to i64
-; IRA-NEXT:   %20 = sext i32 %p to i64
-; IRA-NEXT:   %21 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %20, i64 %19)
-; IRA-NEXT:   %.obit7 = extractvalue { i64, i1 } %21, 1
-; IRA-NEXT:   %.res8 = extractvalue { i64, i1 } %21, 0
-; IRA-NEXT:   %22 = icmp sge i64 %.res8, -2147483648
-; IRA-NEXT:   %23 = and i1 %18, %22
+; IRA-NEXT:   %10 = sext i32 %N to i64
+; IRA-NEXT:   %11 = icmp sge i64 %10, 1
+; IRA-NEXT:   %12 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %p, i32 %q)
+; IRA-NEXT:   %.obit5 = extractvalue { i32, i1 } %12, 1
+; IRA-NEXT:   %.res6 = extractvalue { i32, i1 } %12, 0
+; IRA-NEXT:   %13 = sext i32 %.res6 to i64
+; IRA-NEXT:   %14 = icmp sle i64 %13, 2147483647
+; IRA-NEXT:   %15 = and i1 %11, %14
+; IRA-NEXT:   %16 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %p, i32 %q)
+; IRA-NEXT:   %.obit7 = extractvalue { i32, i1 } %16, 1
+; IRA-NEXT:   %.res8 = extractvalue { i32, i1 } %16, 0
+; IRA-NEXT:   %17 = sext i32 %.res8 to i64
+; IRA-NEXT:   %18 = icmp sge i64 %17, -2147483648
+; IRA-NEXT:   %19 = and i1 %15, %18
 ; IRA-NEXT:   %polly.preload.cond.overflown9 = xor i1 %.obit7, true
-; IRA-NEXT:   %polly.preload.cond.result10 = and i1 %23, %polly.preload.cond.overflown9
+; IRA-NEXT:   %polly.preload.cond.result10 = and i1 %19, %polly.preload.cond.overflown9
 ; IRA-NEXT:   br label %polly.preload.cond11
 ;
 ; IRA:      polly.preload.cond11:

Modified: polly/trunk/test/Isl/CodeGen/no-overflow-tracking.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/no-overflow-tracking.ll?rev=271513&r1=271512&r2=271513&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/no-overflow-tracking.ll (original)
+++ polly/trunk/test/Isl/CodeGen/no-overflow-tracking.ll Thu Jun  2 06:15:57 2016
@@ -16,22 +16,20 @@
 ; IR:      polly.preload.merge:
 ; IR-NEXT:   %polly.preload.tmp1.merge = phi i32* [ %polly.access.I.load, %polly.preload.exec ], [ null, %polly.preload.cond ]
 ; IR-NEXT:   store i32* %polly.preload.tmp1.merge, i32** %tmp1.preload.s2a
-; IR-NEXT:   %12 = sext i32 %N to i64
-; IR-NEXT:   %13 = icmp sge i64 %12, 1
-; IR-NEXT:   %14 = sext i32 %q to i64
-; IR-NEXT:   %15 = sext i32 %p to i64
-; IR-NEXT:   %16 = add nsw i64 %15, %14
-; IR-NEXT:   %17 = icmp sle i64 %16, 2147483647
-; IR-NEXT:   %18 = and i1 %13, %17
-; IR-NEXT:   %19 = sext i32 %q to i64
-; IR-NEXT:   %20 = sext i32 %p to i64
-; IR-NEXT:   %21 = add nsw i64 %20, %19
-; IR-NEXT:   %22 = icmp sge i64 %21, -2147483648
-; IR-NEXT:   %23 = and i1 %18, %22
+; IR-NEXT:   %10 = sext i32 %N to i64
+; IR-NEXT:   %11 = icmp sge i64 %10, 1
+; IR-NEXT:   %12 = add nsw i32 %p, %q
+; IR-NEXT:   %13 = sext i32 %12 to i64
+; IR-NEXT:   %14 = icmp sle i64 %13, 2147483647
+; IR-NEXT:   %15 = and i1 %11, %14
+; IR-NEXT:   %16 = add nsw i32 %p, %q
+; IR-NEXT:   %17 = sext i32 %16 to i64
+; IR-NEXT:   %18 = icmp sge i64 %17, -2147483648
+; IR-NEXT:   %19 = and i1 %15, %18
 ; IR-NEXT:   br label %polly.preload.cond1
 ;
 ; IR:      polly.preload.cond1:
-; IR-NEXT:   br i1 %23
+; IR-NEXT:   br i1 %19
 ;
 ; IR:      polly.preload.exec3:
 ; IR-NEXT:   %polly.access.polly.preload.tmp1.merge = getelementptr i32, i32* %polly.preload.tmp1.merge, i64 0




More information about the llvm-commits mailing list