[llvm] r217962 - [IndVarSimplify] Partially revert r217953 to see if this fixes the bots.

Chad Rosier mcrosier at codeaurora.org
Wed Sep 17 09:35:10 PDT 2014


Author: mcrosier
Date: Wed Sep 17 11:35:09 2014
New Revision: 217962

URL: http://llvm.org/viewvc/llvm-project?rev=217962&view=rev
Log:
[IndVarSimplify] Partially revert r217953 to see if this fixes the bots.

Specifically, disable widening of unsigned compare instructions.

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
    llvm/trunk/test/Transforms/IndVarSimplify/widen-loop-comp.ll

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=217962&r1=217961&r2=217962&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Sep 17 11:35:09 2014
@@ -936,6 +936,10 @@ bool WidenIV::WidenLoopCompare(NarrowIVD
   if (!Cmp)
     return false;
 
+  bool IsSigned = CmpInst::isSigned(Cmp->getPredicate());
+  if (!IsSigned)
+    return false;
+
   Value *Op = Cmp->getOperand(Cmp->getOperand(0) == DU.NarrowDef ? 1 : 0);
   unsigned CastWidth = SE->getTypeSizeInBits(Op->getType());
   unsigned IVWidth = SE->getTypeSizeInBits(WideType);
@@ -947,7 +951,6 @@ bool WidenIV::WidenLoopCompare(NarrowIVD
 
   // Widen the other operand of the compare, if necessary.
   if (CastWidth < IVWidth) {
-    bool IsSigned = CmpInst::isSigned(Cmp->getPredicate());
     Value *ExtOp = getExtend(Op, WideType, IsSigned, Cmp);
     DU.NarrowUse->replaceUsesOfWith(Op, ExtOp);
   }

Modified: llvm/trunk/test/Transforms/IndVarSimplify/widen-loop-comp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/widen-loop-comp.ll?rev=217962&r1=217961&r2=217962&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/widen-loop-comp.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/widen-loop-comp.ll Wed Sep 17 11:35:09 2014
@@ -136,31 +136,3 @@ for.body:
 for.end:
   ret i32 %sum.0
 }
-
-; CHECK-LABEL: @test4
-; CHECK: zext i32 %b
-; CHECK: for.cond:
-; CHECK: phi i64
-; CHECK: icmp ule i64
-
-define i32 @test4(i32* %a, i32 %b) {
-entry:
-  br label %for.cond
-
-for.cond:
-  %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.body ]
-  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
-  %cmp = icmp ule i32 %i.0, %b
-  br i1 %cmp, label %for.body, label %for.end
-
-for.body:
-  %idxprom = sext i32 %i.0 to i64
-  %arrayidx = getelementptr inbounds i32* %a, i64 %idxprom
-  %0 = load i32* %arrayidx, align 4
-  %add = add nsw i32 %sum.0, %0
-  %inc = add nsw i32 %i.0, 1
-  br label %for.cond
-
-for.end:
-  ret i32 %sum.0
-}





More information about the llvm-commits mailing list