forked from OSchip/llvm-project
[BasicAA] Add type check and Value equality check around code added in r305481.
This matches the checks done at the beginning of isKnownNonEqual that this code is partially emulating. Without this we can get assertion failures due to the bit widths of the KnownBits not matching. llvm-svn: 306044
This commit is contained in:
parent
4aedc81b8c
commit
d3711ee93e
|
@ -1021,11 +1021,14 @@ static AliasResult aliasSameBasePointerGEPs(const GEPOperator *GEP1,
|
|||
// asking about values from different loop iterations. See PR32314.
|
||||
// TODO: We may be able to change the check so we only do this when
|
||||
// we definitely looked through a PHINode.
|
||||
KnownBits Known1 = computeKnownBits(GEP1LastIdx, DL);
|
||||
KnownBits Known2 = computeKnownBits(GEP2LastIdx, DL);
|
||||
if (Known1.Zero.intersects(Known2.One) ||
|
||||
Known1.One.intersects(Known2.Zero))
|
||||
return NoAlias;
|
||||
if (GEP1LastIdx != GEP2LastIdx &&
|
||||
GEP1LastIdx->getType() == GEP2LastIdx->getType()) {
|
||||
KnownBits Known1 = computeKnownBits(GEP1LastIdx, DL);
|
||||
KnownBits Known2 = computeKnownBits(GEP2LastIdx, DL);
|
||||
if (Known1.Zero.intersects(Known2.One) ||
|
||||
Known1.One.intersects(Known2.Zero))
|
||||
return NoAlias;
|
||||
}
|
||||
} else if (isKnownNonEqual(GEP1LastIdx, GEP2LastIdx, DL))
|
||||
return NoAlias;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue