[PATCH] D58435: [SCEV] Ensure that isHighCostExpansion takes into account what is being divided
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 07:04:13 PST 2019
dmgreen added a comment.
> Is it possible that the tests were checking the correctness for certain expressions that we no longer check because these happen to be expensive?
All the tests in replace-loop-exit-folds.ll are added for this patch. It's showing the changes produced by this patch, but the left hand files are not in-tree yet (it would have been clearer if I would have mentioned that). Most of the tests are a loop like this, with S being signed or unsigned, and with a while or a do loop. They were originally out of D52508 <https://reviews.llvm.org/D52508> (but that doesn't fix most of the cases).
while(S >= 32) {
S -= 32;
something();
};
return S;
no-iv-rewrite.ll is returning back to what it was before rL194116 <https://reviews.llvm.org/rL194116>, so is now testing the original point of the test again. The full diff for before and after is much like the other newly added tests (i.e. now a lot smaller):
define i64 @cloneOr(i32 %limit, i64* %base) #0 {
entry:
%halfLim = ashr i32 %limit, 2
%0 = sext i32 %halfLim to i64
- %1 = icmp sgt i32 %halfLim, 2
- %smax = select i1 %1, i32 %halfLim, i32 2
- %2 = add i32 %smax, -1
- %3 = zext i32 %2 to i64
- %4 = lshr i64 %3, 1
- %5 = shl i64 %4, 1
br label %loop
loop: ; preds = %loop, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %loop ], [ 0, %entry ]
%adr = getelementptr i64, i64* %base, i64 %indvars.iv
%val = load i64, i64* %adr
+ %1 = or i64 %indvars.iv, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%cmp = icmp slt i64 %indvars.iv.next, %0
br i1 %cmp, label %loop, label %exit
exit: ; preds = %loop
%val.lcssa = phi i64 [ %val, %loop ]
- %6 = add i64 %5, 1
- %result = and i64 %val.lcssa, %6
+ %t3.lcssa = phi i64 [ %1, %loop ]
+ %result = and i64 %val.lcssa, %t3.lcssa
ret i64 %result
}
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58435/new/
https://reviews.llvm.org/D58435
More information about the llvm-commits
mailing list