summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimplifyCFG
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2016-08-01 09:34:48 +0000
committerJames Molloy <james.molloy@arm.com>2016-08-01 09:34:48 +0000
commitbade86cedcba12c21677b2ccf0ed6ada2f3ef268 (patch)
tree0647e20343cbcf691bc19288d4c4cba9c40748c3 /llvm/test/Transforms/SimplifyCFG
parentab5a4c7dbb0a16ea9bc4bfc5d5bdd67798e87958 (diff)
downloadbcm5719-llvm-bade86cedcba12c21677b2ccf0ed6ada2f3ef268.tar.gz
bcm5719-llvm-bade86cedcba12c21677b2ccf0ed6ada2f3ef268.zip
[SimplifyCFG] Fix nasty RAUW bug from r277325
Using RAUW was wrong here; if we have a switch transform such as: 18 -> 6 then 6 -> 0 If we use RAUW, while performing the second transform the *transformed* 6 from the first will be also replaced, so we end up with: 18 -> 0 6 -> 0 Found by clang stage2 bootstrap; testcase added. llvm-svn: 277332
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
-rw-r--r--llvm/test/Transforms/SimplifyCFG/rangereduce.ll28
1 files changed, 27 insertions, 1 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/rangereduce.ll b/llvm/test/Transforms/SimplifyCFG/rangereduce.ll
index d1a745ecfd9..1b6434a4129 100644
--- a/llvm/test/Transforms/SimplifyCFG/rangereduce.ll
+++ b/llvm/test/Transforms/SimplifyCFG/rangereduce.ll
@@ -192,4 +192,30 @@ two:
ret i32 1143
three:
ret i32 99783
-} \ No newline at end of file
+}
+
+; CHECK-LABEL: @test9
+; CHECK: switch
+; CHECK: i32 6
+; CHECK: i32 7
+; CHECK: i32 0
+; CHECK: i32 2
+define i32 @test9(i32 %a) {
+ switch i32 %a, label %def [
+ i32 18, label %one
+ i32 20, label %two
+ i32 6, label %three
+ i32 10, label %three
+ ]
+
+def:
+ ret i32 8867
+
+one:
+ ret i32 11984
+two:
+ ret i32 1143
+three:
+ ret i32 99783
+}
+
OpenPOWER on IntegriCloud