[ValueTracking] Don't handle ptrtoint with mismatches sizes
When processing assumes, we also handle assumes on ptrtoint of the value. In canonical IR, these will have the same size as the value. However, in non-canonical IR there may be an implicit zext or trunc, which results in a bit width mismatch. We currently handle this by adjusting bitwidth everywhere, but this is fragile and I'm pretty sure that the way we do this is incorrect for some predicates, because we effectively end up commuting an ext/trunc and an icmp. Instead, add an m_PtrToIntSameSize() matcher that will only handle bitwidth preserving cases. For the bitwidth-changing cases, wait until they have been canonicalized. The original handling for this was added purely to prevent crashes in an earlier implementation which failed to account for this entirely.
Loading
Please sign in to comment