[llvm] r190113 - Use type helper functions.
Matt Arsenault
Matthew.Arsenault at amd.com
Thu Sep 5 17:37:24 PDT 2013
Author: arsenm
Date: Thu Sep 5 19:37:24 2013
New Revision: 190113
URL: http://llvm.org/viewvc/llvm-project?rev=190113&view=rev
Log:
Use type helper functions.
Modified:
llvm/trunk/include/llvm/IR/DataLayout.h
llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/include/llvm/IR/DataLayout.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DataLayout.h?rev=190113&r1=190112&r2=190113&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DataLayout.h (original)
+++ llvm/trunk/include/llvm/IR/DataLayout.h Thu Sep 5 19:37:24 2013
@@ -451,7 +451,7 @@ inline uint64_t DataLayout::getTypeSizeI
case Type::LabelTyID:
return getPointerSizeInBits(0);
case Type::PointerTyID:
- return getPointerSizeInBits(cast<PointerType>(Ty)->getAddressSpace());
+ return getPointerSizeInBits(Ty->getPointerAddressSpace());
case Type::ArrayTyID: {
ArrayType *ATy = cast<ArrayType>(Ty);
return ATy->getNumElements() *
@@ -461,7 +461,7 @@ inline uint64_t DataLayout::getTypeSizeI
// Get the layout annotation... which is lazily created on demand.
return getStructLayout(cast<StructType>(Ty))->getSizeInBits();
case Type::IntegerTyID:
- return cast<IntegerType>(Ty)->getBitWidth();
+ return Ty->getIntegerBitWidth();
case Type::HalfTyID:
return 16;
case Type::FloatTyID:
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp?rev=190113&r1=190112&r2=190113&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Thu Sep 5 19:37:24 2013
@@ -294,7 +294,7 @@ static bool CollectSingleShuffleElements
SmallVectorImpl<Constant*> &Mask) {
assert(V->getType() == LHS->getType() && V->getType() == RHS->getType() &&
"Invalid CollectSingleShuffleElements");
- unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
+ unsigned NumElts = V->getType()->getVectorNumElements();
if (isa<UndefValue>(V)) {
Mask.assign(NumElts, UndefValue::get(Type::getInt32Ty(V->getContext())));
Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=190113&r1=190112&r2=190113&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Thu Sep 5 19:37:24 2013
@@ -1418,8 +1418,7 @@ IsProfitableToFoldIntoAddressingMode(Ins
Value *Address = User->getOperand(OpNo);
if (!Address->getType()->isPointerTy())
return false;
- Type *AddressAccessTy =
- cast<PointerType>(Address->getType())->getElementType();
+ Type *AddressAccessTy = Address->getType()->getPointerElementType();
// Do a match against the root of this address, ignoring profitability. This
// will tell us if the addressing mode for the memory operation will
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=190113&r1=190112&r2=190113&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Sep 5 19:37:24 2013
@@ -3160,7 +3160,7 @@ static bool TurnSwitchRangeIntoICmp(Swit
/// and use it to remove dead cases.
static bool EliminateDeadSwitchCases(SwitchInst *SI) {
Value *Cond = SI->getCondition();
- unsigned Bits = cast<IntegerType>(Cond->getType())->getBitWidth();
+ unsigned Bits = Cond->getType()->getIntegerBitWidth();
APInt KnownZero(Bits, 0), KnownOne(Bits, 0);
ComputeMaskedBits(Cond, KnownZero, KnownOne);
More information about the llvm-commits
mailing list