summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2023-04-27 13:39:45 -0700
committerTom Stellard <tstellar@redhat.com>2023-05-01 21:09:21 -0700
commitec79a47304289d9e32022e5570fe6c7efa40c59b (patch)
treef7762b2adcfe7b3eac723bf98313941dd715c808
parentbd6783b380768bd35f37e0034dccf6c5736dd031 (diff)
downloadllvm-ec79a47304289d9e32022e5570fe6c7efa40c59b.tar.gz
[CodeGen] precommit machine-latecleanup test
Demonstrates a hazard in machine-latecleanup. Differential Revision: https://reviews.llvm.org/D149190 (cherry picked from commit 095a0c67bb5705b2ebd91ecc039e73bbd6982cee) [nd: remove isOutlined MIR key due to missing commit 267708f9d515 ("[MachineOutliner] Add IsOutlined to MachineFunction")]
-rw-r--r--llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir259
1 files changed, 259 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir b/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir
new file mode 100644
index 000000000000..af18e6de374a
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir
@@ -0,0 +1,259 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
+# RUN: llc -start-before=machine-latecleanup -stop-after=machine-latecleanup \
+# RUN: -o - %s | FileCheck %s
+--- |
+ ; ModuleID = 'reduced5.ll'
+ source_filename = "reduced5.ll"
+ target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+ target triple = "aarch64-unknown-linux-gnu"
+
+ ; Function Attrs: nounwind
+ define void @zot(ptr %arg, ptr %arg1, ptr %arg2, i64 %arg3, i1 %arg4, ptr %arg5) #0 {
+ bb:
+ %const = bitcast i64 29273397577910035 to i64
+ callbr void asm sideeffect "b $0", "!i"()
+ to label %bb9 [label %bb8]
+
+ bb8: ; preds = %bb
+ %const_mat = add i64 %const, 2048
+ br label %bb9
+
+ bb9: ; preds = %bb8, %bb
+ %phi = phi i64 [ %const_mat, %bb8 ], [ %const, %bb ]
+ store volatile i64 %phi, ptr null, align 8
+ br label %bb10
+
+ bb10: ; preds = %bb22, %bb9
+ %phi11 = phi i64 [ 0, %bb9 ], [ %or24, %bb22 ]
+ %phi12 = phi i64 [ 0, %bb9 ], [ %select, %bb22 ]
+ %load = load volatile i64, ptr %arg2, align 8
+ %select = select i1 %arg4, i64 %arg3, i64 0
+ store i64 %const, ptr %arg5, align 8
+ %call = call i64 %arg()
+ callbr void asm sideeffect "", "!i"()
+ to label %bb22 [label %bb22]
+
+ bb22: ; preds = %bb10, %bb10
+ store i64 0, ptr %arg1, align 8
+ store volatile i64 1, ptr null, align 8
+ %or = or i64 %phi11, 0
+ %or24 = or i64 %phi11, %phi12
+ br label %bb10
+ }
+
+ attributes #0 = { nounwind "frame-pointer"="non-leaf" }
+
+...
+---
+name: zot
+alignment: 4
+exposesReturnsTwice: false
+legalized: false
+regBankSelected: false
+selected: false
+failedISel: false
+tracksRegLiveness: true
+hasWinCFI: false
+callsEHReturn: false
+callsUnwindInit: false
+hasEHCatchret: false
+hasEHScopes: false
+hasEHFunclets: false
+debugInstrRef: false
+failsVerification: false
+tracksDebugUserValues: true
+registers: []
+liveins:
+ - { reg: '$x0', virtual-reg: '' }
+ - { reg: '$x1', virtual-reg: '' }
+ - { reg: '$x2', virtual-reg: '' }
+ - { reg: '$x3', virtual-reg: '' }
+ - { reg: '$w4', virtual-reg: '' }
+ - { reg: '$x5', virtual-reg: '' }
+frameInfo:
+ isFrameAddressTaken: false
+ isReturnAddressTaken: false
+ hasStackMap: false
+ hasPatchPoint: false
+ stackSize: 96
+ offsetAdjustment: 0
+ maxAlignment: 8
+ adjustsStack: true
+ hasCalls: true
+ stackProtector: ''
+ functionContext: ''
+ maxCallFrameSize: 0
+ cvBytesOfCalleeSavedRegisters: 0
+ hasOpaqueSPAdjustment: false
+ hasVAStart: false
+ hasMustTailInVarArgFunc: false
+ hasTailCall: false
+ localFrameSize: 0
+ savePoint: ''
+ restorePoint: ''
+fixedStack: []
+stack:
+ - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x19', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x20', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 2, name: '', type: spill-slot, offset: -24, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x21', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 3, name: '', type: spill-slot, offset: -32, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x22', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 4, name: '', type: spill-slot, offset: -40, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x23', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 5, name: '', type: spill-slot, offset: -48, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x24', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 6, name: '', type: spill-slot, offset: -56, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x25', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 7, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x26', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 8, name: '', type: spill-slot, offset: -72, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x27', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 9, name: '', type: spill-slot, offset: -80, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$x28', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 10, name: '', type: spill-slot, offset: -88, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 11, name: '', type: spill-slot, offset: -96, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '$fp', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+callSites: []
+debugValueSubstitutions: []
+constants: []
+machineFunctionInfo:
+ hasRedZone: false
+body: |
+ ; CHECK-LABEL: name: zot
+ ; CHECK: bb.0.bb:
+ ; CHECK-NEXT: successors: %bb.2(0x80000000), %bb.1(0x00000000)
+ ; CHECK-NEXT: liveins: $w4, $x0, $x1, $x2, $x3, $x5, $lr, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -12 :: (store (s64) into %stack.11), (store (s64) into %stack.10)
+ ; CHECK-NEXT: frame-setup STPXi killed $x28, killed $x27, $sp, 2 :: (store (s64) into %stack.9), (store (s64) into %stack.8)
+ ; CHECK-NEXT: frame-setup STPXi killed $x26, killed $x25, $sp, 4 :: (store (s64) into %stack.7), (store (s64) into %stack.6)
+ ; CHECK-NEXT: frame-setup STPXi killed $x24, killed $x23, $sp, 6 :: (store (s64) into %stack.5), (store (s64) into %stack.4)
+ ; CHECK-NEXT: frame-setup STPXi killed $x22, killed $x21, $sp, 8 :: (store (s64) into %stack.3), (store (s64) into %stack.2)
+ ; CHECK-NEXT: frame-setup STPXi killed $x20, killed $x19, $sp, 10 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
+ ; CHECK-NEXT: $fp = frame-setup ADDXri $sp, 0, 0
+ ; CHECK-NEXT: renamable $x19 = COPY $x5
+ ; CHECK-NEXT: renamable $w20 = COPY $w4
+ ; CHECK-NEXT: renamable $x21 = COPY $x3
+ ; CHECK-NEXT: renamable $x22 = COPY $x2
+ ; CHECK-NEXT: renamable $x23 = COPY $x1
+ ; CHECK-NEXT: renamable $x24 = COPY $x0
+ ; CHECK-NEXT: INLINEASM_BR &"b $0", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.1
+ ; CHECK-NEXT: renamable $x8 = MOVi64imm 29273397577910035
+ ; CHECK-NEXT: B %bb.2
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.1.bb8 (machine-block-address-taken, inlineasm-br-indirect-target):
+ ; CHECK-NEXT: successors: %bb.2(0x80000000)
+ ; CHECK-NEXT: liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x8
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: renamable $x8 = ADDXri killed renamable $x8, 2048, 0
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.2.bb9:
+ ; CHECK-NEXT: successors: %bb.3(0x80000000)
+ ; CHECK-NEXT: liveins: $w20, $x8, $x19, $x21, $x22, $x23, $x24
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: renamable $x25 = COPY $xzr
+ ; CHECK-NEXT: renamable $w27 = MOVi32imm 1, implicit-def $x27
+ ; CHECK-NEXT: renamable $x26 = COPY $xzr
+ ; CHECK-NEXT: STRXui killed renamable $x8, renamable $x25, 0 :: (volatile store (s64) into `ptr null`)
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.3.bb10:
+ ; CHECK-NEXT: successors: %bb.4(0x80000000)
+ ; CHECK-NEXT: liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: dead $wzr = ANDSWri renamable $w20, 0, implicit-def $nzcv
+ ; CHECK-NEXT: dead $xzr = LDRXui renamable $x22, 0 :: (volatile load (s64) from %ir.arg2)
+ ; CHECK-NEXT: renamable $x28 = CSELXr renamable $x21, $xzr, 1, implicit killed $nzcv
+ ; CHECK-NEXT: renamable $x8 = MOVi64imm 29273397577910035
+ ; CHECK-NEXT: STRXui killed renamable $x8, renamable $x19, 0 :: (store (s64) into %ir.arg5)
+ ; CHECK-NEXT: BLR renamable $x24, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
+ ; CHECK-NEXT: INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.4
+ ; CHECK-NEXT: B %bb.4
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.4.bb22 (machine-block-address-taken, inlineasm-br-indirect-target):
+ ; CHECK-NEXT: successors: %bb.3(0x80000000)
+ ; CHECK-NEXT: liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: renamable $x8 = COPY $xzr
+ ; CHECK-NEXT: renamable $x25 = ORRXrr killed renamable $x25, killed renamable $x26
+ ; CHECK-NEXT: renamable $x26 = COPY killed renamable $x28
+ ; CHECK-NEXT: STRXui $xzr, renamable $x23, 0 :: (store (s64) into %ir.arg1)
+ ; CHECK-NEXT: STRXui renamable $x27, killed renamable $x8, 0 :: (volatile store (s64) into `ptr null`)
+ ; CHECK-NEXT: B %bb.3
+ bb.0.bb:
+ successors: %bb.2(0x80000000), %bb.1(0x00000000)
+ liveins: $w4, $x0, $x1, $x2, $x3, $x5, $lr, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20
+
+ early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -12 :: (store (s64) into %stack.11), (store (s64) into %stack.10)
+ frame-setup STPXi killed $x28, killed $x27, $sp, 2 :: (store (s64) into %stack.9), (store (s64) into %stack.8)
+ frame-setup STPXi killed $x26, killed $x25, $sp, 4 :: (store (s64) into %stack.7), (store (s64) into %stack.6)
+ frame-setup STPXi killed $x24, killed $x23, $sp, 6 :: (store (s64) into %stack.5), (store (s64) into %stack.4)
+ frame-setup STPXi killed $x22, killed $x21, $sp, 8 :: (store (s64) into %stack.3), (store (s64) into %stack.2)
+ frame-setup STPXi killed $x20, killed $x19, $sp, 10 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
+ $fp = frame-setup ADDXri $sp, 0, 0
+ renamable $x19 = COPY $x5
+ renamable $w20 = COPY $w4
+ renamable $x21 = COPY $x3
+ renamable $x22 = COPY $x2
+ renamable $x23 = COPY $x1
+ renamable $x24 = COPY $x0
+ INLINEASM_BR &"b $0", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.1
+ renamable $x8 = MOVi64imm 29273397577910035
+ B %bb.2
+
+ bb.1.bb8 (machine-block-address-taken, inlineasm-br-indirect-target):
+ successors: %bb.2(0x80000000)
+ liveins: $w20, $x19, $x21, $x22, $x23, $x24
+
+ renamable $x8 = MOVi64imm 29273397577910035
+ renamable $x8 = ADDXri killed renamable $x8, 2048, 0
+
+ bb.2.bb9:
+ successors: %bb.3(0x80000000)
+ liveins: $w20, $x8, $x19, $x21, $x22, $x23, $x24
+
+ renamable $x25 = COPY $xzr
+ renamable $w27 = MOVi32imm 1, implicit-def $x27
+ renamable $x26 = COPY $xzr
+ STRXui killed renamable $x8, renamable $x25, 0 :: (volatile store (s64) into `ptr null`)
+
+ bb.3.bb10:
+ successors: %bb.4(0x80000000)
+ liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27
+
+ dead $wzr = ANDSWri renamable $w20, 0, implicit-def $nzcv
+ dead $xzr = LDRXui renamable $x22, 0 :: (volatile load (s64) from %ir.arg2)
+ renamable $x28 = CSELXr renamable $x21, $xzr, 1, implicit killed $nzcv
+ renamable $x8 = MOVi64imm 29273397577910035
+ STRXui killed renamable $x8, renamable $x19, 0 :: (store (s64) into %ir.arg5)
+ BLR renamable $x24, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $x0
+ INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.4
+ B %bb.4
+
+ bb.4.bb22 (machine-block-address-taken, inlineasm-br-indirect-target):
+ successors: %bb.3(0x80000000)
+ liveins: $w20, $x19, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
+
+ renamable $x8 = COPY $xzr
+ renamable $x25 = ORRXrr killed renamable $x25, killed renamable $x26
+ renamable $x26 = COPY killed renamable $x28
+ STRXui $xzr, renamable $x23, 0 :: (store (s64) into %ir.arg1)
+ STRXui renamable $x27, killed renamable $x8, 0 :: (volatile store (s64) into `ptr null`)
+ B %bb.3
+
+...