[opaque pointer type] Add textual IR support for explicit type parameter for global...
[oota-llvm.git] / test / Transforms / InstCombine / load.ll
index 3f8ed561e6fc70528e988c0e80e1b547f3a02517..2cc55e99fd20fdb20e72b1c0e2f6b9dd26e5948b 100644 (file)
@@ -16,7 +16,7 @@ target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
 ; CHECK-LABEL: @test1(
 ; CHECK-NOT: load
 define i32 @test1() {
-       %B = load i32* @X               ; <i32> [#uses=1]
+       %B = load i32, i32* @X          ; <i32> [#uses=1]
        ret i32 %B
 }
 
@@ -24,7 +24,7 @@ define i32 @test1() {
 ; CHECK-NOT: load
 define float @test2() {
        %A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1          ; <float*> [#uses=1]
-       %B = load float* %A             ; <float> [#uses=1]
+       %B = load float, float* %A              ; <float> [#uses=1]
        ret float %B
 }
 
@@ -32,7 +32,7 @@ define float @test2() {
 ; CHECK-NOT: load
 define i32 @test3() {
        %A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0          ; <i32*> [#uses=1]
-       %B = load i32* %A               ; <i32> [#uses=1]
+       %B = load i32, i32* %A          ; <i32> [#uses=1]
        ret i32 %B
 }
 
@@ -40,7 +40,7 @@ define i32 @test3() {
 ; CHECK-NOT: load
 define i32 @test4() {
        %A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0          ; <i32*> [#uses=1]
-       %B = load i32* %A               ; <i32> [#uses=1]
+       %B = load i32, i32* %A          ; <i32> [#uses=1]
        ret i32 %B
 }
 
@@ -48,7 +48,7 @@ define i32 @test4() {
 ; CHECK-NOT: load
 define i32 @test5(i1 %C) {
        %Y = select i1 %C, i32* @X, i32* @X2            ; <i32*> [#uses=1]
-       %Z = load i32* %Y               ; <i32> [#uses=1]
+       %Z = load i32, i32* %Y          ; <i32> [#uses=1]
        ret i32 %Z
 }
 
@@ -56,7 +56,7 @@ define i32 @test5(i1 %C) {
 ; CHECK-NOT: load
 define i32 @test7(i32 %X) {
        %V = getelementptr i32, i32* null, i32 %X               ; <i32*> [#uses=1]
-       %R = load i32* %V               ; <i32> [#uses=1]
+       %R = load i32, i32* %V          ; <i32> [#uses=1]
        ret i32 %R
 }
 
@@ -64,15 +64,15 @@ define i32 @test7(i32 %X) {
 ; CHECK-NOT: load
 define i32 @test8(i32* %P) {
        store i32 1, i32* %P
-       %X = load i32* %P               ; <i32> [#uses=1]
+       %X = load i32, i32* %P          ; <i32> [#uses=1]
        ret i32 %X
 }
 
 ; CHECK-LABEL: @test9(
 ; CHECK-NOT: load
 define i32 @test9(i32* %P) {
-       %X = load i32* %P               ; <i32> [#uses=1]
-       %Y = load i32* %P               ; <i32> [#uses=1]
+       %X = load i32, i32* %P          ; <i32> [#uses=1]
+       %Y = load i32, i32* %P          ; <i32> [#uses=1]
        %Z = sub i32 %X, %Y             ; <i32> [#uses=1]
        ret i32 %Z
 }
@@ -89,7 +89,7 @@ F:            ; preds = %0
        store i32 0, i32* %P
        br label %C
 C:             ; preds = %F, %T
-       %V = load i32* %P               ; <i32> [#uses=1]
+       %V = load i32, i32* %P          ; <i32> [#uses=1]
        ret i32 %V
 }
 
@@ -99,7 +99,7 @@ define double @test11(double* %p) {
   %t0 = getelementptr double, double* %p, i32 1
   store double 2.0, double* %t0
   %t1 = getelementptr double, double* %p, i32 1
-  %x = load double* %t1
+  %x = load double, double* %t1
   ret double %x
 }
 
@@ -110,14 +110,14 @@ define i32 @test12(i32* %P) {
   store i32 123, i32* %A
   ; Cast the result of the load not the source
   %Q = bitcast i32* %A to i32*
-  %V = load i32* %Q
+  %V = load i32, i32* %Q
   ret i32 %V
 }
 
 ; CHECK-LABEL: @test13(
 ; CHECK-NOT: load
 define <16 x i8> @test13(<2 x i64> %x) {
-  %tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*)
+  %tmp = load <16 x i8>, <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*)
   ret <16 x i8> %tmp
 }
 
@@ -128,13 +128,13 @@ define i8 @test14(i8 %x, i32 %y) {
 ; those confuse the analysis into thinking that the second store does not alias
 ; the first.
 ; CHECK-LABEL: @test14(
-; CHECK:         %[[R:.*]] = load i8*
+; CHECK:         %[[R:.*]] = load i8, i8*
 ; CHECK-NEXT:    ret i8 %[[R]]
   %a = alloca i32
   %a.i8 = bitcast i32* %a to i8*
   store i8 %x, i8* %a.i8
   store i32 %y, i32* %a
-  %r = load i8* %a.i8
+  %r = load i8, i8* %a.i8
   ret i8 %r
 }
 
@@ -143,12 +143,12 @@ define i8 @test14(i8 %x, i32 %y) {
 define i8 @test15(i8 %x, i32 %y) {
 ; Same test as @test14 essentially, but using a global instead of an alloca.
 ; CHECK-LABEL: @test15(
-; CHECK:         %[[R:.*]] = load i8*
+; CHECK:         %[[R:.*]] = load i8, i8*
 ; CHECK-NEXT:    ret i8 %[[R]]
   %g.i8 = bitcast i32* @test15_global to i8*
   store i8 %x, i8* %g.i8
   store i32 %y, i32* @test15_global
-  %r = load i8* %g.i8
+  %r = load i8, i8* %g.i8
   ret i8 %r
 }
 
@@ -156,12 +156,12 @@ define void @test16(i8* %x, i8* %a, i8* %b, i8* %c) {
 ; Check that we canonicalize loads which are only stored to use integer types
 ; when there is a valid integer type.
 ; CHECK-LABEL: @test16(
-; CHECK: %[[L1:.*]] = load i32*
+; CHECK: %[[L1:.*]] = load i32, i32*
 ; CHECK-NOT: load
 ; CHECK: store i32 %[[L1]], i32*
 ; CHECK: store i32 %[[L1]], i32*
 ; CHECK-NOT: store
-; CHECK: %[[L1:.*]] = load i32*
+; CHECK: %[[L1:.*]] = load i32, i32*
 ; CHECK-NOT: load
 ; CHECK: store i32 %[[L1]], i32*
 ; CHECK: store i32 %[[L1]], i32*
@@ -174,11 +174,11 @@ entry:
   %b.cast = bitcast i8* %b to float*
   %c.cast = bitcast i8* %c to i32*
 
-  %x1 = load float* %x.cast
+  %x1 = load float, float* %x.cast
   store float %x1, float* %a.cast
   store float %x1, float* %b.cast
 
-  %x2 = load float* %x.cast
+  %x2 = load float, float* %x.cast
   store float %x2, float* %b.cast
   %x2.cast = bitcast float %x2 to i32
   store i32 %x2.cast, i32* %c.cast
@@ -192,11 +192,11 @@ define void @test17(i8** %x, i8 %y) {
 ; than the value.
 ;
 ; CHECK-LABEL: @test17(
-; CHECK: %[[L:.*]] = load i8**
+; CHECK: %[[L:.*]] = load i8*, i8**
 ; CHECK: store i8 %y, i8* %[[L]]
 
 entry:
-  %x.load = load i8** %x
+  %x.load = load i8*, i8** %x
   store i8 %y, i8* %x.load
 
   ret void