summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2018-11-06 02:02:05 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2018-11-06 02:02:05 +0000
commite059f4452b270bcf75a343effd4ca4e0ed05b518 (patch)
tree06c547bb8427d40369e486daa93b57ffe3e19f53 /llvm/test/Transforms
parent6c7073f2f8007a6bb1d992eb68a2eaadd7f4529e (diff)
downloadbcm5719-llvm-e059f4452b270bcf75a343effd4ca4e0ed05b518.tar.gz
bcm5719-llvm-e059f4452b270bcf75a343effd4ca4e0ed05b518.zip
Revert "[IndVars] Smart hard uses detection"
This reverts commit 2f425e9c7946b9d74e64ebbfa33c1caa36914402. It seems that the check that we still should do the transform if we know the result is constant is missing in this code. So the logic that has been deleted by this change is still sometimes accidentally useful. I revert the change to see what can be done about it. The motivating case is the following: @Y = global [400 x i16] zeroinitializer, align 1 define i16 @foo() { entry: br label %for.body for.body: ; preds = %entry, %for.body %i = phi i16 [ 0, %entry ], [ %inc, %for.body ] %arrayidx = getelementptr inbounds [400 x i16], [400 x i16]* @Y, i16 0, i16 %i store i16 0, i16* %arrayidx, align 1 %inc = add nuw nsw i16 %i, 1 %cmp = icmp ult i16 %inc, 400 br i1 %cmp, label %for.body, label %for.end for.end: ; preds = %for.body %inc.lcssa = phi i16 [ %inc, %for.body ] ret i16 %inc.lcssa } We should be able to figure out that the result is constant, but the patch breaks it. Differential Revision: https://reviews.llvm.org/D51584 llvm-svn: 346198
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/IndVarSimplify/dont-recompute.ll51
-rw-r--r--llvm/test/Transforms/IndVarSimplify/lrev-existing-umin.ll38
2 files changed, 0 insertions, 89 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll b/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll
index 22087710a9c..c87cd6596c6 100644
--- a/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll
+++ b/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll
@@ -123,54 +123,3 @@ for.end: ; preds = %for.body
tail call void @func(i32 %soft_use)
ret void
}
-
-; CHECK-LABEL: @test5(
-define void @test5(i32 %m) nounwind uwtable {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %a.05 = phi i32 [ 0, %entry ], [ %add, %for.body ]
- %add = add i32 %a.05, %m
- %soft_use = add i32 %add, 123
-; CHECK: tail call void @func(i32 %soft_use)
- tail call void @func(i32 %soft_use)
- %inc = add nsw i32 %i.06, 1
- %exitcond = icmp eq i32 %inc, 186
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
-; CHECK: for.end:
-; CHECK-NOT: mul i32 %m, 186
-; CHECK:%add.lcssa = phi i32 [ %add, %for.body ]
-; CHECK-NEXT: tail call void @func(i32 %add.lcssa)
- tail call void @func(i32 %add)
- ret void
-}
-
-; CHECK-LABEL: @test6(
-define void @test6(i32 %m, i32* %p) nounwind uwtable {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %a.05 = phi i32 [ 0, %entry ], [ %add, %for.body ]
- %add = add i32 %a.05, %m
- %soft_use = add i32 %add, 123
-; CHECK: store i32 %soft_use, i32* %pidx
- %pidx = getelementptr i32, i32* %p, i32 %add
- store i32 %soft_use, i32* %pidx
- %inc = add nsw i32 %i.06, 1
- %exitcond = icmp eq i32 %inc, 186
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
-; CHECK: for.end:
-; CHECK-NOT: mul i32 %m, 186
-; CHECK:%add.lcssa = phi i32 [ %add, %for.body ]
-; CHECK-NEXT: tail call void @func(i32 %add.lcssa)
- tail call void @func(i32 %add)
- ret void
-}
diff --git a/llvm/test/Transforms/IndVarSimplify/lrev-existing-umin.ll b/llvm/test/Transforms/IndVarSimplify/lrev-existing-umin.ll
index fff76675f17..961c9fd944d 100644
--- a/llvm/test/Transforms/IndVarSimplify/lrev-existing-umin.ll
+++ b/llvm/test/Transforms/IndVarSimplify/lrev-existing-umin.ll
@@ -1,7 +1,5 @@
; RUN: opt -S -indvars < %s | FileCheck %s
-; Do not rewrite the user outside the loop because we must keep the instruction
-; inside the loop due to store. Rewrite doesn't give us any profit.
define void @f(i32 %length.i.88, i32 %length.i, i8* %tmp12, i32 %tmp10, i8* %tmp8) {
; CHECK-LABEL: @f(
not_zero11.preheader:
@@ -26,42 +24,6 @@ not_zero11:
main.exit.selector:
; CHECK-LABEL: main.exit.selector:
-; CHECK: %tmp22.lcssa = phi i32 [ %tmp22, %not_zero11 ]
-; CHECK: %tmp24 = icmp slt i32 %tmp22.lcssa, %length.
- %tmp24 = icmp slt i32 %tmp22, %length.i
- br i1 %tmp24, label %not_zero11.postloop, label %leave
-
-leave:
- ret void
-
-not_zero11.postloop:
- ret void
-}
-
-; Rewrite the user outside the loop because there is no hard users inside the loop.
-define void @f1(i32 %length.i.88, i32 %length.i, i8* %tmp12, i32 %tmp10, i8* %tmp8) {
-; CHECK-LABEL: @f1(
-not_zero11.preheader:
- %tmp13 = icmp ugt i32 %length.i, %length.i.88
- %tmp14 = select i1 %tmp13, i32 %length.i.88, i32 %length.i
- %tmp15 = icmp sgt i32 %tmp14, 0
- br i1 %tmp15, label %not_zero11, label %not_zero11.postloop
-
-not_zero11:
- %v_1 = phi i32 [ %tmp22, %not_zero11 ], [ 0, %not_zero11.preheader ]
- %tmp16 = zext i32 %v_1 to i64
- %tmp17 = getelementptr inbounds i8, i8* %tmp8, i64 %tmp16
- %tmp18 = load i8, i8* %tmp17, align 1
- %tmp19 = zext i8 %tmp18 to i32
- %tmp20 = or i32 %tmp19, %tmp10
- %tmp21 = trunc i32 %tmp20 to i8
- %addr22 = getelementptr inbounds i8, i8* %tmp12, i64 %tmp16
- %tmp22 = add nuw nsw i32 %v_1, 1
- %tmp23 = icmp slt i32 %tmp22, %tmp14
- br i1 %tmp23, label %not_zero11, label %main.exit.selector
-
-main.exit.selector:
-; CHECK-LABEL: main.exit.selector:
; CHECK: %tmp24 = icmp slt i32 %tmp14, %length.i
%tmp24 = icmp slt i32 %tmp22, %length.i
br i1 %tmp24, label %not_zero11.postloop, label %leave
OpenPOWER on IntegriCloud