A strange testing case of SROA

Shuxin Yang shuxin.llvm at gmail.com
Fri Apr 5 11:57:21 PDT 2013


Hi,

    Following is excerpted from dynamic-vector-gep.ll.
The resulting "extractelement" seems to always return 0.0f regardless 
the value idx1 and idx2 is holding.
Am I missing something here or there is something fishy take place?

Thanks
Shuxin


101 ; CHECK: test6
102 ; CHECK: insertelement <4 x float> zeroinitializer, float 
1.000000e+00, i32 %idx1
103 ; CHECK: extractelement <4 x float> zeroinitializer, i32 %idx2
104
105 %vector.pair = type { %vector.anon, %vector.anon }
106 %vector.anon = type { %vector }
107 %vector = type { <4 x float> }
108
109 ; Dynamic GEPs on vectors were crashing when the vector was inside a 
struct
110 ; as the new GEP for the new alloca might not include all the 
indices from
111 ; the original GEP, just the indices it needs to get to the correct 
offset of
112 ; some type, not necessarily the dynamic vector.
113 ; This test makes sure we don't have this crash.
114 define float @test6(i32 %idx1, i32 %idx2) {
115 entry:
116   %0 = alloca %vector.pair
117   store %vector.pair zeroinitializer, %vector.pair* %0
118   %ptr1 = getelementptr %vector.pair* %0, i32 0, i32 0, i32 0, i32 
0, i32 %idx1
119   store float 1.0, float* %ptr1
120   %ptr2 = getelementptr %vector.pair* %0, i32 0, i32 1, i32 0, i32 
0, i32 %idx2
121   %ret = load float* %ptr2
122   ret float %ret
123 }




More information about the llvm-commits mailing list