diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-03-25 20:43:07 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-03-25 20:43:07 +0000 |
commit | 9d9e29b4a83818b066c09c8f832cec7641aa2115 (patch) | |
tree | cba92b550738be6765b9571bba387862602a9e0a /lib | |
parent | 805853bc59ecdae1746473d2b4178e9275a1b997 (diff) | |
download | external_llvm-9d9e29b4a83818b066c09c8f832cec7641aa2115.zip external_llvm-9d9e29b4a83818b066c09c8f832cec7641aa2115.tar.gz external_llvm-9d9e29b4a83818b066c09c8f832cec7641aa2115.tar.bz2 |
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')
-rw-r--r-- | lib/Analysis/InstructionSimplify.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index aaf9de2..bb70d1c 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) { |