Skip to content

Commit 7c96f61

Browse files
committed
[X86][KCFI] Don't fold loads into indirect calls that need a KCFI check
Avoid unnecessary folding as X86KCFIPass would have to unfold these anyway when emitting the KCFI_CHECK.
1 parent c346cc3 commit 7c96f61

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,6 +6135,11 @@ MachineInstr *X86InstrInfo::foldMemoryOperandImpl(
61356135
MI.getOpcode() != X86::ADD64rr)
61366136
return nullptr;
61376137

6138+
// Don't fold loads into indirect calls that need a KCFI check as we'll
6139+
// have to unfold these in X86KCFIPass anyway.
6140+
if (MI.isCall() && MI.getCFIType())
6141+
return nullptr;
6142+
61386143
MachineInstr *NewMI = nullptr;
61396144

61406145
// Attempt to fold any custom cases we have.

0 commit comments

Comments
 (0)