summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LowerEmuTLS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/LowerEmuTLS.cpp')
-rw-r--r--llvm/lib/CodeGen/LowerEmuTLS.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/LowerEmuTLS.cpp b/llvm/lib/CodeGen/LowerEmuTLS.cpp
index ec36b669ac01..c81f0184cf21 100644
--- a/llvm/lib/CodeGen/LowerEmuTLS.cpp
+++ b/llvm/lib/CodeGen/LowerEmuTLS.cpp
@@ -140,8 +140,7 @@ bool addEmuTlsVar(Module &M, const GlobalVariable *GV) {
PointerType *InitPtrType = PointerType::getUnqual(C);
Type *ElementTypes[4] = {WordType, WordType, VoidPtrType, InitPtrType};
StructType *EmuTlsVarType = StructType::create(ElementTypes);
- EmuTlsVar = cast<GlobalVariable>(
- M.getOrInsertGlobal(EmuTlsVarName, EmuTlsVarType));
+ EmuTlsVar = M.getOrInsertGlobal(EmuTlsVarName, EmuTlsVarType);
copyLinkageVisibility(M, GV, EmuTlsVar);
// Define "__emutls_t.*" and "__emutls_v.*" only if GV is defined.
@@ -155,8 +154,7 @@ bool addEmuTlsVar(Module &M, const GlobalVariable *GV) {
GlobalVariable *EmuTlsTmplVar = nullptr;
if (InitValue) {
std::string EmuTlsTmplName = ("__emutls_t." + GV->getName()).str();
- EmuTlsTmplVar = dyn_cast_or_null<GlobalVariable>(
- M.getOrInsertGlobal(EmuTlsTmplName, GVType));
+ EmuTlsTmplVar = M.getOrInsertGlobal(EmuTlsTmplName, GVType);
assert(EmuTlsTmplVar && "Failed to create emualted TLS initializer");
EmuTlsTmplVar->setConstant(true);
EmuTlsTmplVar->setInitializer(const_cast<Constant*>(InitValue));