Skip to content
Commit 8d385683 authored by Nikita Popov's avatar Nikita Popov
Browse files

[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.
parent 1af0e344
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment