[llvm-commits] [llvm] r59504 - in /llvm/trunk: include/llvm/Intrinsics.td lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/StackProtector.cpp
Bill Wendling
isanbard at gmail.com
Mon Nov 17 23:30:58 PST 2008
Author: void
Date: Tue Nov 18 01:30:57 2008
New Revision: 59504
URL: http://llvm.org/viewvc/llvm-project?rev=59504&view=rev
Log:
Remove the stackprotector_check intrinsic. Use a volatile load instead.
Modified:
llvm/trunk/include/llvm/Intrinsics.td
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
llvm/trunk/lib/CodeGen/StackProtector.cpp
Modified: llvm/trunk/include/llvm/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=59504&r1=59503&r2=59504&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/Intrinsics.td Tue Nov 18 01:30:57 2008
@@ -180,14 +180,11 @@
def int_readcyclecounter : Intrinsic<[llvm_i64_ty]>;
-// Stack Protector Intrinsics - The stackprotector_create writes the stack guard
-// to the correct place on the stack frame. The stackprotector_check reads back
-// the stack guard that the stackprotector_create stored.
+// Stack Protector Intrinsic - The stackprotector_create writes the stack guard
+// to the correct place on the stack frame.
def int_stackprotector_create : Intrinsic<[llvm_void_ty],
[llvm_ptr_ty, llvm_ptrptr_ty],
[IntrWriteMem]>;
-def int_stackprotector_check : Intrinsic<[llvm_ptr_ty], [llvm_ptrptr_ty],
- [IntrReadMem]>;
//===------------------- Standard C Library Intrinsics --------------------===//
//
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=59504&r1=59503&r2=59504&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Nov 18 01:30:57 2008
@@ -4041,19 +4041,6 @@
DAG.setRoot(Result);
return 0;
}
- case Intrinsic::stackprotector_check: {
- // Emit code into the DAG to retrieve the stack guard off of the stack.
- MachineFunction &MF = DAG.getMachineFunction();
- MachineFrameInfo *MFI = MF.getFrameInfo();
- MVT PtrTy = TLI.getPointerTy();
-
- // Load the value stored on the stack.
- int FI = MFI->getStackProtectorIndex();
- SDValue FIN = DAG.getFrameIndex(MFI->getStackProtectorIndex(), PtrTy);
- setValue(&I, DAG.getLoad(PtrTy, getRoot(), FIN,
- PseudoSourceValue::getFixedStack(FI), 0, true));
- return 0;
- }
case Intrinsic::var_annotation:
// Discard annotate attributes
return 0;
Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=59504&r1=59503&r2=59504&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackProtector.cpp Tue Nov 18 01:30:57 2008
@@ -177,7 +177,7 @@
// return:
// ...
// %1 = load __stack_chk_guard
- // %2 = call i8* @llvm.stackprotect.check(StackGuardSlot)
+ // %2 = load StackGuardSlot
// %3 = cmp i1 %1, %2
// br i1 %3, label %SP_return, label %CallStackCheckFailBlk
//
@@ -196,11 +196,9 @@
NewBB->moveAfter(BB);
// Generate the stack protector instructions in the old basic block.
- LoadInst *LI = new LoadInst(StackGuardVar, "", false, BB);
- CallInst *CI = CallInst::
- Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector_check),
- AI, "", BB);
- ICmpInst *Cmp = new ICmpInst(CmpInst::ICMP_EQ, CI, LI, "", BB);
+ LoadInst *LI1 = new LoadInst(StackGuardVar, "", false, BB);
+ LoadInst *LI2 = new LoadInst(AI, "", true, BB);
+ ICmpInst *Cmp = new ICmpInst(CmpInst::ICMP_EQ, LI1, LI2, "", BB);
BranchInst::Create(NewBB, FailBB, Cmp, BB);
}
More information about the llvm-commits
mailing list