[PATCH] D10477: Expand loop reroll to handle loop with multiple induction variables and negative increment -part 1/3

Lawrence Hu lawrence at codeaurora.org
Tue Jul 21 18:51:46 PDT 2015


hulx2000 marked 2 inline comments as done.

================
Comment at: test/Transforms/LoopReroll/negative.ll:29-38
@@ +28,12 @@
+
+  %sum4.015 = phi i64 [ 0, %while.body.lr.ph ], [ %add4, %while.body ]
+  %len.addr.014 = phi i32 [ %len, %while.body.lr.ph ], [ %sub5, %while.body ]
+  %idxprom = sext i32 %len.addr.014 to i64
+  %arrayidx = getelementptr inbounds i8, i8* %buf, i64 %idxprom
+  %0 = load i8, i8* %arrayidx, align 1
+  %conv = zext i8 %0 to i64
+  %add = add i64 %conv, %sum4.015
+  %sub = add nsw i32 %len.addr.014, -1
+  %idxprom1 = sext i32 %sub to i64
+  %arrayidx2 = getelementptr inbounds i8, i8* %buf, i64 %idxprom1
+  %1 = load i8, i8* %arrayidx2, align 1
----------------
mzolotukhin wrote:
> Do we really need to have this body, or would the test work with almost empty loop?
> Like this:
> ```
> while (len > 1) {
>             len -= 2;
>         }
> ```
> instead of 
> ```
> while (len > 1) {
>             sum4 += buf[len];
>             sum4 += buf[len-1];
>             len -= 2;
>         }
> ```
> Since you only run loop-reroll, it shouldn't be collapsed to nop.
The simple loop won't do enough test for the logic in LoopReroll


Repository:
  rL LLVM

http://reviews.llvm.org/D10477







More information about the llvm-commits mailing list