1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -instcombine %s -o - | FileCheck %s 2*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-p4:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker@g = addrspace(3) global i32 89 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker@const_zero_i8_as1 = addrspace(1) constant i8 0 7*9880d681SAndroid Build Coastguard Worker@const_zero_i32_as1 = addrspace(1) constant i32 0 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker@const_zero_i8_as2 = addrspace(2) constant i8 0 10*9880d681SAndroid Build Coastguard Worker@const_zero_i32_as2 = addrspace(2) constant i32 0 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Worker@const_zero_i8_as3 = addrspace(3) constant i8 0 13*9880d681SAndroid Build Coastguard Worker@const_zero_i32_as3 = addrspace(3) constant i32 0 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker; Test constant folding of inttoptr (ptrtoint constantexpr) 16*9880d681SAndroid Build Coastguard Worker; The intermediate integer size is the same as the pointer size 17*9880d681SAndroid Build Coastguard Workerdefine i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_same_size() { 18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_same_size( 19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 addrspace(3)* @const_zero_i32_as3 20*9880d681SAndroid Build Coastguard Worker %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i32 21*9880d681SAndroid Build Coastguard Worker %y = inttoptr i32 %x to i32 addrspace(3)* 22*9880d681SAndroid Build Coastguard Worker ret i32 addrspace(3)* %y 23*9880d681SAndroid Build Coastguard Worker} 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; The intermediate integer size is larger than the pointer size 26*9880d681SAndroid Build Coastguard Workerdefine i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller() { 27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller( 28*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 addrspace(2)* @const_zero_i32_as2 29*9880d681SAndroid Build Coastguard Worker %x = ptrtoint i32 addrspace(2)* @const_zero_i32_as2 to i16 30*9880d681SAndroid Build Coastguard Worker %y = inttoptr i16 %x to i32 addrspace(2)* 31*9880d681SAndroid Build Coastguard Worker ret i32 addrspace(2)* %y 32*9880d681SAndroid Build Coastguard Worker} 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Worker; Different address spaces that are the same size, but they are 35*9880d681SAndroid Build Coastguard Worker; different so nothing should happen 36*9880d681SAndroid Build Coastguard Workerdefine i32 addrspace(4)* @test_constant_fold_inttoptr_as_pointer_smaller_different_as() { 37*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_as( 38*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 addrspace(4)* inttoptr (i16 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i16) to i32 addrspace(4)*) 39*9880d681SAndroid Build Coastguard Worker %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i16 40*9880d681SAndroid Build Coastguard Worker %y = inttoptr i16 %x to i32 addrspace(4)* 41*9880d681SAndroid Build Coastguard Worker ret i32 addrspace(4)* %y 42*9880d681SAndroid Build Coastguard Worker} 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker; Make sure we don't introduce a bitcast between different sized 45*9880d681SAndroid Build Coastguard Worker; address spaces when folding this 46*9880d681SAndroid Build Coastguard Workerdefine i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller_different_size_as() { 47*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_size_as( 48*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 addrspace(2)* inttoptr (i32 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i32) to i32 addrspace(2)*) 49*9880d681SAndroid Build Coastguard Worker %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i32 50*9880d681SAndroid Build Coastguard Worker %y = inttoptr i32 %x to i32 addrspace(2)* 51*9880d681SAndroid Build Coastguard Worker ret i32 addrspace(2)* %y 52*9880d681SAndroid Build Coastguard Worker} 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker; The intermediate integer size is too small, nothing should happen 55*9880d681SAndroid Build Coastguard Workerdefine i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_larger() { 56*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_larger( 57*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i8 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i8) to i32 addrspace(3)*) 58*9880d681SAndroid Build Coastguard Worker %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i8 59*9880d681SAndroid Build Coastguard Worker %y = inttoptr i8 %x to i32 addrspace(3)* 60*9880d681SAndroid Build Coastguard Worker ret i32 addrspace(3)* %y 61*9880d681SAndroid Build Coastguard Worker} 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Workerdefine i8 @const_fold_ptrtoint() { 64*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @const_fold_ptrtoint( 65*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i8 4 66*9880d681SAndroid Build Coastguard Worker ret i8 ptrtoint (i32 addrspace(2)* inttoptr (i4 4 to i32 addrspace(2)*) to i8) 67*9880d681SAndroid Build Coastguard Worker} 68*9880d681SAndroid Build Coastguard Worker 69*9880d681SAndroid Build Coastguard Worker; Test that mask happens when the destination pointer is smaller than 70*9880d681SAndroid Build Coastguard Worker; the original 71*9880d681SAndroid Build Coastguard Workerdefine i8 @const_fold_ptrtoint_mask() { 72*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @const_fold_ptrtoint_mask( 73*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i8 1 74*9880d681SAndroid Build Coastguard Worker ret i8 ptrtoint (i32 addrspace(3)* inttoptr (i32 257 to i32 addrspace(3)*) to i8) 75*9880d681SAndroid Build Coastguard Worker} 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker; Address space 0 is too small for the correct mask, should mask with 78*9880d681SAndroid Build Coastguard Worker; 64-bits instead of 32 79*9880d681SAndroid Build Coastguard Workerdefine i64 @const_fold_ptrtoint_mask_small_as0() { 80*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @const_fold_ptrtoint_mask_small_as0( 81*9880d681SAndroid Build Coastguard Worker; CHECK: ret i64 -1 82*9880d681SAndroid Build Coastguard Worker ret i64 ptrtoint (i32 addrspace(1)* inttoptr (i128 -1 to i32 addrspace(1)*) to i64) 83*9880d681SAndroid Build Coastguard Worker} 84*9880d681SAndroid Build Coastguard Worker 85*9880d681SAndroid Build Coastguard Workerdefine i32 addrspace(3)* @const_inttoptr() { 86*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @const_inttoptr( 87*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i16 4 to i32 addrspace(3)*) 88*9880d681SAndroid Build Coastguard Worker %p = inttoptr i16 4 to i32 addrspace(3)* 89*9880d681SAndroid Build Coastguard Worker ret i32 addrspace(3)* %p 90*9880d681SAndroid Build Coastguard Worker} 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Workerdefine i16 @const_ptrtoint() { 93*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @const_ptrtoint( 94*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i16 ptrtoint (i32 addrspace(3)* @g to i16) 95*9880d681SAndroid Build Coastguard Worker %i = ptrtoint i32 addrspace(3)* @g to i16 96*9880d681SAndroid Build Coastguard Worker ret i16 %i 97*9880d681SAndroid Build Coastguard Worker} 98*9880d681SAndroid Build Coastguard Worker 99*9880d681SAndroid Build Coastguard Workerdefine i16 @const_inttoptr_ptrtoint() { 100*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @const_inttoptr_ptrtoint( 101*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i16 9 102*9880d681SAndroid Build Coastguard Worker ret i16 ptrtoint (i32 addrspace(3)* inttoptr (i16 9 to i32 addrspace(3)*) to i16) 103*9880d681SAndroid Build Coastguard Worker} 104*9880d681SAndroid Build Coastguard Worker 105*9880d681SAndroid Build Coastguard Workerdefine i1 @constant_fold_cmp_constantexpr_inttoptr() { 106*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_cmp_constantexpr_inttoptr( 107*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i1 true 108*9880d681SAndroid Build Coastguard Worker %x = icmp eq i32 addrspace(3)* inttoptr (i16 0 to i32 addrspace(3)*), null 109*9880d681SAndroid Build Coastguard Worker ret i1 %x 110*9880d681SAndroid Build Coastguard Worker} 111*9880d681SAndroid Build Coastguard Worker 112*9880d681SAndroid Build Coastguard Workerdefine i1 @constant_fold_inttoptr_null(i16 %i) { 113*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_inttoptr_null( 114*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i1 false 115*9880d681SAndroid Build Coastguard Worker %x = icmp eq i32 addrspace(3)* inttoptr (i16 99 to i32 addrspace(3)*), inttoptr (i16 0 to i32 addrspace(3)*) 116*9880d681SAndroid Build Coastguard Worker ret i1 %x 117*9880d681SAndroid Build Coastguard Worker} 118*9880d681SAndroid Build Coastguard Worker 119*9880d681SAndroid Build Coastguard Workerdefine i1 @constant_fold_ptrtoint_null() { 120*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_ptrtoint_null( 121*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i1 false 122*9880d681SAndroid Build Coastguard Worker %x = icmp eq i16 ptrtoint (i32 addrspace(3)* @g to i16), ptrtoint (i32 addrspace(3)* null to i16) 123*9880d681SAndroid Build Coastguard Worker ret i1 %x 124*9880d681SAndroid Build Coastguard Worker} 125*9880d681SAndroid Build Coastguard Worker 126*9880d681SAndroid Build Coastguard Workerdefine i1 @constant_fold_ptrtoint_null_2() { 127*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_ptrtoint_null_2( 128*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i1 false 129*9880d681SAndroid Build Coastguard Worker %x = icmp eq i16 ptrtoint (i32 addrspace(3)* null to i16), ptrtoint (i32 addrspace(3)* @g to i16) 130*9880d681SAndroid Build Coastguard Worker ret i1 %x 131*9880d681SAndroid Build Coastguard Worker} 132*9880d681SAndroid Build Coastguard Worker 133*9880d681SAndroid Build Coastguard Workerdefine i1 @constant_fold_ptrtoint() { 134*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_ptrtoint( 135*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i1 true 136*9880d681SAndroid Build Coastguard Worker %x = icmp eq i16 ptrtoint (i32 addrspace(3)* @g to i16), ptrtoint (i32 addrspace(3)* @g to i16) 137*9880d681SAndroid Build Coastguard Worker ret i1 %x 138*9880d681SAndroid Build Coastguard Worker} 139*9880d681SAndroid Build Coastguard Worker 140*9880d681SAndroid Build Coastguard Workerdefine i1 @constant_fold_inttoptr() { 141*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_inttoptr( 142*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i1 false 143*9880d681SAndroid Build Coastguard Worker %x = icmp eq i32 addrspace(3)* inttoptr (i16 99 to i32 addrspace(3)*), inttoptr (i16 27 to i32 addrspace(3)*) 144*9880d681SAndroid Build Coastguard Worker ret i1 %x 145*9880d681SAndroid Build Coastguard Worker} 146*9880d681SAndroid Build Coastguard Worker 147*9880d681SAndroid Build Coastguard Worker@g_float_as3 = addrspace(3) global float zeroinitializer 148*9880d681SAndroid Build Coastguard Worker@g_v4f_as3 = addrspace(3) global <4 x float> zeroinitializer 149*9880d681SAndroid Build Coastguard Worker 150*9880d681SAndroid Build Coastguard Workerdefine float @constant_fold_bitcast_ftoi_load() { 151*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_bitcast_ftoi_load( 152*9880d681SAndroid Build Coastguard Worker; CHECK: load float, float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4 153*9880d681SAndroid Build Coastguard Worker %a = load float, float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4 154*9880d681SAndroid Build Coastguard Worker ret float %a 155*9880d681SAndroid Build Coastguard Worker} 156*9880d681SAndroid Build Coastguard Worker 157*9880d681SAndroid Build Coastguard Workerdefine i32 @constant_fold_bitcast_itof_load() { 158*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_bitcast_itof_load( 159*9880d681SAndroid Build Coastguard Worker; CHECK: load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4 160*9880d681SAndroid Build Coastguard Worker %a = load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4 161*9880d681SAndroid Build Coastguard Worker ret i32 %a 162*9880d681SAndroid Build Coastguard Worker} 163*9880d681SAndroid Build Coastguard Worker 164*9880d681SAndroid Build Coastguard Workerdefine <4 x float> @constant_fold_bitcast_vector_as() { 165*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_fold_bitcast_vector_as( 166*9880d681SAndroid Build Coastguard Worker; CHECK: load <4 x float>, <4 x float> addrspace(3)* @g_v4f_as3, align 16 167*9880d681SAndroid Build Coastguard Worker %a = load <4 x float>, <4 x float> addrspace(3)* bitcast (<4 x i32> addrspace(3)* bitcast (<4 x float> addrspace(3)* @g_v4f_as3 to <4 x i32> addrspace(3)*) to <4 x float> addrspace(3)*), align 4 168*9880d681SAndroid Build Coastguard Worker ret <4 x float> %a 169*9880d681SAndroid Build Coastguard Worker} 170*9880d681SAndroid Build Coastguard Worker 171*9880d681SAndroid Build Coastguard Worker@i32_array_as3 = addrspace(3) global [10 x i32] zeroinitializer 172*9880d681SAndroid Build Coastguard Worker 173*9880d681SAndroid Build Coastguard Workerdefine i32 @test_cast_gep_small_indices_as() { 174*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_cast_gep_small_indices_as( 175*9880d681SAndroid Build Coastguard Worker; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16 176*9880d681SAndroid Build Coastguard Worker %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i7 0, i7 0 177*9880d681SAndroid Build Coastguard Worker %x = load i32, i32 addrspace(3)* %p, align 4 178*9880d681SAndroid Build Coastguard Worker ret i32 %x 179*9880d681SAndroid Build Coastguard Worker} 180*9880d681SAndroid Build Coastguard Worker 181*9880d681SAndroid Build Coastguard Worker%struct.foo = type { float, float, [4 x i32], i32 addrspace(3)* } 182*9880d681SAndroid Build Coastguard Worker 183*9880d681SAndroid Build Coastguard Worker@constant_fold_global_ptr = addrspace(3) global %struct.foo { 184*9880d681SAndroid Build Coastguard Worker float 0.0, 185*9880d681SAndroid Build Coastguard Worker float 0.0, 186*9880d681SAndroid Build Coastguard Worker [4 x i32] zeroinitializer, 187*9880d681SAndroid Build Coastguard Worker i32 addrspace(3)* getelementptr ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0) 188*9880d681SAndroid Build Coastguard Worker} 189*9880d681SAndroid Build Coastguard Worker 190*9880d681SAndroid Build Coastguard Workerdefine i32 @test_cast_gep_large_indices_as() { 191*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_cast_gep_large_indices_as( 192*9880d681SAndroid Build Coastguard Worker; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16 193*9880d681SAndroid Build Coastguard Worker %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0 194*9880d681SAndroid Build Coastguard Worker %x = load i32, i32 addrspace(3)* %p, align 4 195*9880d681SAndroid Build Coastguard Worker ret i32 %x 196*9880d681SAndroid Build Coastguard Worker} 197*9880d681SAndroid Build Coastguard Worker 198*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_cast_gep_struct_indices_as() { 199*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_cast_gep_struct_indices_as( 200*9880d681SAndroid Build Coastguard Worker; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds (%struct.foo, %struct.foo addrspace(3)* @constant_fold_global_ptr, i16 0, i32 2, i16 2), align 8 201*9880d681SAndroid Build Coastguard Worker %x = getelementptr %struct.foo, %struct.foo addrspace(3)* @constant_fold_global_ptr, i18 0, i32 2, i12 2 202*9880d681SAndroid Build Coastguard Worker %y = load i32, i32 addrspace(3)* %x, align 4 203*9880d681SAndroid Build Coastguard Worker ret i32 %y 204*9880d681SAndroid Build Coastguard Worker} 205*9880d681SAndroid Build Coastguard Worker 206*9880d681SAndroid Build Coastguard Worker@constant_data_as3 = addrspace(3) constant [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5] 207*9880d681SAndroid Build Coastguard Worker 208*9880d681SAndroid Build Coastguard Workerdefine i32 @test_read_data_from_global_as3() { 209*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_read_data_from_global_as3( 210*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 2 211*9880d681SAndroid Build Coastguard Worker %x = getelementptr [5 x i32], [5 x i32] addrspace(3)* @constant_data_as3, i32 0, i32 1 212*9880d681SAndroid Build Coastguard Worker %y = load i32, i32 addrspace(3)* %x, align 4 213*9880d681SAndroid Build Coastguard Worker ret i32 %y 214*9880d681SAndroid Build Coastguard Worker} 215*9880d681SAndroid Build Coastguard Worker 216*9880d681SAndroid Build Coastguard Worker@a = addrspace(1) constant i32 9 217*9880d681SAndroid Build Coastguard Worker@b = addrspace(1) constant i32 23 218*9880d681SAndroid Build Coastguard Worker@c = addrspace(1) constant i32 34 219*9880d681SAndroid Build Coastguard Worker@d = addrspace(1) constant i32 99 220*9880d681SAndroid Build Coastguard Worker 221*9880d681SAndroid Build Coastguard Worker@ptr_array = addrspace(2) constant [4 x i32 addrspace(1)*] [ i32 addrspace(1)* @a, i32 addrspace(1)* @b, i32 addrspace(1)* @c, i32 addrspace(1)* @d] 222*9880d681SAndroid Build Coastguard Worker@indirect = addrspace(0) constant i32 addrspace(1)* addrspace(2)* getelementptr inbounds ([4 x i32 addrspace(1)*], [4 x i32 addrspace(1)*] addrspace(2)* @ptr_array, i1 0, i32 2) 223*9880d681SAndroid Build Coastguard Worker 224*9880d681SAndroid Build Coastguard Workerdefine i32 @constant_through_array_as_ptrs() { 225*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @constant_through_array_as_ptrs( 226*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 34 227*9880d681SAndroid Build Coastguard Worker %p = load i32 addrspace(1)* addrspace(2)*, i32 addrspace(1)* addrspace(2)* addrspace(0)* @indirect, align 4 228*9880d681SAndroid Build Coastguard Worker %a = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(2)* %p, align 4 229*9880d681SAndroid Build Coastguard Worker %b = load i32, i32 addrspace(1)* %a, align 4 230*9880d681SAndroid Build Coastguard Worker ret i32 %b 231*9880d681SAndroid Build Coastguard Worker} 232*9880d681SAndroid Build Coastguard Worker 233*9880d681SAndroid Build Coastguard Worker@shared_mem = external addrspace(3) global [0 x i8] 234*9880d681SAndroid Build Coastguard Worker 235*9880d681SAndroid Build Coastguard Workerdefine float @canonicalize_addrspacecast(i32 %i) { 236*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @canonicalize_addrspacecast 237*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: getelementptr inbounds float, float* addrspacecast (float addrspace(3)* bitcast ([0 x i8] addrspace(3)* @shared_mem to float addrspace(3)*) to float*), i32 %i 238*9880d681SAndroid Build Coastguard Worker %p = getelementptr inbounds float, float* addrspacecast ([0 x i8] addrspace(3)* @shared_mem to float*), i32 %i 239*9880d681SAndroid Build Coastguard Worker %v = load float, float* %p 240*9880d681SAndroid Build Coastguard Worker ret float %v 241*9880d681SAndroid Build Coastguard Worker} 242