Mercurial > projects > ldc
diff gen/passes/SimplifyDRuntimeCalls.cpp @ 1554:d6e8d5db259f
LLVMContext changes up to r77366
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Thu, 30 Jul 2009 15:25:10 +0200 |
parents | f55ca8a1598c |
children | 8d086d552909 |
line wrap: on
line diff
--- a/gen/passes/SimplifyDRuntimeCalls.cpp Thu Jul 23 20:34:35 2009 +0200 +++ b/gen/passes/SimplifyDRuntimeCalls.cpp Thu Jul 30 15:25:10 2009 +0200 @@ -74,7 +74,7 @@ this->TD = &TD; this->AA = &AA; if (CI->getCalledFunction()) - Context = CI->getCalledFunction()->getContext(); + Context = &CI->getCalledFunction()->getContext(); return CallOptimizer(CI->getCalledFunction(), CI, B); } }; @@ -95,7 +95,7 @@ Tys[0] = Len->getType(); Value *MemCpy = Intrinsic::getDeclaration(M, IID, Tys, 1); return B.CreateCall4(MemCpy, CastToCStr(Dst, B), CastToCStr(Src, B), Len, - Context->getConstantInt(Type::Int32Ty, Align)); + ConstantInt::get(Type::Int32Ty, Align)); } //===----------------------------------------------------------------------===// @@ -181,7 +181,7 @@ APInt Quot, Rem; APInt::udivrem(OldInt->getValue(), NewInt->getValue(), Quot, Rem); if (Rem == 0) - return B.CreateMul(OldLen, Context->getConstantInt(Quot)); + return B.CreateMul(OldLen, ConstantInt::get(*Context, Quot)); } return 0; } @@ -202,7 +202,7 @@ Constant* C = 0; if ((C = dyn_cast<Constant>(Cmp->getOperand(0))) || (C = dyn_cast<Constant>(Cmp->getOperand(1)))) { - Value* Result = Context->getConstantInt(Type::Int1Ty, !Cmp->isTrueWhenEqual()); + Value* Result = ConstantInt::get(Type::Int1Ty, !Cmp->isTrueWhenEqual()); Cmp->replaceAllUsesWith(Result); // Don't delete the comparison because there may be an // iterator to it. Instead, set the operands to constants @@ -359,8 +359,8 @@ } bool SimplifyDRuntimeCalls::runOnce(Function &F, const TargetData& TD, AliasAnalysis& AA) { - IRBuilder<> Builder(*Context); - + IRBuilder<> Builder(F.getContext()); + bool Changed = false; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) {