Since now SCEV can handle 'urem', an 'urem' is a better canonical form than an 'srem' because it has well-defined behavior
This is a follow up of D34598
Differential D38072
[SimplifyIndvar] Replace the srem used by IV if we can prove both of its operands are non-negative etherzhhb on Sep 19 2017, 7:17 PM. Authored by
Details Since now SCEV can handle 'urem', an 'urem' is a better canonical form than an 'srem' because it has well-defined behavior This is a follow up of D34598
Diff Detail
Event Timeline
Comment Actions This is looking close; only some nitpicky comments inline
Comment Actions LGTM with comments addressed.
|
Instead of creating another function this way, I thin a cleaner design would be to create a couple of small functions for the "i % n --> i if i is in [0,n).", "i+1) % n --> (i+1)==n?0:(i+1) if i is in [0,n)." cases and this case, and call them from SimplifyIndvar::eliminateIVRemainder.