diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-05-29 00:31:18 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-05-29 00:31:18 +0000 |
| commit | 70c2bbd29c71c0d35bd09c89f4d2f0af4991b6d3 (patch) | |
| tree | ddcd213be99d590328bf7b41d62bc818fd68c259 /llvm/test | |
| parent | 484b5ab39d20586e1d554adf5b38c08b43c98dec (diff) | |
| download | bcm5719-llvm-70c2bbd29c71c0d35bd09c89f4d2f0af4991b6d3.tar.gz bcm5719-llvm-70c2bbd29c71c0d35bd09c89f4d2f0af4991b6d3.zip | |
[ValueTracking] ICmp instructions propagate poison
This is a stripped down version of D19211, leaving out the questionable
"branching in poison is UB" bit.
llvm-svn: 271150
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll b/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll index a9d55f1b3db..2fcb4c038f2 100644 --- a/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll +++ b/llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll @@ -57,6 +57,30 @@ exit: ret void } +define void @test-add-nuw-from-icmp(float* %input, i32 %offset, + i32 %numIterations) { +; CHECK-LABEL: @test-add-nuw-from-icmp +entry: + br label %loop +loop: + %i = phi i32 [ %nexti, %loop ], [ 0, %entry ] + +; CHECK: %index32 = +; CHECK: --> {%offset,+,1}<nuw> + %index32 = add nuw i32 %i, %offset + %cmp = icmp sgt i32 %index32, 0 + %cmp.idx = sext i1 %cmp to i32 + + %ptr = getelementptr inbounds float, float* %input, i32 %cmp.idx + %nexti = add nuw i32 %i, 1 + %f = load float, float* %ptr, align 4 + %exitcond = icmp eq i32 %nexti, %numIterations + br i1 %exitcond, label %exit, label %loop + +exit: + ret void +} + ; With no load to trigger UB from poison, we cannot infer nsw. define void @test-add-no-load(float* %input, i32 %offset, i32 %numIterations) { ; CHECK-LABEL: @test-add-no-load |

