Skip to content

Commit 955417a

Browse files
committed
Revert "[llvm][AArch64] Copy all operands when expanding BLR_BTI bundle (#78267)"
This reverts commit 228aecb. Failing expensive checks: https://lab.llvm.org/buildbot/#/builders/16/builds/59798
1 parent 879cbe0 commit 955417a

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,11 +842,9 @@ bool AArch64ExpandPseudo::expandCALL_BTI(MachineBasicBlock &MBB,
842842
unsigned Opc = CallTarget.isGlobal() ? AArch64::BL : AArch64::BLR;
843843
MachineInstr *Call =
844844
BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc)).getInstr();
845-
846-
for (const MachineOperand &MO : MI.operands())
847-
Call->addOperand(MO);
848-
845+
Call->addOperand(CallTarget);
849846
Call->setCFIType(*MBB.getParent(), MI.getCFIType());
847+
Call->copyImplicitOps(*MBB.getParent(), MI);
850848

851849
MachineInstr *BTI =
852850
BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(AArch64::HINT))

llvm/test/CodeGen/AArch64/blr-bti-preserves-operands.mir

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass=aarch64-expand-pseudo -o - %s | FileCheck %s
2+
3+
# When expanding a BLR_BTI, we should keep the regmask that was attached to it.
4+
# Otherwise we could end up using a register after the BL which was clobbered by
5+
# the function that was called.
6+
# CHECK: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit $sp {
7+
# CHECK: BL @_setjmp, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def dead $lr, implicit $sp, implicit-def $sp
8+
# CHECK: HINT 36
9+
# CHECK: }
10+
11+
--- |
12+
define void @a() {
13+
ret void
14+
}
15+
16+
declare void @_setjmp(...)
17+
...
18+
---
19+
name: a
20+
body: |
21+
bb.0:
22+
BLR_BTI @_setjmp, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
23+
...

0 commit comments

Comments
 (0)