205 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -run-pass=stack-coloring %s -o - | FileCheck %s3 4## %tmpcast is between 2 allocas. %ref.tmp will replaced by %tmp. Make sure5## that we reorder %tmp to be before the use in %tmpcast.6 7# CHECK: %a = alloca %struct.e, align 18# CHECK: %tmp = alloca %"struct.e::f", align 89# CHECK: %ref.tmp = alloca { <2 x float>, <2 x float> }, align 810# CHECK: %b = alloca %struct.j, align 411 12--- |13 source_filename = "<stdin>"14 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"15 target triple = "x86_64-apple-macosx10.15.0"16 17 %class.d = type { [4 x float] }18 %struct.e = type { i8 }19 %struct.j = type { i32 }20 %"struct.e::f" = type { [4 x ptr] }21 22 @i = local_unnamed_addr global %class.d zeroinitializer, align 823 24 ; Function Attrs: ssp uwtable25 define void @_Z1gv() local_unnamed_addr #0 {26 entry:27 %a = alloca %struct.e, align 128 %ref.tmp = alloca { <2 x float>, <2 x float> }, align 829 %b = alloca %struct.j, align 430 %tmp = alloca %"struct.e::f", align 831 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #332 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %ref.tmp) #333 %agg.tmp.sroa.0.0.copyload = load <2 x float>, ptr @i, align 8, !tbaa.struct !334 %agg.tmp.sroa.2.0.copyload = load <2 x float>, ptr getelementptr inbounds (%class.d, ptr @i, i64 0, i32 0, i64 2), align 8, !tbaa.struct !335 %call = tail call { <2 x float>, <2 x float> } @_Zng1d(<2 x float> %agg.tmp.sroa.0.0.copyload, <2 x float> %agg.tmp.sroa.2.0.copyload)36 %0 = extractvalue { <2 x float>, <2 x float> } %call, 037 store <2 x float> %0, ptr %ref.tmp, align 838 %1 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %ref.tmp, i64 0, i32 139 %2 = extractvalue { <2 x float>, <2 x float> } %call, 140 store <2 x float> %2, ptr %1, align 841 call void @_ZN1e1hERK1d(ptr nonnull %a, ptr nonnull dereferenceable(16) %ref.tmp)42 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %ref.tmp) #343 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #344 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %tmp) #345 call void @_ZN1j1kEv(ptr nonnull sret(%"struct.e::f") align 8 %tmp, ptr nonnull %b)46 call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %tmp) #347 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #348 call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #349 ret void50 }51 52 ; Function Attrs: argmemonly nounwind willreturn53 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #154 55 declare void @_ZN1e1hERK1d(ptr, ptr dereferenceable(16)) local_unnamed_addr #256 57 declare { <2 x float>, <2 x float> } @_Zng1d(<2 x float>, <2 x float>) local_unnamed_addr #258 59 ; Function Attrs: argmemonly nounwind willreturn60 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #161 62 declare void @_ZN1j1kEv(ptr sret(%"struct.e::f") align 8, ptr) local_unnamed_addr #263 64 ; Function Attrs: nounwind65 declare void @llvm.stackprotector(ptr, ptr) #366 67 attributes #0 = { ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="64" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "use-soft-float"="false" }68 attributes #1 = { argmemonly nounwind willreturn }69 attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "use-soft-float"="false" }70 attributes #3 = { nounwind }71 72 !llvm.module.flags = !{!0, !1}73 !llvm.ident = !{!2}74 75 !0 = !{i32 1, !"wchar_size", i32 4}76 !1 = !{i32 7, !"PIC Level", i32 2}77 !2 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 82093e8fb7d65486ff450d33bf386aabd0d194f7)"}78 !3 = !{i64 0, i64 16, !4}79 !4 = !{!5, !5, i64 0}80 !5 = !{!"omnipotent char", !6, i64 0}81 !6 = !{!"Simple C++ TBAA"}82 83...84---85name: _Z1gv86alignment: 1687exposesReturnsTwice: false88legalized: false89regBankSelected: false90selected: false91failedISel: false92tracksRegLiveness: true93hasWinCFI: false94registers:95 - { id: 0, class: vr128, preferred-register: '' }96 - { id: 1, class: vr128, preferred-register: '' }97 - { id: 2, class: vr128, preferred-register: '' }98 - { id: 3, class: vr128, preferred-register: '' }99 - { id: 4, class: gr64, preferred-register: '' }100 - { id: 5, class: gr64, preferred-register: '' }101 - { id: 6, class: gr64, preferred-register: '' }102 - { id: 7, class: gr64, preferred-register: '' }103liveins: []104frameInfo:105 isFrameAddressTaken: false106 isReturnAddressTaken: false107 hasStackMap: false108 hasPatchPoint: false109 stackSize: 0110 offsetAdjustment: 0111 maxAlignment: 8112 adjustsStack: false113 hasCalls: true114 stackProtector: ''115 maxCallFrameSize: 4294967295116 cvBytesOfCalleeSavedRegisters: 0117 hasOpaqueSPAdjustment: false118 hasVAStart: false119 hasMustTailInVarArgFunc: false120 localFrameSize: 0121 savePoint: []122 restorePoint: []123fixedStack: []124stack:125 - { id: 0, name: a, type: default, offset: 0, size: 1, alignment: 8,126 stack-id: default, callee-saved-register: '', callee-saved-restored: true,127 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }128 - { id: 1, name: ref.tmp, type: default, offset: 0, size: 16, alignment: 8,129 stack-id: default, callee-saved-register: '', callee-saved-restored: true,130 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }131 - { id: 2, name: b, type: default, offset: 0, size: 4, alignment: 8,132 stack-id: default, callee-saved-register: '', callee-saved-restored: true,133 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }134 - { id: 3, name: tmp, type: default, offset: 0, size: 32, alignment: 8,135 stack-id: default, callee-saved-register: '', callee-saved-restored: true,136 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }137callSites: []138constants: []139machineFunctionInfo: {}140body: |141 bb.0.entry:142 ; CHECK-LABEL: name: _Z1gv143 ; CHECK: [[MOVSDrm:%[0-9]+]]:vr128 = MOVSDrm $rip, 1, $noreg, @i, $noreg :: (dereferenceable load (s64) from @i)144 ; CHECK-NEXT: [[MOVSDrm1:%[0-9]+]]:vr128 = MOVSDrm $rip, 1, $noreg, @i + 8, $noreg :: (dereferenceable load (s64) from `ptr getelementptr inbounds (%class.d, ptr @i, i64 0, i32 0, i64 2)`)145 ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp146 ; CHECK-NEXT: $xmm0 = COPY [[MOVSDrm]]147 ; CHECK-NEXT: $xmm1 = COPY [[MOVSDrm1]]148 ; CHECK-NEXT: CALL64pcrel32 @_Zng1d, csr_64, implicit $rsp, implicit $ssp, implicit $xmm0, implicit $xmm1, implicit-def $rsp, implicit-def $ssp, implicit-def $xmm0, implicit-def $xmm1149 ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp150 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0151 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vr128 = COPY $xmm1152 ; CHECK-NEXT: MOVLPDmr %stack.3.tmp, 1, $noreg, 0, $noreg, [[COPY]] :: (store (s64) into %ir.tmp)153 ; CHECK-NEXT: MOVLPDmr %stack.3.tmp, 1, $noreg, 8, $noreg, [[COPY1]] :: (store (s64) into %ir.1)154 ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp155 ; CHECK-NEXT: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a, 1, $noreg, 0, $noreg156 ; CHECK-NEXT: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.3.tmp, 1, $noreg, 0, $noreg157 ; CHECK-NEXT: $rdi = COPY [[LEA64r]]158 ; CHECK-NEXT: $rsi = COPY [[LEA64r1]]159 ; CHECK-NEXT: CALL64pcrel32 @_ZN1e1hERK1d, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp160 ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp161 ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp162 ; CHECK-NEXT: [[LEA64r2:%[0-9]+]]:gr64 = LEA64r %stack.3.tmp, 1, $noreg, 0, $noreg163 ; CHECK-NEXT: [[LEA64r3:%[0-9]+]]:gr64 = LEA64r %stack.2.b, 1, $noreg, 0, $noreg164 ; CHECK-NEXT: $rdi = COPY [[LEA64r2]]165 ; CHECK-NEXT: $rsi = COPY [[LEA64r3]]166 ; CHECK-NEXT: CALL64pcrel32 @_ZN1j1kEv, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp167 ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp168 ; CHECK-NEXT: RET 0169 LIFETIME_START %stack.0.a170 LIFETIME_START %stack.1.ref.tmp171 %0:vr128 = MOVSDrm $rip, 1, $noreg, @i, $noreg :: (dereferenceable load (s64) from @i)172 %1:vr128 = MOVSDrm $rip, 1, $noreg, @i + 8, $noreg :: (dereferenceable load (s64) from `ptr getelementptr inbounds (%class.d, ptr @i, i64 0, i32 0, i64 2)`)173 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp174 $xmm0 = COPY %0175 $xmm1 = COPY %1176 CALL64pcrel32 @_Zng1d, csr_64, implicit $rsp, implicit $ssp, implicit $xmm0, implicit $xmm1, implicit-def $rsp, implicit-def $ssp, implicit-def $xmm0, implicit-def $xmm1177 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp178 %2:vr128 = COPY $xmm0179 %3:vr128 = COPY $xmm1180 MOVLPDmr %stack.1.ref.tmp, 1, $noreg, 0, $noreg, %2 :: (store (s64) into %ir.ref.tmp)181 MOVLPDmr %stack.1.ref.tmp, 1, $noreg, 8, $noreg, %3 :: (store (s64) into %ir.1)182 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp183 %4:gr64 = LEA64r %stack.0.a, 1, $noreg, 0, $noreg184 %5:gr64 = LEA64r %stack.1.ref.tmp, 1, $noreg, 0, $noreg185 $rdi = COPY %4186 $rsi = COPY %5187 CALL64pcrel32 @_ZN1e1hERK1d, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp188 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp189 LIFETIME_END %stack.1.ref.tmp190 LIFETIME_START %stack.2.b191 LIFETIME_START %stack.3.tmp192 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp193 %6:gr64 = LEA64r %stack.3.tmp, 1, $noreg, 0, $noreg194 %7:gr64 = LEA64r %stack.2.b, 1, $noreg, 0, $noreg195 $rdi = COPY %6196 $rsi = COPY %7197 CALL64pcrel32 @_ZN1j1kEv, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp198 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp199 LIFETIME_END %stack.3.tmp200 LIFETIME_END %stack.2.b201 LIFETIME_END %stack.0.a202 RET 0203 204...205