diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:41:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:41:05 +0000 |
commit | 01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch) | |
tree | 4def12e759965de927d963ac65840d663ef9d1ea /lib/Target/XCore/XCoreLowerThreadLocal.cpp | |
parent | f0f4822ed4b66e3579e92a89f368f8fb860e218e (diff) |
Notes
Diffstat (limited to 'lib/Target/XCore/XCoreLowerThreadLocal.cpp')
-rw-r--r-- | lib/Target/XCore/XCoreLowerThreadLocal.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Target/XCore/XCoreLowerThreadLocal.cpp b/lib/Target/XCore/XCoreLowerThreadLocal.cpp index f0b720151b17..5cc51cd7a992 100644 --- a/lib/Target/XCore/XCoreLowerThreadLocal.cpp +++ b/lib/Target/XCore/XCoreLowerThreadLocal.cpp @@ -76,7 +76,7 @@ createLoweredInitializer(ArrayType *NewType, Constant *OriginalInitializer) { static Instruction * createReplacementInstr(ConstantExpr *CE, Instruction *Instr) { - IRBuilder<true,NoFolder> Builder(Instr); + IRBuilder<NoFolder> Builder(Instr); unsigned OpCode = CE->getOpcode(); switch (OpCode) { case Instruction::GetElementPtr: { @@ -179,7 +179,6 @@ static bool isZeroLengthArray(Type *Ty) { bool XCoreLowerThreadLocal::lowerGlobal(GlobalVariable *GV) { Module *M = GV->getParent(); - LLVMContext &Ctx = M->getContext(); if (!GV->isThreadLocal()) return false; @@ -189,7 +188,7 @@ bool XCoreLowerThreadLocal::lowerGlobal(GlobalVariable *GV) { return false; // Create replacement global. - ArrayType *NewType = createLoweredType(GV->getType()->getElementType()); + ArrayType *NewType = createLoweredType(GV->getValueType()); Constant *NewInitializer = nullptr; if (GV->hasInitializer()) NewInitializer = createLoweredInitializer(NewType, @@ -210,11 +209,8 @@ bool XCoreLowerThreadLocal::lowerGlobal(GlobalVariable *GV) { Function *GetID = Intrinsic::getDeclaration(GV->getParent(), Intrinsic::xcore_getid); Value *ThreadID = Builder.CreateCall(GetID, {}); - SmallVector<Value *, 2> Indices; - Indices.push_back(Constant::getNullValue(Type::getInt64Ty(Ctx))); - Indices.push_back(ThreadID); - Value *Addr = - Builder.CreateInBoundsGEP(NewGV->getValueType(), NewGV, Indices); + Value *Addr = Builder.CreateInBoundsGEP(NewGV->getValueType(), NewGV, + {Builder.getInt64(0), ThreadID}); U->replaceUsesOfWith(GV, Addr); } |