Skip to content

Commit cbe6e4e

Browse files
committed
CodeGen: Remove overrides of getSSPStackGuardCheck
All 3 implementations are just checking if this has the windows check function, so merge that as the only implementation.
1 parent e83eee3 commit cbe6e4e

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
@@ -29430,15 +29430,6 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const {
2943029430
TargetLowering::insertSSPDeclarations(M);
2943129431
}
2943229432

29433-
Function *AArch64TargetLowering::getSSPStackGuardCheck(const Module &M) const {
29434-
// MSVC CRT has a function to validate security cookie.
29435-
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
29436-
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
29437-
if (SecurityCheckCookieLibcall != RTLIB::Unsupported)
29438-
return M.getFunction(getLibcallImplName(SecurityCheckCookieLibcall));
29439-
return TargetLowering::getSSPStackGuardCheck(M);
29440-
}
29441-
2944229433
Value *
2944329434
AArch64TargetLowering::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
2944429435
// 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
@@ -21312,15 +21312,6 @@ void ARMTargetLowering::insertSSPDeclarations(Module &M) const {
2131221312
TargetLowering::insertSSPDeclarations(M);
2131321313
}
2131421314

21315-
Function *ARMTargetLowering::getSSPStackGuardCheck(const Module &M) const {
21316-
// MSVC CRT has a function to validate security cookie.
21317-
RTLIB::LibcallImpl SecurityCheckCookie =
21318-
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
21319-
if (SecurityCheckCookie != RTLIB::Unsupported)
21320-
return M.getFunction(getLibcallImplName(SecurityCheckCookie));
21321-
return TargetLowering::getSSPStackGuardCheck(M);
21322-
}
21323-
2132421315
bool ARMTargetLowering::canCombineStoreAndExtract(Type *VectorTy, Value *Idx,
2132521316
unsigned &Cost) const {
2132621317
// 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
@@ -702,7 +702,6 @@ class VectorType;
702702
bool useLoadStackGuardNode(const Module &M) const override;
703703

704704
void insertSSPDeclarations(Module &M) const override;
705-
Function *getSSPStackGuardCheck(const Module &M) const override;
706705

707706
bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx,
708707
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)