summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2018-05-19 02:58:16 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2018-05-19 02:58:16 +0000
commitea988f1fd998d59f96a14bfb47db5470747f00d0 (patch)
tree47579cd16422155fae679308307f107bf1e0735b /llvm/lib/Transforms/Utils
parent429e06e76bf8239b1f455f2516a3cb165e70840a (diff)
downloadbcm5719-llvm-ea988f1fd998d59f96a14bfb47db5470747f00d0.tar.gz
bcm5719-llvm-ea988f1fd998d59f96a14bfb47db5470747f00d0.zip
Fix evaluator for non-zero alloca addr space
The evaluator goes through BB and creates global vars as temporary values to evaluate results of LLVM instructions. It creates undef for alloca, however it assumes alloca in addr space 0. If the next instruction is addrspace cast to 0, then we get an invalid cast instruction. This patch let the temp global var have an address space matching alloca addr space, so that the valuation can be done. Differential Revision: https://reviews.llvm.org/D47081 llvm-svn: 332794
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/Evaluator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Evaluator.cpp b/llvm/lib/Transforms/Utils/Evaluator.cpp
index 05a318a3f22..9440ae3ef2a 100644
--- a/llvm/lib/Transforms/Utils/Evaluator.cpp
+++ b/llvm/lib/Transforms/Utils/Evaluator.cpp
@@ -377,7 +377,8 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst,
Type *Ty = AI->getAllocatedType();
AllocaTmps.push_back(llvm::make_unique<GlobalVariable>(
Ty, false, GlobalValue::InternalLinkage, UndefValue::get(Ty),
- AI->getName()));
+ AI->getName(), /*TLMode=*/GlobalValue::NotThreadLocal,
+ AI->getType()->getPointerAddressSpace()));
InstResult = AllocaTmps.back().get();
LLVM_DEBUG(dbgs() << "Found an alloca. Result: " << *InstResult << "\n");
} else if (isa<CallInst>(CurInst) || isa<InvokeInst>(CurInst)) {
OpenPOWER on IntegriCloud