diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-28 00:32:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-28 00:32:30 +0000 |
commit | 05bb789430bab7d8fae1e94fb9aa0bb21e679ebf (patch) | |
tree | 18b4170569790fcb8f5f6159883c29d91fbd45b6 /test | |
parent | 4d44d7a2dc0b17a2782389f13acce3c10a7abe51 (diff) | |
download | llvm-05bb789430bab7d8fae1e94fb9aa0bb21e679ebf.tar.gz llvm-05bb789430bab7d8fae1e94fb9aa0bb21e679ebf.tar.bz2 llvm-05bb789430bab7d8fae1e94fb9aa0bb21e679ebf.tar.xz |
Fix PR1938 by forcing the code that uses an undefined value to branch one
way or the other. Rewriting the code itself prevents subsequent analysis
passes from making contradictory conclusions about the code that could
cause an infeasible path to be made feasible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll b/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll new file mode 100644 index 0000000000..18ab5e8cdc --- /dev/null +++ b/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll @@ -0,0 +1,36 @@ +; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep undef | count 1 +; PR1938 + +define i32 @main() { +entry: + br label %bb + +bb: + %indvar = phi i32 [ 0, %entry ], [ %k, %bb.backedge ] + %k = add i32 %indvar, 1 + br i1 undef, label %cond_true, label %cond_false + +cond_true: + %tmp97 = icmp slt i32 %k, 10 + br i1 %tmp97, label %bb.backedge, label %bb12 + +bb.backedge: + br label %bb + +cond_false: + %tmp9 = icmp slt i32 %k, 10 + br i1 %tmp9, label %bb.backedge, label %bb12 + +bb12: + %tmp14 = icmp eq i32 %k, 10 + br i1 %tmp14, label %cond_next18, label %cond_true17 + +cond_true17: + tail call void @abort( ) + unreachable + +cond_next18: + ret i32 0 +} + +declare void @abort() |