This is an archive of the discontinued LLVM Phabricator instance.

[InstComine] Forego of one-use check in `(X - (X & Y)) --> (X & ~Y)` if Y is a constant
ClosedPublic

Authored by lebedev.ri on Mar 6 2020, 9:15 AM.

Details

Summary

This is potentially more friendly for further optimizations,
analysies, e.g.: https://godbolt.org/z/G24anE

This resolves phase-ordering bug that was introduced
in D75145 for https://godbolt.org/z/2gBwF2
https://godbolt.org/z/XvgSua

Diff Detail

Event Timeline

lebedev.ri created this revision.Mar 6 2020, 9:15 AM
lebedev.ri edited the summary of this revision. (Show Details)Mar 6 2020, 9:38 AM
nikic accepted this revision.Mar 6 2020, 10:11 AM

LG, looks like a clear improvement for analysis.

This revision is now accepted and ready to land.Mar 6 2020, 10:11 AM
xbolva00 accepted this revision.Mar 6 2020, 10:24 AM

Thank you for the review.

This revision was automatically updated to reflect the committed changes.

Like I said in D75145, this looks like it's causing a lot of other regressions, at least on the ARM benchmarks I'm running. I'm wondering if it's to do with the LTO pipeline we have. There's a chance that this is actually doing better, allowing loops after unrolling to be analysable, but now the compiler has a lot more opportunities to shoot itself in the foot.