summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2003-07-21 19:41:51 +0000
committerJohn Criswell <criswell@uiuc.edu>2003-07-21 19:41:51 +0000
commitcf2a7385ddc65313b9a5b7c5786ae609e4881bc4 (patch)
tree2307c46e7929864f51426637255890a398574b6c /test
parent432312d8bf3242cd6f6af4168f7b6410f6ee6895 (diff)
downloadllvm-cf2a7385ddc65313b9a5b7c5786ae609e4881bc4.tar.gz
llvm-cf2a7385ddc65313b9a5b7c5786ae609e4881bc4.tar.bz2
llvm-cf2a7385ddc65313b9a5b7c5786ae609e4881bc4.tar.xz
Regression test for the Instruction Combining optimizization.
This test helps to see if the optimization correctly handles variables that are declared constant and external. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
new file mode 100644
index 0000000000..a98a68ef1f
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
@@ -0,0 +1,46 @@
+;
+; Test: ExternalConstant
+;
+; Description:
+; This regression test helps check whether the instruction combining
+; optimization pass correctly handles global variables which are marked
+; as external and constant.
+;
+; If a problem occurs, we should die on an assert(). Otherwise, we
+; should pass through the optimizer without failure.
+;
+; Extra code:
+; RUN: as < %s | opt -instcombine
+;
+
+target endian = little
+target pointersize = 32
+%silly = external constant int ; <int*> [#uses=1]
+
+implementation ; Functions:
+
+declare void %bzero(sbyte*, uint)
+
+declare void %bcopy(sbyte*, sbyte*, uint)
+
+declare int %bcmp(sbyte*, sbyte*, uint)
+
+declare int %fputs(sbyte*, sbyte*)
+
+declare int %fputs_unlocked(sbyte*, sbyte*)
+
+int %function(int %a.1) {
+entry: ; No predecessors!
+ %a.0 = alloca int ; <int*> [#uses=2]
+ %result = alloca int ; <int*> [#uses=2]
+ store int %a.1, int* %a.0
+ %tmp.0 = load int* %a.0 ; <int> [#uses=1]
+ %tmp.1 = load int* %silly ; <int> [#uses=1]
+ %tmp.2 = add int %tmp.0, %tmp.1 ; <int> [#uses=1]
+ store int %tmp.2, int* %result
+ br label %return
+
+return: ; preds = %entry
+ %tmp.3 = load int* %result ; <int> [#uses=1]
+ ret int %tmp.3
+}