Skip to content

Commit 60f5c59

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 fe02993 commit 60f5c59

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
@@ -29422,15 +29422,6 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const {
2942229422
TargetLowering::insertSSPDeclarations(M);
2942329423
}
2942429424

29425-
Function *AArch64TargetLowering::getSSPStackGuardCheck(const Module &M) const {
29426-
// MSVC CRT has a function to validate security cookie.
29427-
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
29428-
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
29429-
if (SecurityCheckCookieLibcall != RTLIB::Unsupported)
29430-
return M.getFunction(getLibcallImplName(SecurityCheckCookieLibcall));
29431-
return TargetLowering::getSSPStackGuardCheck(M);
29432-
}
29433-
2943429425
Value *
2943529426
AArch64TargetLowering::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
2943629427
// 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
@@ -21311,15 +21311,6 @@ void ARMTargetLowering::insertSSPDeclarations(Module &M) const {
2131121311
TargetLowering::insertSSPDeclarations(M);
2131221312
}
2131321313

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