[llvm] 7c96f61 - [X86][KCFI] Don't fold loads into indirect calls that need a KCFI check
Sami Tolvanen via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 18 13:55:48 PST 2022
Author: Sami Tolvanen
Date: 2022-11-18T21:55:41Z
New Revision: 7c96f61aaa4c8297e5cd1b96c6985f491e5f034f
URL: https://github.com/llvm/llvm-project/commit/7c96f61aaa4c8297e5cd1b96c6985f491e5f034f
DIFF: https://github.com/llvm/llvm-project/commit/7c96f61aaa4c8297e5cd1b96c6985f491e5f034f.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/X86/X86InstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 51fb860c67a93..86dc8f92aa4d2 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -6135,6 +6135,11 @@ MachineInstr *X86InstrInfo::foldMemoryOperandImpl(
MI.getOpcode() != X86::ADD64rr)
return nullptr;
+ // Don't fold loads into indirect calls that need a KCFI check as we'll
+ // have to unfold these in X86KCFIPass anyway.
+ if (MI.isCall() && MI.getCFIType())
+ return nullptr;
+
MachineInstr *NewMI = nullptr;
// Attempt to fold any custom cases we have.
More information about the llvm-commits
mailing list