summaryrefslogtreecommitdiff
path: root/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-03-25 20:43:07 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-03-25 20:43:07 +0000
commit9d9e29b4a83818b066c09c8f832cec7641aa2115 (patch)
treecba92b550738be6765b9571bba387862602a9e0a /lib/Analysis/InstructionSimplify.cpp
parent805853bc59ecdae1746473d2b4178e9275a1b997 (diff)
downloadllvm-9d9e29b4a83818b066c09c8f832cec7641aa2115.tar.gz
llvm-9d9e29b4a83818b066c09c8f832cec7641aa2115.tar.bz2
llvm-9d9e29b4a83818b066c09c8f832cec7641aa2115.tar.xz
Switch the pointer-difference simplification logic to only work with
inbounds GEPs. This isn't really necessary for simplifying pointer differences, but I'm planning to re-use the same code to simplify pointer comparisons where it is necessary. Since real code almost exclusively uses inbounds GEPs, it doesn't seem worth it to support the extra complexity of turning it on and off. If anyone would like that back, feel free to shout. Note that instcombine will still catch any of these patterns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index aaf9de28da..bb70d1cfc3 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -710,7 +710,7 @@ static Constant *stripAndComputeConstantOffsets(const TargetData &TD,
Visited.insert(V);
do {
if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
- if (!accumulateGEPOffset(TD, GEP, Offset))
+ if (!GEP->isInBounds() || !accumulateGEPOffset(TD, GEP, Offset))
break;
V = GEP->getPointerOperand();
} else if (Operator::getOpcode(V) == Instruction::BitCast) {