Same as to D52146.
((1 << y)+(-1)) is simply non-canoniacal version of ~(-1 << y): https://rise4fun.com/Alive/0vl
We can not canonicalize it due to the extra uses. But we can handle it here.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
As discussed in D52146, this is a close call. We don't have evidence to suggest that the non-canonical pattern occurs often in real code, but it was spotted somewhere in the wild, and it's nice that we can fold this pattern regardless of extra uses. OTOH, instcombine keeps growing bigger and slower. But given past policy in these situations, we don't block tiny patches like this just because the fold is unlikely, so LGTM.