1; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s 2; PR1109 3 4target datalayout = "e-p:32:32" 5target triple = "i686-apple-darwin8" 6 %struct.CONSTRAINT = type { i32, i32, i32, i32 } 7 %struct.FILE_POS = type { i8, i8, i16, i32 } 8 %struct.FIRST_UNION = type { %struct.FILE_POS } 9 %struct.FOURTH_UNION = type { %struct.CONSTRAINT } 10 %struct.GAP = type { i8, i8, i16 } 11 %struct.LIST = type { %struct.rec*, %struct.rec* } 12 %struct.SECOND_UNION = type { { i16, i8, i8 } } 13 %struct.STYLE = type { { %struct.GAP }, { %struct.GAP }, i16, i16, i16, i8, i8 } 14 %struct.THIRD_UNION = type { { [2 x i32], [2 x i32] } } 15 %struct.closure_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* } } 16 %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* }, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, i32 } 17 %struct.rec = type { %struct.head_type } 18 19; CHECK: define i32 @test 20; CHECK: %Z = sub i32 %A, %Q 21; CHECK: ret i32 %Z 22 23define i32 @test(%struct.closure_type* %tmp18169) { 24 %tmp18174 = getelementptr %struct.closure_type, %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <i32*> [#uses=2] 25 %tmp18269 = bitcast i32* %tmp18174 to %struct.STYLE* ; <%struct.STYLE*> [#uses=1] 26 %A = load i32, i32* %tmp18174 ; <i32> [#uses=1] 27 28 %tmp18272 = getelementptr %struct.STYLE, %struct.STYLE* %tmp18269, i32 0, i32 0, i32 0, i32 2 ; <i16*> [#uses=1] 29 store i16 123, i16* %tmp18272 30 31 %Q = load i32, i32* %tmp18174 ; <i32> [#uses=1] 32 %Z = sub i32 %A, %Q ; <i32> [#uses=1] 33 ret i32 %Z 34} 35