[PATCH] [IndVarSimplify] Widen signed loop compare instructions to enable additional optimizations.
Chad Rosier
mcrosier at codeaurora.org
Fri Sep 12 10:25:39 PDT 2014
Just a few comments to save on review time.
Chad
================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:935
@@ +934,3 @@
+ ICmpInst *Cmp = dyn_cast<ICmpInst>(DU.NarrowUse);
+ if (!Cmp || !Cmp->hasOneUse())
+ return false;
----------------
No that I think about it, I'm not sure the single use is necessary.
================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:954
@@ +953,3 @@
+ if (CastWidth < IVWidth) {
+ Value *ExtOp = getExtend(Op, WideType, IsSigned, Cmp);
+ DU.NarrowUse->replaceUsesOfWith(Op, ExtOp);
----------------
I reuse getExtend because it tries hard to hoist the extend as far out of the loop as possible.
================
Comment at: test/Transforms/IndVarSimplify/elim-extend.ll:10
@@ -9,2 +9,3 @@
br label %loop
+; CHECK: sext i32
; CHECK: loop:
----------------
This is the sext on limit, which is outside of the loop. This isn't an extend we need to CHECK-NOT.
================
Comment at: test/Transforms/IndVarSimplify/verify-scev.ll:383
@@ -382,2 +382,3 @@
%0 = load i32* undef, align 4
+ %1 = sext i32 %0 to i64
br label %for.body65.us
----------------
Benjamin,
Can you verify this is a safe change on this test case? My patch changes how the SCEV output, so I modified the test case to the new result.
================
Comment at: test/Transforms/IndVarSimplify/widen-loop-comp.ll:19
@@ +18,3 @@
+
+define i32 @test1() {
+entry:
----------------
This is the example from the commit-list message.
================
Comment at: test/Transforms/LoopSimplify/merge-exits.ll:1
@@ -1,4 +1,2 @@
-; RUN: opt < %s -loop-simplify -loop-rotate -instcombine -indvars -S -verify-loop-info -verify-dom-info > %t
-; RUN: not grep sext %t
-; RUN: grep "phi i64" %t | count 1
+; RUN: opt < %s -loop-simplify -loop-rotate -instcombine -indvars -S -verify-loop-info -verify-dom-info | FileCheck %s
----------------
FileCheckize.
================
Comment at: test/Transforms/LoopSimplify/merge-exits.ll:14
@@ +13,3 @@
+; CHECK-NOT: phi i64
+; CHECK-NOT: sext
+
----------------
No sext in loop.
http://reviews.llvm.org/D5333
More information about the llvm-commits
mailing list