This patch implement fold: max(a,b) nsw/nuw - min(a,b) --> abs(a nsw - b)
Alive2: https://alive2.llvm.org/ce/z/4yLp7D
Fixes: https://github.com/llvm/llvm-project/issues/61228
Signed-off-by: Jun Zhang <jun@junz.org>
Paths
| Differential D145540
[InstCombine] Reduce absolute diff from min+max+sub ClosedPublic Authored by junaire on Mar 7 2023, 7:34 PM.
Details Summary This patch implement fold: max(a,b) nsw/nuw - min(a,b) --> abs(a nsw - b) Alive2: https://alive2.llvm.org/ce/z/4yLp7D Signed-off-by: Jun Zhang <jun@junz.org>
Diff Detail
Event TimelineRKSimon mentioned this in rG4585b54d660b: [InstCombine] Regenerate sub-minmax.ll.Mar 8 2023, 1:32 AM
This revision is now accepted and ready to land.Mar 9 2023, 10:07 AM This revision was landed with ongoing or failed builds.Mar 9 2023, 4:01 PM Closed by commit rG3ecf731376cb: [InstCombine] Reduce absolute diff from min+max+sub (authored by junaire). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 503290 llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/sub-minmax.ll
|
What about cases where we have smin(Y,X) instead?