New testcase, rework testcases to fail if there are any gep's other than those

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
This commit is contained in:
Chris Lattner
2004-10-16 19:44:23 +00:00
parent a04d0a19e3
commit 51a2c5aebf

View File

@@ -1,6 +1,6 @@
; The %A getelementptr instruction should be eliminated here ; 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" %Global = constant [10 x sbyte] c"helloworld"
@@ -27,10 +27,11 @@ int* %foo4({int} *%I) { ; Test that two getelementptr insts fold
ret int* %B ret int* %B
} }
sbyte * %foo5() { void %foo5(sbyte %B) {
; This should be turned into a constexpr instead of being an instruction ; This should be turned into a constexpr instead of being an instruction
%A = getelementptr [10 x sbyte]* %Global, long 0, long 4 %A = getelementptr [10 x sbyte]* %Global, long 0, long 4
ret sbyte* %A store sbyte %B, sbyte* %A
ret void
} }
int* %foo6() { int* %foo6() {
@@ -51,3 +52,9 @@ sbyte* %foo8([10 x int]* %X) {
%B = cast int* %A to sbyte* %B = cast int* %A to sbyte*
ret sbyte * %B ret sbyte * %B
} }
int %test9() {
%A = getelementptr {int, double}* null, int 0, uint 1
%B = cast double* %A to int
ret int %B
}