aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SafeStack.cpp
diff options
context:
space:
mode:
authorDavid L Kreitzer <david.l.kreitzer@intel.com>2016-10-04 20:57:19 +0000
committerDavid L Kreitzer <david.l.kreitzer@intel.com>2016-10-04 20:57:19 +0000
commit7c7ee89b01e995f03cd792dd106648e47457b56c (patch)
tree21b4718daf3861e1765ea09a8a5e9cf401135281 /llvm/lib/CodeGen/SafeStack.cpp
parentfb859a934a3604a234b1c796beba77b6e8dcd83e (diff)
downloadllvm-7c7ee89b01e995f03cd792dd106648e47457b56c.zip
llvm-7c7ee89b01e995f03cd792dd106648e47457b56c.tar.gz
llvm-7c7ee89b01e995f03cd792dd106648e47457b56c.tar.bz2
Revert r283248. It caused failures in the hexagon buildbots.
llvm-svn: 283254
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r--llvm/lib/CodeGen/SafeStack.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 7fc46c2..4a1b995 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -358,8 +358,9 @@ bool SafeStack::IsSafeStackAlloca(const Value *AllocaPtr, uint64_t AllocaSize) {
Value *SafeStack::getOrCreateUnsafeStackPtr(IRBuilder<> &IRB, Function &F) {
// Check if there is a target-specific location for the unsafe stack pointer.
- if (Value *V = TL->getSafeStackPointerLocation(IRB))
- return V;
+ if (TL)
+ if (Value *V = TL->getSafeStackPointerLocation(IRB))
+ return V;
// Otherwise, assume the target links with compiler-rt, which provides a
// thread-local variable with a magic name.
@@ -392,7 +393,9 @@ Value *SafeStack::getOrCreateUnsafeStackPtr(IRBuilder<> &IRB, Function &F) {
}
Value *SafeStack::getStackGuard(IRBuilder<> &IRB, Function &F) {
- Value *StackGuardVar = TL->getIRStackGuard(IRB);
+ Value *StackGuardVar = nullptr;
+ if (TL)
+ StackGuardVar = TL->getIRStackGuard(IRB);
if (!StackGuardVar)
StackGuardVar =
F.getParent()->getOrInsertGlobal("__stack_chk_guard", StackPtrTy);
@@ -749,9 +752,7 @@ bool SafeStack::runOnFunction(Function &F) {
return false;
}
- if (!TM)
- report_fatal_error("Target machine is required");
- TL = TM->getSubtargetImpl(F)->getTargetLowering();
+ TL = TM ? TM->getSubtargetImpl(F)->getTargetLowering() : nullptr;
SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
++NumFunctions;