1; RUN: opt < %s -aa-pipeline=basic-aa -passes=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 { ptr, ptr } 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, ptr, { ptr } } 16 %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, ptr, { ptr }, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, 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(ptr %tmp18169) { 24 %tmp18174 = getelementptr %struct.closure_type, ptr %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <ptr> [#uses=2] 25 %A = load i32, ptr %tmp18174 ; <i32> [#uses=1] 26 27 %tmp18272 = getelementptr %struct.STYLE, ptr %tmp18174, i32 0, i32 0, i32 0, i32 2 ; <ptr> [#uses=1] 28 store i16 123, ptr %tmp18272 29 30 %Q = load i32, ptr %tmp18174 ; <i32> [#uses=1] 31 %Z = sub i32 %A, %Q ; <i32> [#uses=1] 32 ret i32 %Z 33} 34