Skip to content

Commit f5a2e6b

Browse files
authored
CodeGen: Remove overrides of getSSPStackGuardCheck (NFC) (llvm#164044)
All 3 implementations are just checking if this has the windows check function, so merge that as the only implementation.
1 parent 7d4430b commit f5a2e6b

File tree

8 files changed

+6
-31
lines changed

8 files changed

+6
-31
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ class LLVM_ABI TargetLoweringBase {
21272127
/// performs validation and error handling, returns the function. Otherwise,
21282128
/// returns nullptr. Must be previously inserted by insertSSPDeclarations.
21292129
/// Should be used only when getIRStackGuard returns nullptr.
2130-
virtual Function *getSSPStackGuardCheck(const Module &M) const;
2130+
Function *getSSPStackGuardCheck(const Module &M) const;
21312131

21322132
protected:
21332133
Value *getDefaultSafeStackPointerLocation(IRBuilderBase &IRB,

llvm/lib/CodeGen/TargetLoweringBase.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,11 @@ Value *TargetLoweringBase::getSDagStackGuard(const Module &M) const {
20972097
}
20982098

20992099
Function *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const {
2100+
// MSVC CRT has a function to validate security cookie.
2101+
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
2102+
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
2103+
if (SecurityCheckCookieLibcall != RTLIB::Unsupported)
2104+
return M.getFunction(getLibcallImplName(SecurityCheckCookieLibcall));
21002105
return nullptr;
21012106
}
21022107

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29488,15 +29488,6 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const {
2948829488
TargetLowering::insertSSPDeclarations(M);
2948929489
}
2949029490

29491-
Function *AArch64TargetLowering::getSSPStackGuardCheck(const Module &M) const {
29492-
// MSVC CRT has a function to validate security cookie.
29493-
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
29494-
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
29495-
if (SecurityCheckCookieLibcall != RTLIB::Unsupported)
29496-
return M.getFunction(getLibcallImplName(SecurityCheckCookieLibcall));
29497-
return TargetLowering::getSSPStackGuardCheck(M);
29498-
}
29499-
2950029491
Value *
2950129492
AArch64TargetLowering::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
2950229493
// Android provides a fixed TLS slot for the SafeStack pointer. See the

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ class AArch64TargetLowering : public TargetLowering {
366366
Value *getIRStackGuard(IRBuilderBase &IRB) const override;
367367

368368
void insertSSPDeclarations(Module &M) const override;
369-
Function *getSSPStackGuardCheck(const Module &M) const override;
370369

371370
/// If the target has a standard location for the unsafe stack pointer,
372371
/// returns the address of that location. Otherwise, returns nullptr.

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21381,15 +21381,6 @@ void ARMTargetLowering::insertSSPDeclarations(Module &M) const {
2138121381
TargetLowering::insertSSPDeclarations(M);
2138221382
}
2138321383

21384-
Function *ARMTargetLowering::getSSPStackGuardCheck(const Module &M) const {
21385-
// MSVC CRT has a function to validate security cookie.
21386-
RTLIB::LibcallImpl SecurityCheckCookie =
21387-
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
21388-
if (SecurityCheckCookie != RTLIB::Unsupported)
21389-
return M.getFunction(getLibcallImplName(SecurityCheckCookie));
21390-
return TargetLowering::getSSPStackGuardCheck(M);
21391-
}
21392-
2139321384
bool ARMTargetLowering::canCombineStoreAndExtract(Type *VectorTy, Value *Idx,
2139421385
unsigned &Cost) const {
2139521386
// If we do not have NEON, vector types are not natively supported.

llvm/lib/Target/ARM/ARMISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,6 @@ class VectorType;
708708
bool useLoadStackGuardNode(const Module &M) const override;
709709

710710
void insertSSPDeclarations(Module &M) const override;
711-
Function *getSSPStackGuardCheck(const Module &M) const override;
712711

713712
bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx,
714713
unsigned &Cost) const override;

llvm/lib/Target/X86/X86ISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,6 @@ namespace llvm {
15921592
bool useLoadStackGuardNode(const Module &M) const override;
15931593
bool useStackGuardXorFP() const override;
15941594
void insertSSPDeclarations(Module &M) const override;
1595-
Function *getSSPStackGuardCheck(const Module &M) const override;
15961595
SDValue emitStackGuardXorFP(SelectionDAG &DAG, SDValue Val,
15971596
const SDLoc &DL) const override;
15981597

llvm/lib/Target/X86/X86ISelLoweringCall.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,6 @@ void X86TargetLowering::insertSSPDeclarations(Module &M) const {
640640
TargetLowering::insertSSPDeclarations(M);
641641
}
642642

643-
Function *X86TargetLowering::getSSPStackGuardCheck(const Module &M) const {
644-
// MSVC CRT has a function to validate security cookie.
645-
if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment() ||
646-
Subtarget.getTargetTriple().isWindowsItaniumEnvironment()) {
647-
return M.getFunction("__security_check_cookie");
648-
}
649-
return TargetLowering::getSSPStackGuardCheck(M);
650-
}
651-
652643
Value *
653644
X86TargetLowering::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
654645
// Android provides a fixed TLS slot for the SafeStack pointer. See the

0 commit comments

Comments
 (0)