summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit2741aae80be59828d8827e9cfed383351ffa880e (patch)
tree6b3713e209ae4139d3887ac319a7d8ce4358fc49 /llvm/lib
parent6cc6e60b6ecfbc787173d2e8dad4e5f74126a0cd (diff)
downloadbcm5719-llvm-2741aae80be59828d8827e9cfed383351ffa880e.tar.gz
bcm5719-llvm-2741aae80be59828d8827e9cfed383351ffa880e.zip
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. llvm-svn: 153418
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index aaf9de28da4..bb70d1cfc3c 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud