@@ -3037,8 +3037,9 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
3037
3037
3038
3038
// First create the loads to the guard/stack slot for the comparison.
3039
3039
const TargetLowering &TLI = DAG.getTargetLoweringInfo ();
3040
- EVT PtrTy = TLI.getPointerTy (DAG.getDataLayout ());
3041
- EVT PtrMemTy = TLI.getPointerMemTy (DAG.getDataLayout ());
3040
+ auto &DL = DAG.getDataLayout ();
3041
+ EVT PtrTy = TLI.getPointerTy (DL);
3042
+ EVT PtrMemTy = TLI.getPointerMemTy (DL);
3042
3043
3043
3044
MachineFrameInfo &MFI = ParentBB->getParent ()->getFrameInfo ();
3044
3045
int FI = MFI.getStackProtectorIndex ();
@@ -3047,8 +3048,8 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
3047
3048
SDLoc dl = getCurSDLoc ();
3048
3049
SDValue StackSlotPtr = DAG.getFrameIndex (FI, PtrTy);
3049
3050
const Module &M = *ParentBB->getParent ()->getFunction ().getParent ();
3050
- Align Align =
3051
- DAG. getDataLayout (). getPrefTypeAlign ( PointerType::get (M.getContext (), 0 ));
3051
+ Align Align = DL. getPrefTypeAlign (
3052
+ PointerType::get (M.getContext (), DL. getAllocaAddrSpace () ));
3052
3053
3053
3054
// Generate code to load the content of the guard slot.
3054
3055
SDValue GuardVal = DAG.getLoad (
@@ -3074,10 +3075,9 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
3074
3075
}
3075
3076
3076
3077
// Perform the comparison via a getsetcc.
3077
- SDValue Cmp = DAG.getSetCC (dl, TLI.getSetCCResultType (DAG.getDataLayout (),
3078
- *DAG.getContext (),
3079
- Guard.getValueType ()),
3080
- Guard, GuardVal, ISD::SETNE);
3078
+ SDValue Cmp = DAG.getSetCC (
3079
+ dl, TLI.getSetCCResultType (DL, *DAG.getContext (), Guard.getValueType ()),
3080
+ Guard, GuardVal, ISD::SETNE);
3081
3081
3082
3082
// If the guard/stackslot do not equal, branch to failure MBB.
3083
3083
SDValue BrCond = DAG.getNode (ISD::BRCOND, dl,
@@ -3111,16 +3111,17 @@ void SelectionDAGBuilder::visitSPDescriptorFailure(
3111
3111
if (const Function *GuardCheckFn = TLI.getSSPStackGuardCheck (M)) {
3112
3112
3113
3113
// First create the loads to the guard/stack slot for the comparison.
3114
- EVT PtrTy = TLI.getPointerTy (DAG.getDataLayout ());
3115
- EVT PtrMemTy = TLI.getPointerMemTy (DAG.getDataLayout ());
3114
+ auto &DL = DAG.getDataLayout ();
3115
+ EVT PtrTy = TLI.getFrameIndexTy (DL);
3116
+ EVT PtrMemTy = TLI.getPointerMemTy (DL);
3116
3117
3117
3118
MachineFrameInfo &MFI = ParentBB->getParent ()->getFrameInfo ();
3118
3119
int FI = MFI.getStackProtectorIndex ();
3119
3120
3120
3121
SDLoc dl = getCurSDLoc ();
3121
3122
SDValue StackSlotPtr = DAG.getFrameIndex (FI, PtrTy);
3122
- Align Align = DAG. getDataLayout () .getPrefTypeAlign (
3123
- PointerType::get (M.getContext (), 0 ));
3123
+ Align Align = DL .getPrefTypeAlign (
3124
+ PointerType::get (M.getContext (), DL. getAllocaAddrSpace () ));
3124
3125
3125
3126
// Generate code to load the content of the guard slot.
3126
3127
SDValue GuardVal = DAG.getLoad (
0 commit comments