summaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2013-01-31 00:12:20 +0000
committerDan Gohman <dan433584@gmail.com>2013-01-31 00:12:20 +0000
commitf2335dcb17784148c4d8dd23093ab549153cc132 (patch)
treeea91078a2fe8911d27f25550670abbe223a0020f /lib/Analysis
parentee1841cddab0840e8cf70eb87f0ad36d22bd61d0 (diff)
downloadexternal_llvm-f2335dcb17784148c4d8dd23093ab549153cc132.zip
external_llvm-f2335dcb17784148c4d8dd23093ab549153cc132.tar.gz
external_llvm-f2335dcb17784148c4d8dd23093ab549153cc132.tar.bz2
stripAndComputeConstantOffsets is only called on pointers; check this
with an assert instead of failing and requiring callers to check for failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index d97e226..bc51457 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -665,8 +665,7 @@ Value *llvm::SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
/// no constant offsets applied.
static Constant *stripAndComputeConstantOffsets(const DataLayout &TD,
Value *&V) {
- if (!V->getType()->isPointerTy())
- return 0;
+ assert(V->getType()->isPointerTy());
unsigned IntPtrWidth = TD.getPointerSizeInBits();
APInt Offset = APInt::getNullValue(IntPtrWidth);
@@ -701,11 +700,7 @@ static Constant *stripAndComputeConstantOffsets(const DataLayout &TD,
static Constant *computePointerDifference(const DataLayout &TD,
Value *LHS, Value *RHS) {
Constant *LHSOffset = stripAndComputeConstantOffsets(TD, LHS);
- if (!LHSOffset)
- return 0;
Constant *RHSOffset = stripAndComputeConstantOffsets(TD, RHS);
- if (!RHSOffset)
- return 0;
// If LHS and RHS are not related via constant offsets to the same base
// value, there is nothing we can do here.
@@ -1710,11 +1705,7 @@ static Constant *computePointerICmp(const DataLayout &TD,
}
Constant *LHSOffset = stripAndComputeConstantOffsets(TD, LHS);
- if (!LHSOffset)
- return 0;
Constant *RHSOffset = stripAndComputeConstantOffsets(TD, RHS);
- if (!RHSOffset)
- return 0;
// If LHS and RHS are not related via constant offsets to the same base
// value, there is nothing we can do here.