I don't think it already exists? I don't see it at least.
It is important to have it because else we'll do some checks after match(),
and that may result in missed folds in commutative nodes.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This comment was removed by lebedev.ri.
Comment Actions
I didn't post that patch yet. It comes up when fixing PR42466
We have icmp eq/ne (and (shl X, Y), Z), 0, and if X is not a constant we want to turn it into icmp eq/ne (and (lshr Z, Y), X), 0.
But the problem is that if we do the obvious thing and directly patternmatch that, and *then* check that X is not a constant (and not fold if it is),
we then won't check whether Z is also a (shl Q, W) with Q not being a constant, and this we have missed commutative case..
Comment Actions
LGTM
unittests/IR/PatternMatch.cpp | ||
---|---|---|
89 ↗ | (On Diff #207410) | Better to call this value 'X' or some other non-overlapping name - easy to misread 'm_One' and 'One' below here. |