[llvm] [win][x64] Guarantee shape of tail call to a control flow guard function (PR #174108)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 31 11:08:07 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/include/llvm/Transforms/CFGuard.h llvm/lib/Target/X86/X86AsmPrinter.cpp llvm/lib/Target/X86/X86ExpandPseudo.cpp llvm/lib/Target/X86/X86FrameLowering.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Target/X86/X86ISelLowering.h llvm/lib/Target/X86/X86ISelLoweringCall.cpp llvm/lib/Target/X86/X86RegisterInfo.cpp llvm/lib/Transforms/CFGuard/CFGuard.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
index d50aa3f3f..24fe62d6a 100644
--- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
+++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
@@ -2457,11 +2457,14 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
// callee.
IsCFGuardTailCall = true;
auto LoadNode = cast<LoadSDNode>(Callee);
- GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(unwrapAddress(LoadNode->getBasePtr()));
- assert(isCFGuardFunction(GA->getGlobal()) && "CFG Call should be to a guard function");
- assert(LoadNode->getOffset()->isUndef() && "CFG Function load should not have an offset");
- Callee = DAG.getTargetGlobalAddress(GA->getGlobal(), dl, GA->getValueType(0),
- 0, X86II::MO_NO_FLAG);
+ GlobalAddressSDNode *GA =
+ cast<GlobalAddressSDNode>(unwrapAddress(LoadNode->getBasePtr()));
+ assert(isCFGuardFunction(GA->getGlobal()) &&
+ "CFG Call should be to a guard function");
+ assert(LoadNode->getOffset()->isUndef() &&
+ "CFG Function load should not have an offset");
+ Callee = DAG.getTargetGlobalAddress(
+ GA->getGlobal(), dl, GA->getValueType(0), 0, X86II::MO_NO_FLAG);
}
SmallVector<SDValue, 8> Ops;
diff --git a/llvm/lib/Transforms/CFGuard/CFGuard.cpp b/llvm/lib/Transforms/CFGuard/CFGuard.cpp
index a3420d640..5c2d9ddaa 100644
--- a/llvm/lib/Transforms/CFGuard/CFGuard.cpp
+++ b/llvm/lib/Transforms/CFGuard/CFGuard.cpp
@@ -315,7 +315,7 @@ FunctionPass *llvm::createCFGuardDispatchPass() {
bool llvm::isCFGuardCall(const CallBase *CB) {
return CB->getCallingConv() == CallingConv::CFGuard_Check ||
- CB->countOperandBundlesOfType(LLVMContext::OB_cfguardtarget);
+ CB->countOperandBundlesOfType(LLVMContext::OB_cfguardtarget);
}
bool llvm::isCFGuardFunction(const GlobalValue *GV) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/174108
More information about the llvm-commits
mailing list