From: David L Kreitzer Date: Tue, 4 Oct 2016 20:57:19 +0000 (+0000) Subject: Revert r283248. It caused failures in the hexagon buildbots. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06c72d092855716307ab11c184ab6b0304ca0cfb;p=llvm Revert r283248. It caused failures in the hexagon buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283254 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SafeStack.cpp b/lib/CodeGen/SafeStack.cpp index 7fc46c20234..4a1b9958a5b 100644 --- a/lib/CodeGen/SafeStack.cpp +++ b/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().getSE(); ++NumFunctions;