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 | ac8ecc4e7ea087939fc72ce40d63f84ce482e4ac (patch) | |
tree | 58081a7330169b8185f717de0e2717f5b61a4817 /llvm/lib/Transforms | |
parent | 66562a4a54a2014a02ca25f4f9223ceebdd0ad8e (diff) | |
download | bcm5719-llvm-ac8ecc4e7ea087939fc72ce40d63f84ce482e4ac.tar.gz bcm5719-llvm-ac8ecc4e7ea087939fc72ce40d63f84ce482e4ac.zip |
InstCombine: Removing the base from the address calculation is only safe when the GEPs are inbounds.
llvm-svn: 150978
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 5a91c7b9702..b62f6e20496 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/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() == |