aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-11-07 01:23:58 +0000
committerBill Wendling <isanbard@gmail.com>2008-11-07 01:23:58 +0000
commitb7c6ebcb4732302310cfaca81e1d26c3802c1646 (patch)
treea5d148dcb2aa4d8795973e94eabea5d8fef74803 /lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
parent848693c254c1fc4d4956cbe1778b244bb035e0a0 (diff)
- Modify the stack protector algorithm so that the stack slot is allocated in
LLVM IR code and not in the selection DAG ISel. This is a cleaner solution. - Fix the heuristic for determining if protectors are necessary. The previous one wasn't checking the proper type size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index a0c30ff6c7..3e19b71b3b 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -3801,14 +3801,10 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
MachineFrameInfo *MFI = MF.getFrameInfo();
MVT PtrTy = TLI.getPointerTy();
- // Retrieve the stack protector guard's value.
- SDValue Src = getValue(I.getOperand(1));
-
- // Create a slot on the stack for the stack protector. It should go first
- // before local variables are allocated.
- unsigned Align =
- TLI.getTargetData()->getPrefTypeAlignment(PtrTy.getTypeForMVT());
- int FI = MFI->CreateStackObject(PtrTy.getSizeInBits() / 8, Align);
+ SDValue Src = getValue(I.getOperand(1)); // The guard's value.
+ AllocaInst *Slot = cast<AllocaInst>(I.getOperand(2));
+
+ int FI = FuncInfo.StaticAllocaMap[Slot];
MFI->setStackProtectorIndex(FI);
SDValue FIN = DAG.getFrameIndex(FI, PtrTy);