Small simplification of the stack guard type.
authorBill Wendling <isanbard@gmail.com>
Tue, 4 Nov 2008 22:54:43 +0000 (22:54 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 4 Nov 2008 22:54:43 +0000 (22:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58728 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/StackProtector.cpp

index 30c3db5b5269321ac64b5a6dc08fbd29a23911c4..12d56c44b2a301afc207883de387c4ce3188acae 100644 (file)
@@ -114,11 +114,10 @@ bool StackProtector::runOnFunction(Function &Fn) {
 void StackProtector::InsertStackProtectorPrologue() {
   BasicBlock &Entry = F->getEntryBlock();
   Instruction &InsertPt = Entry.front();
+  const PointerType *GuardTy = PointerType::getUnqual(Type::Int8Ty);
 
-  StackGuardVar = M->getOrInsertGlobal("__stack_chk_guard",
-                                       PointerType::getUnqual(Type::Int8Ty));
-  StackProtFrameSlot = new AllocaInst(PointerType::getUnqual(Type::Int8Ty),
-                                      "StackProt_Frame", &InsertPt);
+  StackGuardVar = M->getOrInsertGlobal("__stack_chk_guard", GuardTy);
+  StackProtFrameSlot = new AllocaInst(GuardTy, "StackProt_Frame", &InsertPt);
   LoadInst *LI = new LoadInst(StackGuardVar, "StackGuard", false, &InsertPt);
   new StoreInst(LI, StackProtFrameSlot, false, &InsertPt);
 }