diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-02-20 18:45:10 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-02-20 18:45:10 +0000 |
commit | 6ad48f413743366c91b088a8e39d7f882200429d (patch) | |
tree | 8586702eea9363c10ce1882f7b64b0f0aee765f3 /lib/Transforms/InstCombine/InstCombineCompares.cpp | |
parent | 1c7f744bbbada1f4bab725c393cfe9ac30e87ffc (diff) |
InstCombine: Removing the base from the address calculation is only safe when the GEPs are inbounds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 5a91c7b970..b62f6e2049 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -610,7 +610,7 @@ Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, // If we're comparing GEPs with two base pointers that only differ in type // and both GEPs have only constant indices or just one use, then fold // the compare with the adjusted indices. - if (TD && + if (TD && GEPLHS->isInBounds() && GEPRHS->isInBounds() && (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse()) && PtrBase->stripPointerCasts() == |