diff options
author | Manman Ren <mren@apple.com> | 2012-09-05 23:45:58 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-09-05 23:45:58 +0000 |
commit | 408853ea162b6b68d3e8defc7f96afad1942dd11 (patch) | |
tree | 14430b8ff00bb49d4f3a09a909130da5b023e990 /test/Transforms/JumpThreading/select.ll | |
parent | ec65be84cd630d53233e7a37f0ef9d2303ac5153 (diff) | |
download | external_llvm-408853ea162b6b68d3e8defc7f96afad1942dd11.zip external_llvm-408853ea162b6b68d3e8defc7f96afad1942dd11.tar.gz external_llvm-408853ea162b6b68d3e8defc7f96afad1942dd11.tar.bz2 |
JumpThreading: when default destination is the destination of some cases in a
switch, make sure we include the value for the cases when calculating edge
value from switch to the default destination.
rdar://12241132
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading/select.ll')
-rw-r--r-- | test/Transforms/JumpThreading/select.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/select.ll b/test/Transforms/JumpThreading/select.ll index 8a81857..9676efe 100644 --- a/test/Transforms/JumpThreading/select.ll +++ b/test/Transforms/JumpThreading/select.ll @@ -121,3 +121,39 @@ L4: call void @quux() br label %L0 } + +; Make sure the edge value of %0 from entry to L2 includes 0 and L3 is +; reachable. +; CHECK: test_switch_default +; CHECK: entry: +; CHECK: load +; CHECK: switch +; CHECK: [[THREADED:[A-Za-z.0-9]+]]: +; CHECK: store +; CHECK: br +; CHECK: L2: +; CHECK: icmp +define void @test_switch_default(i32* nocapture %status) nounwind { +entry: + %0 = load i32* %status, align 4 + switch i32 %0, label %L2 [ + i32 5061, label %L1 + i32 0, label %L2 + ] + +L1: + store i32 10025, i32* %status, align 4 + br label %L2 + +L2: + %1 = load i32* %status, align 4 + %cmp57.i = icmp eq i32 %1, 0 + br i1 %cmp57.i, label %L3, label %L4 + +L3: + store i32 10000, i32* %status, align 4 + br label %L4 + +L4: + ret void +} |