summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-03 01:03:12 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-03 01:03:12 +0000
commit2f9cce2cd6715bceeab0ec052e115ce64252fb88 (patch)
tree2a0d2f2a10df2e6ad92109580bda587a7780b71b /llvm/lib
parent05f1ae987b271753cb3619cbcaf8fb986f014504 (diff)
downloadbcm5719-llvm-2f9cce2cd6715bceeab0ec052e115ce64252fb88.tar.gz
bcm5719-llvm-2f9cce2cd6715bceeab0ec052e115ce64252fb88.zip
Minor address space code simplification.
Remove assertion that the verifier should catch. llvm-svn: 187692
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index c8a68274b15..b275dfe0a12 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -676,9 +676,8 @@ static Constant *stripAndComputeConstantOffsets(const DataLayout *TD,
if (!TD)
return ConstantInt::get(IntegerType::get(V->getContext(), 64), 0);
- unsigned AS = V->getType()->getPointerAddressSpace();
- unsigned IntPtrWidth = TD->getPointerSizeInBits(AS);
- APInt Offset = APInt::getNullValue(IntPtrWidth);
+ Type *IntPtrTy = TD->getIntPtrType(V->getType())->getScalarType();
+ APInt Offset = APInt::getNullValue(IntPtrTy->getIntegerBitWidth());
// Even though we don't look through PHI nodes, we could be called on an
// instruction in an unreachable block, which may be on a cycle.
@@ -690,11 +689,7 @@ static Constant *stripAndComputeConstantOffsets(const DataLayout *TD,
break;
V = GEP->getPointerOperand();
} else if (Operator::getOpcode(V) == Instruction::BitCast) {
- Value *Op0 = cast<Operator>(V)->getOperand(0);
- assert(TD->getPointerTypeSizeInBits(V->getType()) ==
- TD->getPointerTypeSizeInBits(Op0->getType()) &&
- "Bitcasting between pointers from different size address spaces");
- V = Op0;
+ V = cast<Operator>(V)->getOperand(0);
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
if (GA->mayBeOverridden())
break;
@@ -706,7 +701,6 @@ static Constant *stripAndComputeConstantOffsets(const DataLayout *TD,
"Unexpected operand type!");
} while (Visited.insert(V));
- Type *IntPtrTy = TD->getIntPtrType(V->getContext(), AS);
Constant *OffsetIntPtr = ConstantInt::get(IntPtrTy, Offset);
if (V->getType()->isVectorTy())
return ConstantVector::getSplat(V->getType()->getVectorNumElements(),
OpenPOWER on IntegriCloud