mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-24 19:44:49 +00:00
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
This commit is contained in:
parent
1c7f744bbb
commit
6ad48f4137
@ -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() ==
|
||||
|
Loading…
x
Reference in New Issue
Block a user