This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] Add simplifications for `umin/umax(uadd/usub.sat(X, Y), X)`
Needs RevisionPublic

Authored by goldstein.w.n on Mar 6 2023, 6:07 PM.

Details

Summary

umax(uadd.sat(X, Y), X) --> uadd.sat(X, Y)

umin(uadd.sat(X, Y), X) --> X

umax(usub.sat(X, Y), X) --> X

umin(usub.sat(X, Y), X) --> usub.sat(X, Y)

Diff Detail

Event Timeline

goldstein.w.n created this revision.Mar 6 2023, 6:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 6:07 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Mar 6 2023, 6:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 6:07 PM
nikic requested changes to this revision.Mar 9 2023, 7:13 AM

I believe this is taking the wrong approach to these folds. What you want to implement is simplification for something like this: https://alive2.llvm.org/ce/z/f_Eg7U And then min/max simplification should fall out of that for free.

This revision now requires changes to proceed.Mar 9 2023, 7:13 AM