@@ -2004,7 +2004,7 @@ static SDValue getLoadStackGuard(SelectionDAG &DAG, SDLoc DL, SDValue &Chain) {
2004
2004
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
2005
2005
EVT PtrTy = TLI.getPointerTy(DAG.getDataLayout());
2006
2006
MachineFunction &MF = DAG.getMachineFunction();
2007
- Value *Global = TLI.getSDStackGuard (*MF.getFunction()->getParent());
2007
+ Value *Global = TLI.getSDagStackGuard (*MF.getFunction()->getParent());
2008
2008
MachineSDNode *Node =
2009
2009
DAG.getMachineNode(TargetOpcode::LOAD_STACK_GUARD, DL, PtrTy, Chain);
2010
2010
if (Global) {
@@ -2034,27 +2034,25 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
2034
2034
MachineFrameInfo *MFI = ParentBB->getParent()->getFrameInfo();
2035
2035
int FI = MFI->getStackProtectorIndex();
2036
2036
2037
- const Module &M = *ParentBB->getParent()->getFunction()->getParent();
2038
- const Value *IRGuard = TLI.getSDStackGuard(M);
2039
- assert(IRGuard && "Currently there must be an IR guard in order to use "
2040
- "SelectionDAG SSP");
2041
- SDValue GuardPtr = getValue(IRGuard);
2042
- SDValue StackSlotPtr = DAG.getFrameIndex(FI, PtrTy);
2043
-
2044
- unsigned Align = DL->getPrefTypeAlignment(IRGuard->getType());
2045
-
2046
2037
SDValue Guard;
2047
2038
SDLoc dl = getCurSDLoc();
2039
+ SDValue StackSlotPtr = DAG.getFrameIndex(FI, PtrTy);
2040
+ const Module &M = *ParentBB->getParent()->getFunction()->getParent();
2041
+ unsigned Align = DL->getPrefTypeAlignment(Type::getInt8PtrTy(M.getContext()));
2048
2042
2049
2043
// If useLoadStackGuardNode returns true, generate LOAD_STACK_GUARD.
2050
2044
// Otherwise, emit a volatile load to retrieve the stack guard value.
2051
2045
SDValue Chain = DAG.getEntryNode();
2052
- if (TLI.useLoadStackGuardNode())
2046
+ if (TLI.useLoadStackGuardNode()) {
2053
2047
Guard = getLoadStackGuard(DAG, dl, Chain);
2054
- else
2048
+ } else {
2049
+ const Value *IRGuard = TLI.getSDagStackGuard(M);
2050
+ SDValue GuardPtr = getValue(IRGuard);
2051
+
2055
2052
Guard =
2056
2053
DAG.getLoad(PtrTy, dl, Chain, GuardPtr, MachinePointerInfo(IRGuard, 0),
2057
2054
true, false, false, Align);
2055
+ }
2058
2056
2059
2057
SDValue StackSlot = DAG.getLoad(
2060
2058
PtrTy, dl, DAG.getEntryNode(), StackSlotPtr,
@@ -5313,7 +5311,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
5313
5311
if (TLI.useLoadStackGuardNode()) {
5314
5312
Res = getLoadStackGuard(DAG, sdl, Chain);
5315
5313
} else {
5316
- const Value *Global = TLI.getSDStackGuard (M);
5314
+ const Value *Global = TLI.getSDagStackGuard (M);
5317
5315
unsigned Align = DL->getPrefTypeAlignment(Global->getType());
5318
5316
Res =
5319
5317
DAG.getLoad(PtrTy, sdl, Chain, getValue(Global),
0 commit comments