diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-06-08 17:48:31 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-06-08 17:48:31 +0000 |
| commit | a19edc4d15b0dae0210b90615775edd76f021008 (patch) | |
| tree | 0957e2cc19b04b966ac15ff4291feb8641ee02d5 /llvm/test/Analysis/ScalarEvolution/nsw.ll | |
| parent | 86be3748a6f0e288d24054f402f0b9afb0912dc3 (diff) | |
| download | bcm5719-llvm-a19edc4d15b0dae0210b90615775edd76f021008.tar.gz bcm5719-llvm-a19edc4d15b0dae0210b90615775edd76f021008.zip | |
Fix a bug in SCEV's poison value propagation
The worklist algorithm introduced in rL271151 didn't check to see if the
direct users of the post-inc add recurrence propagates poison. This
change fixes the problem and makes the code structure more obvious.
Note for release managers: correctness wise, this bug wasn't a
regression introduced by rL271151 -- the behavior of SCEV around
post-inc add recurrences was strictly improved (in terms of correctness)
in rL271151.
llvm-svn: 272179
Diffstat (limited to 'llvm/test/Analysis/ScalarEvolution/nsw.ll')
| -rw-r--r-- | llvm/test/Analysis/ScalarEvolution/nsw.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/nsw.ll b/llvm/test/Analysis/ScalarEvolution/nsw.ll index d015717e354..e89973be2b0 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw.ll @@ -204,3 +204,39 @@ for.body: for.end: ret void } + + +define void @bad_postinc_nsw_a(i32 %n) { +; CHECK-LABEL: Classifying expressions for: @bad_postinc_nsw_a +entry: + br label %loop + +loop: + %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] + %iv.inc = add nsw i32 %iv, 7 +; CHECK: %iv.inc = add nsw i32 %iv, 7 +; CHECK-NEXT: --> {7,+,7}<nuw><%loop> + %becond = icmp ult i32 %iv, %n + br i1 %becond, label %loop, label %leave + +leave: + ret void +} + +define void @bad_postinc_nsw_b(i32 %n) { +; CHECK-LABEL: Classifying expressions for: @bad_postinc_nsw_b +entry: + br label %loop + +loop: + %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] + %iv.inc = add nsw i32 %iv, 7 + %iv.inc.and = and i32 %iv.inc, 0 +; CHECK: %iv.inc = add nsw i32 %iv, 7 +; CHECK-NEXT: --> {7,+,7}<nuw><%loop> + %becond = icmp ult i32 %iv.inc.and, %n + br i1 %becond, label %loop, label %leave + +leave: + ret void +} |

