diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2018-11-08 11:54:35 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-11-08 11:54:35 +0000 |
| commit | 266c087b9dff314433f318a9ef61ec7d1b44fbb4 (patch) | |
| tree | fe017679b2eb794df044ec095ae2d59b592ae061 /llvm/test/Transforms/IndVarSimplify/dont-recompute.ll | |
| parent | eb76d9fb716a01a326b8e8aeebe72db6e278e49f (diff) | |
| download | bcm5719-llvm-266c087b9dff314433f318a9ef61ec7d1b44fbb4.tar.gz bcm5719-llvm-266c087b9dff314433f318a9ef61ec7d1b44fbb4.zip | |
Return "[IndVars] Smart hard uses detection"
The patch has been reverted because it ended up prohibiting propagation
of a constant to exit value. For such values, we should skip all checks
related to hard uses because propagating a constant is always profitable.
Differential Revision: https://reviews.llvm.org/D53691
llvm-svn: 346397
Diffstat (limited to 'llvm/test/Transforms/IndVarSimplify/dont-recompute.ll')
| -rw-r--r-- | llvm/test/Transforms/IndVarSimplify/dont-recompute.ll | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll b/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll index c87cd6596c6..22087710a9c 100644 --- a/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll +++ b/llvm/test/Transforms/IndVarSimplify/dont-recompute.ll @@ -123,3 +123,54 @@ 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 +} |

