aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/EarlyCSE
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-02 23:04:14 +0000
committerChris Lattner <sabre@nondot.org>2011-01-02 23:04:14 +0000
commitcc9eab26b3867fa4a835deb518a6a606882e8f49 (patch)
treee556543efc455fba8f299e7b7bd8e43b7167b948 /test/Transforms/EarlyCSE
parent9fc5cdf77c812aaa80419036de27576d45894d0d (diff)
downloadexternal_llvm-cc9eab26b3867fa4a835deb518a6a606882e8f49.zip
external_llvm-cc9eab26b3867fa4a835deb518a6a606882e8f49.tar.gz
external_llvm-cc9eab26b3867fa4a835deb518a6a606882e8f49.tar.bz2
Enhance earlycse to do CSE of casts, instsimplify and die.
Add a testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/EarlyCSE')
-rw-r--r--test/Transforms/EarlyCSE/basic.ll21
-rw-r--r--test/Transforms/EarlyCSE/dg.exp3
2 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/EarlyCSE/basic.ll b/test/Transforms/EarlyCSE/basic.ll
new file mode 100644
index 0000000..d42f503
--- /dev/null
+++ b/test/Transforms/EarlyCSE/basic.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -S -early-cse | FileCheck %s
+
+
+; CHECK: @test1
+define void @test1(i8 %V, i32 *%P) {
+ %A = bitcast i64 42 to double ;; dead
+ %B = add i32 4, 19 ;; constant folds
+ store i32 %B, i32* %P
+
+ ; CHECK-NEXT: store i32 23, i32* %P
+
+ %C = zext i8 %V to i32
+ %D = zext i8 %V to i32 ;; CSE
+ volatile store i32 %C, i32* %P
+ volatile store i32 %D, i32* %P
+
+ ; CHECK-NEXT: %C = zext i8 %V to i32
+ ; CHECK-NEXT: volatile store i32 %C
+ ; CHECK-NEXT: volatile store i32 %C
+ ret void
+}
diff --git a/test/Transforms/EarlyCSE/dg.exp b/test/Transforms/EarlyCSE/dg.exp
new file mode 100644
index 0000000..de42dad
--- /dev/null
+++ b/test/Transforms/EarlyCSE/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]]