New testcase, rework testcases to fail if there are any gep's other than those
authorChris Lattner <sabre@nondot.org>
Sat, 16 Oct 2004 19:44:23 +0000 (19:44 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 16 Oct 2004 19:44:23 +0000 (19:44 +0000)
involving %B instead of allowing any geps except %A's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17065 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/getelementptr.ll

index 1e991d0e369b04ee5a054bc217609a841b5bbbaf..d05f0cdc6d4debfa5a8f99e02ae096287307da4c 100644 (file)
@@ -1,6 +1,6 @@
 ; The %A getelementptr instruction should be eliminated here
 
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr | not grep '%A '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v '%B' | not grep getelementptr
 
 %Global = constant [10 x sbyte] c"helloworld"
 
@@ -27,10 +27,11 @@ int* %foo4({int} *%I) { ; Test that two getelementptr insts fold
        ret int* %B
 }
 
-sbyte * %foo5() {
+void %foo5(sbyte %B) {
        ; This should be turned into a constexpr instead of being an instruction
        %A = getelementptr [10 x sbyte]* %Global, long 0, long 4
-       ret sbyte* %A
+       store sbyte %B, sbyte* %A
+       ret void
 }
 
 int* %foo6() {
@@ -51,3 +52,9 @@ sbyte* %foo8([10 x int]* %X) {
        %B = cast int* %A to sbyte*
        ret sbyte * %B
 }
+
+int %test9() {
+       %A = getelementptr {int, double}* null, int 0, uint 1
+       %B = cast double* %A to int
+       ret int %B
+}