1 ; RUN: opt -S -passes=instcombine %s -o - | FileCheck %s
3 %Complex = type { double, double }
5 ; Check that instcombine preserves TBAA when narrowing loads
6 define double @teststructextract(ptr %val) {
7 ; CHECK: load double, {{.*}}, !tbaa
8 ; CHECK-NOT: load %Complex
9 %loaded = load %Complex, ptr %val, !tbaa !1
10 %real = extractvalue %Complex %loaded, 0
14 define double @testarrayextract(ptr %val) {
15 ; CHECK: load double, {{.*}}, !tbaa
16 ; CHECK-NOT: load [2 x double]
17 %loaded = load [2 x double], ptr %val, !tbaa !1
18 %real = extractvalue [2 x double] %loaded, 0
22 ; Check that inscombine preserves TBAA when breaking up stores
23 define void @teststructinsert(ptr %loc, double %a, double %b) {
24 ; CHECK: store double %a, {{.*}}, !tbaa
25 ; CHECK: store double %b, {{.*}}, !tbaa
26 ; CHECK-NOT: store %Complex
27 %inserted = insertvalue %Complex undef, double %a, 0
28 %inserted2 = insertvalue %Complex %inserted, double %b, 1
29 store %Complex %inserted2, ptr %loc, !tbaa !1
33 define void @testarrayinsert(ptr %loc, double %a, double %b) {
34 ; CHECK: store double %a, {{.*}}, !tbaa
35 ; CHECK: store double %b, {{.*}}, !tbaa
36 ; CHECK-NOT: store [2 x double]
37 %inserted = insertvalue [2 x double] undef, double %a, 0
38 %inserted2 = insertvalue [2 x double] %inserted, double %b, 1
39 store [2 x double] %inserted2, ptr %loc, !tbaa !1
45 !2 = !{!"Complex", !0, i64 0}