Skip to content

Commit aba0b83

Browse files
Let's revert only the non-pauth-lr operations.
1 parent 6ee1738 commit aba0b83

File tree

3 files changed

+46
-40
lines changed

3 files changed

+46
-40
lines changed

llvm/lib/Target/AArch64/AArch64PointerAuth.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,23 @@ void AArch64PointerAuth::signLR(MachineFunction &MF,
131131
// No SEH opcode for this one; it doesn't materialize into an
132132
// instruction on Windows.
133133
if (MFnI.branchProtectionPAuthLR() && Subtarget->hasPAuthLR()) {
134+
emitPACCFI(MBB, MBBI, MachineInstr::FrameSetup, EmitCFI);
134135
BuildMI(MBB, MBBI, DL,
135136
TII->get(MFnI.shouldSignWithBKey() ? AArch64::PACIBSPPC
136137
: AArch64::PACIASPPC))
137138
.setMIFlag(MachineInstr::FrameSetup)
138139
->setPreInstrSymbol(MF, MFnI.getSigningInstrLabel());
139-
emitPACCFI(MBB, MBBI, MachineInstr::FrameSetup, EmitCFI);
140140
} else {
141141
BuildPACM(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameSetup);
142+
if(MFnI.branchProtectionPAuthLR())
143+
emitPACCFI(MBB, MBBI, MachineInstr::FrameSetup, EmitCFI);
142144
BuildMI(MBB, MBBI, DL,
143145
TII->get(MFnI.shouldSignWithBKey() ? AArch64::PACIBSP
144146
: AArch64::PACIASP))
145147
.setMIFlag(MachineInstr::FrameSetup)
146148
->setPreInstrSymbol(MF, MFnI.getSigningInstrLabel());
147-
emitPACCFI(MBB, MBBI, MachineInstr::FrameSetup, EmitCFI);
149+
if(!MFnI.branchProtectionPAuthLR())
150+
emitPACCFI(MBB, MBBI, MachineInstr::FrameSetup, EmitCFI);
148151
}
149152

150153
if (!EmitCFI && NeedsWinCFI) {
@@ -199,17 +202,20 @@ void AArch64PointerAuth::authenticateLR(
199202
if (MFnI->branchProtectionPAuthLR() && Subtarget->hasPAuthLR()) {
200203
assert(PACSym && "No PAC instruction to refer to");
201204
emitPACSymOffsetIntoX16(*TII, MBB, MBBI, DL, PACSym);
205+
emitPACCFI(MBB, MBBI, MachineInstr::FrameDestroy, EmitAsyncCFI);
202206
BuildMI(MBB, MBBI, DL,
203207
TII->get(UseBKey ? AArch64::AUTIBSPPCi : AArch64::AUTIASPPCi))
204208
.addSym(PACSym)
205209
.setMIFlag(MachineInstr::FrameDestroy);
206-
emitPACCFI(MBB, MBBI, MachineInstr::FrameDestroy, EmitAsyncCFI);
207210
} else {
208211
BuildPACM(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy, PACSym);
212+
if(MFnI->branchProtectionPAuthLR())
213+
emitPACCFI(MBB, MBBI, MachineInstr::FrameDestroy, EmitAsyncCFI);
209214
BuildMI(MBB, MBBI, DL,
210215
TII->get(UseBKey ? AArch64::AUTIBSP : AArch64::AUTIASP))
211216
.setMIFlag(MachineInstr::FrameDestroy);
212-
emitPACCFI(MBB, MBBI, MachineInstr::FrameDestroy, EmitAsyncCFI);
217+
if(!MFnI->branchProtectionPAuthLR())
218+
emitPACCFI(MBB, MBBI, MachineInstr::FrameDestroy, EmitAsyncCFI);
213219
}
214220

215221
if (NeedsWinCFI) {

0 commit comments

Comments
 (0)