summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorNicola Zaghen <nicola.zaghen@imgtec.com>2019-12-12 10:25:14 +0000
committerNicola Zaghen <nicola.zaghen@imgtec.com>2019-12-12 10:29:54 +0000
commitf798eb21eca97dc44ed40da52ece22780fb74230 (patch)
treefad09859cc0f2aef457f421278e70d5e5f9ed037 /llvm/lib/Analysis/InstructionSimplify.cpp
parent9c48c2f9c477007234c5bdad0bc8c0969afa0724 (diff)
downloadbcm5719-llvm-f798eb21eca97dc44ed40da52ece22780fb74230.tar.gz
bcm5719-llvm-f798eb21eca97dc44ed40da52ece22780fb74230.zip
Temporarily Revert "[DataLayout] Fix occurrences that size and range of pointers are assumed to be the same."
This reverts commit 5f6208778ff92567c57d7c1e2e740c284d7e69a5. This caused failures in Transforms/PhaseOrdering/scev-custom-dl.ll const: Assertion `getBitWidth() == CR.getBitWidth() && "ConstantRange types don't agree!"' failed.
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 75141f1ad95..c27e2567d5f 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -662,16 +662,16 @@ static Constant *stripAndComputeConstantOffsets(const DataLayout &DL, Value *&V,
bool AllowNonInbounds = false) {
assert(V->getType()->isPtrOrPtrVectorTy());
- Type *IntIdxTy = DL.getIndexType(V->getType())->getScalarType();
- APInt Offset = APInt::getNullValue(IntIdxTy->getIntegerBitWidth());
+ Type *IntPtrTy = DL.getIntPtrType(V->getType())->getScalarType();
+ APInt Offset = APInt::getNullValue(IntPtrTy->getIntegerBitWidth());
V = V->stripAndAccumulateConstantOffsets(DL, Offset, AllowNonInbounds);
// As that strip may trace through `addrspacecast`, need to sext or trunc
// the offset calculated.
- IntIdxTy = DL.getIndexType(V->getType())->getScalarType();
- Offset = Offset.sextOrTrunc(IntIdxTy->getIntegerBitWidth());
+ IntPtrTy = DL.getIntPtrType(V->getType())->getScalarType();
+ Offset = Offset.sextOrTrunc(IntPtrTy->getIntegerBitWidth());
- Constant *OffsetIntPtr = ConstantInt::get(IntIdxTy, Offset);
+ Constant *OffsetIntPtr = ConstantInt::get(IntPtrTy, Offset);
if (V->getType()->isVectorTy())
return ConstantVector::getSplat(V->getType()->getVectorNumElements(),
OffsetIntPtr);
@@ -4032,7 +4032,7 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops,
// The following transforms are only safe if the ptrtoint cast
// doesn't truncate the pointers.
if (Ops[1]->getType()->getScalarSizeInBits() ==
- Q.DL.getPointerSizeInBits(AS)) {
+ Q.DL.getIndexSizeInBits(AS)) {
auto PtrToIntOrZero = [GEPTy](Value *P) -> Value * {
if (match(P, m_Zero()))
return Constant::getNullValue(GEPTy);
OpenPOWER on IntegriCloud