Skip to content

Commit 58f7df2

Browse files
committed
Fix Trivial issues
1 parent ee70787 commit 58f7df2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,8 +3037,9 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
30373037

30383038
// First create the loads to the guard/stack slot for the comparison.
30393039
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);
30423043

30433044
MachineFrameInfo &MFI = ParentBB->getParent()->getFrameInfo();
30443045
int FI = MFI.getStackProtectorIndex();
@@ -3047,8 +3048,8 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
30473048
SDLoc dl = getCurSDLoc();
30483049
SDValue StackSlotPtr = DAG.getFrameIndex(FI, PtrTy);
30493050
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()));
30523053

30533054
// Generate code to load the content of the guard slot.
30543055
SDValue GuardVal = DAG.getLoad(
@@ -3074,10 +3075,9 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
30743075
}
30753076

30763077
// 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);
30813081

30823082
// If the guard/stackslot do not equal, branch to failure MBB.
30833083
SDValue BrCond = DAG.getNode(ISD::BRCOND, dl,
@@ -3111,16 +3111,17 @@ void SelectionDAGBuilder::visitSPDescriptorFailure(
31113111
if (const Function *GuardCheckFn = TLI.getSSPStackGuardCheck(M)) {
31123112

31133113
// 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);
31163117

31173118
MachineFrameInfo &MFI = ParentBB->getParent()->getFrameInfo();
31183119
int FI = MFI.getStackProtectorIndex();
31193120

31203121
SDLoc dl = getCurSDLoc();
31213122
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()));
31243125

31253126
// Generate code to load the content of the guard slot.
31263127
SDValue GuardVal = DAG.getLoad(

0 commit comments

Comments
 (0)