Test that the instruction combiner can fold away a cast in a GEP instruction.
authorChris Lattner <sabre@nondot.org>
Sun, 22 Feb 2004 05:24:09 +0000 (05:24 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 Feb 2004 05:24:09 +0000 (05:24 +0000)
This occurs in 164.gzip, as a result of it declaring arrays extern.

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

test/Transforms/InstCombine/cast.ll

index 11d95ca7e5604da85b1346c0ea74f786982e4bf0..53e2c2e25de02d50df504f4fd7d656721cd6e7e5 100644 (file)
@@ -2,6 +2,8 @@
 
 ; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep '%c' | not grep cast
 
+%inbuf = external global [32832 x ubyte]
+
 implementation
 
 int %test1(int %A) {
@@ -79,3 +81,9 @@ int* %test12() {
        %c = cast [4 x sbyte]* %p to int*
        ret int* %c
 }
+
+
+ubyte *%test13(long %A) {
+       %c = getelementptr [0 x ubyte]* cast ([32832 x ubyte]*  %inbuf to [0 x ubyte]*), long 0, long %A
+       ret ubyte* %c
+}