diff options
author | Duncan Sands <baldrick@free.fr> | 2012-10-29 17:31:46 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-10-29 17:31:46 +0000 |
commit | 7ed4f94c1337b931524af99eb1aac72563888239 (patch) | |
tree | 928033939c9829e43c1fef92fccc82a17ce04296 /lib/Transforms/Scalar/GVN.cpp | |
parent | 6a09098cca6938dbfdc28e26fc45d626342816ac (diff) | |
download | llvm-7ed4f94c1337b931524af99eb1aac72563888239.tar.gz llvm-7ed4f94c1337b931524af99eb1aac72563888239.tar.bz2 llvm-7ed4f94c1337b931524af99eb1aac72563888239.tar.xz |
Remove a wrapper around getIntPtrType added to GVN by Hal in commit 166624 (the
wrapper returns a vector of integers when passed a vector of pointers) by having
getIntPtrType itself return a vector of integers in this case. Outside of this
wrapper, I didn't find anywhere in the codebase that was relying on the old
behaviour for vectors of pointers, so give this a whirl through the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/GVN.cpp')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index b6e15540e7..f10b71d33e 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -746,16 +746,6 @@ static bool CanCoerceMustAliasedValueToLoad(Value *StoredVal, return true; } -/// Wrap TD.getIntPtrType, but return a vector type for vector inputs. -static Type *getIntPtrType(Type *Ty, const DataLayout &TD) { - Type *ITy = TD.getIntPtrType(Ty); - if (Ty->isVectorTy()) { - ITy = VectorType::get(ITy, Ty->getVectorNumElements()); - } - - return ITy; -} - /// CoerceAvailableValueToLoadType - If we saw a store of a value to memory, and /// then a load from a must-aliased pointer of a different type, try to coerce /// the stored value. LoadedTy is the type of the load we want to replace and @@ -784,13 +774,13 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal, // Convert source pointers to integers, which can be bitcast. if (StoredValTy->getScalarType()->isPointerTy()) { - StoredValTy = getIntPtrType(StoredValTy, TD); + StoredValTy = TD.getIntPtrType(StoredValTy); StoredVal = new PtrToIntInst(StoredVal, StoredValTy, "", InsertPt); } Type *TypeToCastTo = LoadedTy; if (TypeToCastTo->getScalarType()->isPointerTy()) - TypeToCastTo = getIntPtrType(StoredValTy, TD); + TypeToCastTo = TD.getIntPtrType(StoredValTy); if (StoredValTy != TypeToCastTo) StoredVal = new BitCastInst(StoredVal, TypeToCastTo, "", InsertPt); @@ -809,7 +799,7 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal, // Convert source pointers to integers, which can be manipulated. if (StoredValTy->getScalarType()->isPointerTy()) { - StoredValTy = getIntPtrType(StoredValTy, TD); + StoredValTy = TD.getIntPtrType(StoredValTy); StoredVal = new PtrToIntInst(StoredVal, StoredValTy, "", InsertPt); } @@ -1031,7 +1021,7 @@ static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset, // to an integer type to start with. if (SrcVal->getType()->getScalarType()->isPointerTy()) SrcVal = Builder.CreatePtrToInt(SrcVal, - getIntPtrType(SrcVal->getType(), TD)); + TD.getIntPtrType(SrcVal->getType())); if (!SrcVal->getType()->isIntegerTy()) SrcVal = Builder.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize*8)); |