diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2009-11-23 03:29:18 +0000 | 
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2009-11-23 03:29:18 +0000 | 
| commit | 39dbfd3c580ad398625e03ac84e34804bb79787b (patch) | |
| tree | 1fd9a76e8bbcfbc7bd4cbc7b5fea33029bef30f8 /llvm/lib | |
| parent | 4e3b3f3d9215e8da98f0b224ec0d851ae44f2e0b (diff) | |
| download | bcm5719-llvm-39dbfd3c580ad398625e03ac84e34804bb79787b.tar.gz bcm5719-llvm-39dbfd3c580ad398625e03ac84e34804bb79787b.zip  | |
Remove unused LLVMContext.
llvm-svn: 89642
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 34 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/IPConstantPropagation.cpp | 7 | 
2 files changed, 17 insertions, 24 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index b0e6900b30d..d27f8a5f714 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -325,7 +325,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,        APInt Mask2(Mask.shl(ShiftAmt));        ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero,KnownOne, TD,                          Depth+1); -      assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");  +      assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");         KnownZero = APIntOps::lshr(KnownZero, ShiftAmt);        KnownOne  = APIntOps::lshr(KnownOne, ShiftAmt);        // high bits known zero. @@ -343,7 +343,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,        APInt Mask2(Mask.shl(ShiftAmt));        ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero, KnownOne, TD,                          Depth+1); -      assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");  +      assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");         KnownZero = APIntOps::lshr(KnownZero, ShiftAmt);        KnownOne  = APIntOps::lshr(KnownOne, ShiftAmt); @@ -380,7 +380,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,    }    // fall through    case Instruction::Add: { -    // If one of the operands has trailing zeros, than the bits that the +    // If one of the operands has trailing zeros, then the bits that the      // other operand has in those bit positions will be preserved in the      // result. For an add, this works with either operand. For a subtract,      // this only works if the known zeros are in the right operand. @@ -436,7 +436,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,          KnownZero |= KnownZero2 & Mask; -        assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");  +        assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");         }      }      break; @@ -449,7 +449,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,          KnownZero |= ~LowBits & Mask;          ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero, KnownOne, TD,                            Depth+1); -        assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); +        assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");          break;        }      } @@ -959,7 +959,6 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) {  static Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,                                  SmallVector<unsigned, 10> &Idxs,                                  unsigned IdxSkip, -                                LLVMContext &Context,                                  Instruction *InsertBefore) {    const llvm::StructType *STy = llvm::dyn_cast<llvm::StructType>(IndexedType);    if (STy) { @@ -971,7 +970,7 @@ static Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,        Idxs.push_back(i);        Value *PrevTo = To;        To = BuildSubAggregate(From, To, STy->getElementType(i), Idxs, IdxSkip, -                             Context, InsertBefore); +                             InsertBefore);        Idxs.pop_back();        if (!To) {          // Couldn't find any inserted value for this index? Cleanup @@ -994,7 +993,7 @@ static Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,    // we might be able to find the complete struct somewhere.    // Find the value that is at that particular spot -  Value *V = FindInsertedValue(From, Idxs.begin(), Idxs.end(), Context); +  Value *V = FindInsertedValue(From, Idxs.begin(), Idxs.end());    if (!V)      return NULL; @@ -1017,7 +1016,7 @@ static Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,  //  // All inserted insertvalue instructions are inserted before InsertBefore  static Value *BuildSubAggregate(Value *From, const unsigned *idx_begin, -                                const unsigned *idx_end, LLVMContext &Context, +                                const unsigned *idx_end,                                  Instruction *InsertBefore) {    assert(InsertBefore && "Must have someplace to insert!");    const Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(), @@ -1027,8 +1026,7 @@ static Value *BuildSubAggregate(Value *From, const unsigned *idx_begin,    SmallVector<unsigned, 10> Idxs(idx_begin, idx_end);    unsigned IdxSkip = Idxs.size(); -  return BuildSubAggregate(From, To, IndexedType, Idxs, IdxSkip, -                           Context, InsertBefore); +  return BuildSubAggregate(From, To, IndexedType, Idxs, IdxSkip, InsertBefore);  }  /// FindInsertedValue - Given an aggregrate and an sequence of indices, see if @@ -1038,8 +1036,7 @@ static Value *BuildSubAggregate(Value *From, const unsigned *idx_begin,  /// If InsertBefore is not null, this function will duplicate (modified)  /// insertvalues when a part of a nested struct is extracted.  Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin, -                         const unsigned *idx_end, LLVMContext &Context, -                         Instruction *InsertBefore) { +                         const unsigned *idx_end, Instruction *InsertBefore) {    // Nothing to index? Just return V then (this is useful at the end of our    // recursion)    if (idx_begin == idx_end) @@ -1063,7 +1060,7 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,      if (isa<ConstantArray>(C) || isa<ConstantStruct>(C))        // Recursively process this constant        return FindInsertedValue(C->getOperand(*idx_begin), idx_begin + 1, -                               idx_end, Context, InsertBefore); +                               idx_end, InsertBefore);    } else if (InsertValueInst *I = dyn_cast<InsertValueInst>(V)) {      // Loop the indices for the insertvalue instruction in parallel with the      // requested indices @@ -1082,8 +1079,7 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,            // %C = insertvalue {i32, i32 } %A, i32 11, 1            // which allows the unused 0,0 element from the nested struct to be            // removed. -          return BuildSubAggregate(V, idx_begin, req_idx, -                                   Context, InsertBefore); +          return BuildSubAggregate(V, idx_begin, req_idx, InsertBefore);          else            // We can't handle this without inserting insertvalues            return 0; @@ -1094,13 +1090,13 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,        // looking for, then.        if (*req_idx != *i)          return FindInsertedValue(I->getAggregateOperand(), idx_begin, idx_end, -                                 Context, InsertBefore); +                                 InsertBefore);      }      // If we end up here, the indices of the insertvalue match with those      // requested (though possibly only partially). Now we recursively look at      // the inserted value, passing any remaining indices.      return FindInsertedValue(I->getInsertedValueOperand(), req_idx, idx_end, -                             Context, InsertBefore); +                             InsertBefore);    } else if (ExtractValueInst *I = dyn_cast<ExtractValueInst>(V)) {      // If we're extracting a value from an aggregrate that was extracted from      // something else, we can extract from that something else directly instead. @@ -1124,7 +1120,7 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,             && "Number of indices added not correct?");      return FindInsertedValue(I->getAggregateOperand(), Idxs.begin(), Idxs.end(), -                             Context, InsertBefore); +                             InsertBefore);    }    // Otherwise, we don't know (such as, extracting from a function return value    // or load instruction) diff --git a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp index 023e642e648..df2456f9f2b 100644 --- a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -19,7 +19,6 @@  #include "llvm/Transforms/IPO.h"  #include "llvm/Constants.h"  #include "llvm/Instructions.h" -#include "llvm/LLVMContext.h"  #include "llvm/Module.h"  #include "llvm/Pass.h"  #include "llvm/Analysis/ValueTracking.h" @@ -155,7 +154,7 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) {  // callers will be updated to use the value they pass in directly instead of  // using the return value.  bool IPCP::PropagateConstantReturn(Function &F) { -  if (F.getReturnType() == Type::getVoidTy(F.getContext())) +  if (F.getReturnType()->isVoidTy())      return false; // No return value.    // If this function could be overridden later in the link stage, we can't @@ -163,8 +162,6 @@ bool IPCP::PropagateConstantReturn(Function &F) {    if (F.mayBeOverridden())      return false; -  LLVMContext &Context = F.getContext(); -      // Check to see if this function returns a constant.    SmallVector<Value *,4> RetVals;    const StructType *STy = dyn_cast<StructType>(F.getReturnType()); @@ -188,7 +185,7 @@ bool IPCP::PropagateConstantReturn(Function &F) {          if (!STy)            V = RI->getOperand(i);          else -          V = FindInsertedValue(RI->getOperand(0), i, Context); +          V = FindInsertedValue(RI->getOperand(0), i);          if (V) {            // Ignore undefs, we can change them into anything  | 

