1; RUN: opt -S -instcombine %s -o - | FileCheck %s 2 3%Complex = type { double, double } 4 5; Check that instcombine preserves TBAA when narrowing loads 6define double @teststructextract(%Complex *%val) { 7; CHECK: load double, {{.*}}, !tbaa 8; CHECK-NOT: load %Complex 9 %loaded = load %Complex, %Complex *%val, !tbaa !1 10 %real = extractvalue %Complex %loaded, 0 11 ret double %real 12} 13 14define double @testarrayextract([2 x double] *%val) { 15; CHECK: load double, {{.*}}, !tbaa 16; CHECK-NOT: load [2 x double] 17 %loaded = load [2 x double], [2 x double] *%val, !tbaa !1 18 %real = extractvalue [2 x double] %loaded, 0 19 ret double %real 20} 21 22; Check that inscombine preserves TBAA when breaking up stores 23define void @teststructinsert(%Complex *%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, %Complex *%loc, !tbaa !1 30 ret void 31} 32 33define void @testarrayinsert([2 x double] *%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, [2 x double] *%loc, !tbaa !1 40 ret void 41} 42 43!0 = !{!"tbaa_root"} 44!1 = !{!2, !2, i64 0} 45!2 = !{!"Complex", !0, i64 0} 46