Home | History | Annotate | Download | only in SCCP
      1 ; This test makes sure that these instructions are properly constant propagated.
      2 
      3 ; RUN: opt < %s -default-data-layout="e-p:32:32" -sccp -S | FileCheck %s
      4 ; RUN: opt < %s -default-data-layout="E-p:32:32" -sccp -S | FileCheck %s
      5 
      6 ; CHECK-NOT: load
      7 
      8 
      9 @X = constant i32 42		; <i32*> [#uses=1]
     10 @Y = constant [2 x { i32, float }] [ { i32, float } { i32 12, float 1.000000e+00 }, { i32, float } { i32 37, float 0x3FF3B2FEC0000000 } ]		; <[2 x { i32, float }]*> [#uses=2]
     11 
     12 define i32 @test1() {
     13 	%B = load i32, i32* @X		; <i32> [#uses=1]
     14 	ret i32 %B
     15 }
     16 
     17 define float @test2() {
     18 	%A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1		; <float*> [#uses=1]
     19 	%B = load float, float* %A		; <float> [#uses=1]
     20 	ret float %B
     21 }
     22 
     23 define i32 @test3() {
     24 	%A = getelementptr [2 x { i32, float }], [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0		; <i32*> [#uses=1]
     25 	%B = load i32, i32* %A
     26 	ret i32 %B
     27 }
     28 
     29 define i8 @test4() {
     30 	%A = bitcast i32* @X to i8*
     31 	%B = load i8, i8* %A
     32 	ret i8 %B
     33 }
     34 
     35