summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineCasts.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-14 00:24:34 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-14 00:24:34 +0000
commit3ea117e1bca290c4043ca38d25f278275e5853cb (patch)
treea930b52b2d40e971c24b52c51f16238c183462bb /lib/Transforms/InstCombine/InstCombineCasts.cpp
parentc2a484164d6d254db423c6192f32f73bb9d022ef (diff)
downloadllvm-3ea117e1bca290c4043ca38d25f278275e5853cb.tar.gz
llvm-3ea117e1bca290c4043ca38d25f278275e5853cb.tar.bz2
llvm-3ea117e1bca290c4043ca38d25f278275e5853cb.tar.xz
Use type helper functions instead of cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCasts.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
index e2f64d7bce..d31f84511e 100644
--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -1379,8 +1379,7 @@ Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) {
GEP->accumulateConstantOffset(*TD, Offset)) {
// Get the base pointer input of the bitcast, and the type it points to.
Value *OrigBase = cast<BitCastInst>(GEP->getOperand(0))->getOperand(0);
- Type *GEPIdxTy =
- cast<PointerType>(OrigBase->getType())->getElementType();
+ Type *GEPIdxTy = OrigBase->getType()->getPointerElementType();
SmallVector<Value*, 8> NewIndices;
if (FindElementAtOffset(GEPIdxTy, Offset.getSExtValue(), NewIndices)) {
// If we were able to index down into an element, create the GEP
@@ -1797,10 +1796,9 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
// Okay, we have (bitcast (shuffle ..)). Check to see if this is
// a bitcast to a vector with the same # elts.
if (SVI->hasOneUse() && DestTy->isVectorTy() &&
- cast<VectorType>(DestTy)->getNumElements() ==
- SVI->getType()->getNumElements() &&
+ DestTy->getVectorNumElements() == SVI->getType()->getNumElements() &&
SVI->getType()->getNumElements() ==
- cast<VectorType>(SVI->getOperand(0)->getType())->getNumElements()) {
+ SVI->getOperand(0)->getType()->getVectorNumElements()) {
BitCastInst *Tmp;
// If either of the operands is a cast from CI.getType(), then
// evaluating the shuffle in the casted destination's type will allow