diff options
author | Owen Anderson <resistor@mac.com> | 2007-07-24 17:55:58 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-07-24 17:55:58 +0000 |
commit | 85c4064356246ca7398ad4815f2aca56be9e1442 (patch) | |
tree | e54400d366db75f504f99afcf852ba467597c242 /test/Transforms/GVN | |
parent | f63144c2294fd27ee42f639623dae9c91f7c7e5b (diff) | |
download | external_llvm-85c4064356246ca7398ad4815f2aca56be9e1442.zip external_llvm-85c4064356246ca7398ad4815f2aca56be9e1442.tar.gz external_llvm-85c4064356246ca7398ad4815f2aca56be9e1442.tar.bz2 |
Add a GVN pass, using the value numbering code I developed for GVNPRE and the
load elimination code from RedundantLoadElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40469 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GVN')
-rw-r--r-- | test/Transforms/GVN/basic.ll | 10 | ||||
-rw-r--r-- | test/Transforms/GVN/dg.exp | 3 | ||||
-rw-r--r-- | test/Transforms/GVN/mixed.ll | 13 |
3 files changed, 26 insertions, 0 deletions
diff --git a/test/Transforms/GVN/basic.ll b/test/Transforms/GVN/basic.ll new file mode 100644 index 0000000..8c72e78 --- /dev/null +++ b/test/Transforms/GVN/basic.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {%z2 =} + +define i32 @main() { +block1: + %z1 = bitcast i32 0 to i32 + br label %block2 +block2: + %z2 = bitcast i32 0 to i32 + ret i32 %z2 +}
\ No newline at end of file diff --git a/test/Transforms/GVN/dg.exp b/test/Transforms/GVN/dg.exp new file mode 100644 index 0000000..879685c --- /dev/null +++ b/test/Transforms/GVN/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Transforms/GVN/mixed.ll b/test/Transforms/GVN/mixed.ll new file mode 100644 index 0000000..08c80d6 --- /dev/null +++ b/test/Transforms/GVN/mixed.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep DEADLOAD +; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep DEADGEP + +define i32 @main(i32** %p) { +block1: + %z1 = load i32** %p + %z2 = getelementptr i32* %z1, i32 0 + %z3 = load i32* %z2 + %DEADLOAD = load i32** %p + %DEADGEP = getelementptr i32* %DEADLOAD, i32 0 + %DEADLOAD2 = load i32* %DEADGEP + ret i32 %DEADLOAD2 +}
\ No newline at end of file |