diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-16 18:04:31 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-16 18:04:31 +0000 |
commit | 001dbfebcbbded8c8e74b19e838b50da2b6c6fb5 (patch) | |
tree | 1dc61249ea3e7ecc74b897c4c6014f9bbbc341ac /lib/Analysis | |
parent | f96db468fcf62d671cda99b68b6cfd3f2dc0b839 (diff) | |
download | external_llvm-001dbfebcbbded8c8e74b19e838b50da2b6c6fb5.zip external_llvm-001dbfebcbbded8c8e74b19e838b50da2b6c6fb5.tar.gz external_llvm-001dbfebcbbded8c8e74b19e838b50da2b6c6fb5.tar.bz2 |
Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 4 | ||||
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 59839e8..c10c6f3 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -312,6 +312,8 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS1, CallSite CS2) { AliasAnalysis::AliasResult BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { + Context = &V1->getType()->getContext(); + // Strip off any constant expression casts if they exist if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V1)) if (CE->isCast() && isa<PointerType>(CE->getOperand(0)->getType())) @@ -530,6 +532,8 @@ BasicAliasAnalysis::CheckGEPInstructions( const PointerType *GEPPointerTy = cast<PointerType>(BasePtr1Ty); + Context = &GEPPointerTy->getContext(); + // Find the (possibly empty) initial sequence of equal values... which are not // necessarily constants. unsigned NumGEP1Operands = NumGEP1Ops, NumGEP2Operands = NumGEP2Ops; diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index dcd6558..1b0b37b 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -191,7 +191,7 @@ const SCEV *ScalarEvolution::getConstant(ConstantInt *V) { } const SCEV *ScalarEvolution::getConstant(const APInt& Val) { - return getConstant(ConstantInt::get(Val)); + return getConstant(Context->getConstantInt(Val)); } const SCEV * @@ -1517,7 +1517,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops) { ++Idx; while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { // We found two constants, fold them together! - ConstantInt *Fold = ConstantInt::get(LHSC->getValue()->getValue() * + ConstantInt *Fold = Context->getConstantInt(LHSC->getValue()->getValue() * RHSC->getValue()->getValue()); Ops[0] = getConstant(Fold); Ops.erase(Ops.begin()+1); // Erase the folded element @@ -1868,7 +1868,7 @@ ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { assert(Idx < Ops.size()); while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { // We found two constants, fold them together! - ConstantInt *Fold = ConstantInt::get( + ConstantInt *Fold = Context->getConstantInt( APIntOps::smax(LHSC->getValue()->getValue(), RHSC->getValue()->getValue())); Ops[0] = getConstant(Fold); @@ -1965,7 +1965,7 @@ ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { assert(Idx < Ops.size()); while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { // We found two constants, fold them together! - ConstantInt *Fold = ConstantInt::get( + ConstantInt *Fold = Context->getConstantInt( APIntOps::umax(LHSC->getValue()->getValue(), RHSC->getValue()->getValue())); Ops[0] = getConstant(Fold); @@ -2887,7 +2887,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { // Turn shift left of a constant amount into a multiply. if (ConstantInt *SA = dyn_cast<ConstantInt>(U->getOperand(1))) { uint32_t BitWidth = cast<IntegerType>(V->getType())->getBitWidth(); - Constant *X = ConstantInt::get( + Constant *X = Context->getConstantInt( APInt(BitWidth, 1).shl(SA->getLimitedValue(BitWidth))); return getMulExpr(getSCEV(U->getOperand(0)), getSCEV(X)); } @@ -2897,7 +2897,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { // Turn logical shift right of a constant into a unsigned divide. if (ConstantInt *SA = dyn_cast<ConstantInt>(U->getOperand(1))) { uint32_t BitWidth = cast<IntegerType>(V->getType())->getBitWidth(); - Constant *X = ConstantInt::get( + Constant *X = Context->getConstantInt( APInt(BitWidth, 1).shl(SA->getLimitedValue(BitWidth))); return getUDivExpr(getSCEV(U->getOperand(0)), getSCEV(X)); } |