summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-11-03 20:21:32 +0000
committerHal Finkel <hfinkel@anl.gov>2014-11-03 20:21:32 +0000
commit1e16fa302e2c3f68ea8187e8b782397e0b24cd0f (patch)
tree9823bb9f7600846f641e9961cd0b8759e7d8e789 /llvm/test/Transforms
parent1ae35b902ba0482ef80fa3f778efd719c9626b41 (diff)
downloadbcm5719-llvm-1e16fa302e2c3f68ea8187e8b782397e0b24cd0f.tar.gz
bcm5719-llvm-1e16fa302e2c3f68ea8187e8b782397e0b24cd0f.zip
EarlyCSE should ignore calls to @llvm.assume
EarlyCSE uses a simple generation scheme for handling memory-based dependencies, and calls to @llvm.assume (which are marked as writing to memory to ensure the preservation of control dependencies) disturb that scheme unnecessarily. Skipping calls to @llvm.assume is legal, and the alternative (adding AA calls in EarlyCSE) is likely undesirable (we have GVN for that). Fixes PR21448. llvm-svn: 221175
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/EarlyCSE/basic.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Transforms/EarlyCSE/basic.ll b/llvm/test/Transforms/EarlyCSE/basic.ll
index 80704df9852..9f3e474aff9 100644
--- a/llvm/test/Transforms/EarlyCSE/basic.ll
+++ b/llvm/test/Transforms/EarlyCSE/basic.ll
@@ -1,5 +1,6 @@
; RUN: opt < %s -S -early-cse | FileCheck %s
+declare void @llvm.assume(i1) nounwind
; CHECK-LABEL: @test1(
define void @test1(i8 %V, i32 *%P) {
@@ -42,6 +43,16 @@ define i32 @test2(i32 *%P) {
; CHECK: ret i32 0
}
+; CHECK-LABEL: @test2a(
+define i32 @test2a(i32 *%P, i1 %b) {
+ %V1 = load i32* %P
+ tail call void @llvm.assume(i1 %b)
+ %V2 = load i32* %P
+ %Diff = sub i32 %V1, %V2
+ ret i32 %Diff
+ ; CHECK: ret i32 0
+}
+
;; Cross block load value numbering.
; CHECK-LABEL: @test3(
define i32 @test3(i32 *%P, i1 %Cond) {
@@ -58,6 +69,22 @@ F:
; CHECK: ret i32 0
}
+; CHECK-LABEL: @test3a(
+define i32 @test3a(i32 *%P, i1 %Cond, i1 %b) {
+ %V1 = load i32* %P
+ br i1 %Cond, label %T, label %F
+T:
+ store i32 4, i32* %P
+ ret i32 42
+F:
+ tail call void @llvm.assume(i1 %b)
+ %V2 = load i32* %P
+ %Diff = sub i32 %V1, %V2
+ ret i32 %Diff
+ ; CHECK: F:
+ ; CHECK: ret i32 0
+}
+
;; Cross block load value numbering stops when stores happen.
; CHECK-LABEL: @test4(
define i32 @test4(i32 *%P, i1 %Cond) {
@@ -97,6 +124,15 @@ define i32 @test6(i32 *%P) {
; CHECK: ret i32 42
}
+; CHECK-LABEL: @test6a(
+define i32 @test6a(i32 *%P, i1 %b) {
+ store i32 42, i32* %P
+ tail call void @llvm.assume(i1 %b)
+ %V1 = load i32* %P
+ ret i32 %V1
+ ; CHECK: ret i32 42
+}
+
;; Trivial dead store elimination.
; CHECK-LABEL: @test7(
define void @test7(i32 *%P) {
OpenPOWER on IntegriCloud