Skip to content

[MachineOutliner] Preserve instruction bundles #106402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions llvm/lib/CodeGen/MachineOutliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,9 @@ MachineFunction *MachineOutliner::createOutlinedFunction(
BuildMI(MBB, MBB.end(), DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(MF.addFrameInst(CFI));
} else {
MachineInstr *NewMI = MF.CloneMachineInstr(&MI);
NewMI->dropMemRefs(MF);
NewMI->setDebugLoc(DL);
MBB.insert(MBB.end(), NewMI);
MachineInstr &NewMI = TII.duplicate(MBB, MBB.end(), MI);
NewMI.dropMemRefs(MF);
NewMI.setDebugLoc(DL);
}
}

Expand Down
54 changes: 54 additions & 0 deletions llvm/test/CodeGen/AArch64/machine-outliner-bundle.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# RUN: llc -mtriple=aarch64 -run-pass=machine-outliner \
# RUN: -verify-machineinstrs %s -o - | FileCheck %s

# CHECK: name: OUTLINED_FUNCTION_0
# CHECK-NOT: name:
# CHECK: BUNDLE implicit-def $z3, implicit-def $q3, implicit-def $d3, implicit-def $s3, implicit-def $h3, implicit-def $b3, implicit $z19, implicit $p0, implicit $z16 {
# CHECK: $z3 = MOVPRFX_ZZ $z19
# CHECK: $z3 = FMUL_ZPmZ_S renamable $p0, killed $z3, renamable $z16
# CHECK: }

---
name: bundled
alignment: 4
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo:
hasRedZone: false
body: |
bb.0.entry:
liveins: $z3, $z19, $p0, $z16
renamable $q0 = LDRQui $sp, 1 :: (load 16)
STRSui renamable $s0, $sp, 9, implicit killed $q0 :: (store (s32))
BUNDLE implicit-def $z3, implicit-def $q3, implicit-def $d3, implicit-def $s3, implicit-def $h3, implicit-def $b3, implicit $z19, implicit $p0, implicit $z16 {
$z3 = MOVPRFX_ZZ $z19
$z3 = FMUL_ZPmZ_S renamable $p0, killed $z3, renamable $z16
}
renamable $q0 = LDRQui $sp, 0 :: (load 16, align 32)
STRSui renamable $s0, $sp, 10, implicit killed $q0 :: (store (s32))
RET undef $lr
...
---
name: bundled_clone
alignment: 4
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo:
hasRedZone: false
body: |
bb.0.entry:
liveins: $z3, $z19, $p0, $z16
renamable $q0 = LDRQui $sp, 1 :: (load 16)
STRSui renamable $s0, $sp, 9, implicit killed $q0 :: (store (s32))
BUNDLE implicit-def $z3, implicit-def $q3, implicit-def $d3, implicit-def $s3, implicit-def $h3, implicit-def $b3, implicit $z19, implicit $p0, implicit $z16 {
$z3 = MOVPRFX_ZZ $z19
$z3 = FMUL_ZPmZ_S renamable $p0, killed $z3, renamable $z16
}
renamable $q0 = LDRQui $sp, 0 :: (load 16, align 32)
STRSui renamable $s0, $sp, 10, implicit killed $q0 :: (store (s32))
RET undef $lr
...
Loading