[llvm] 75e8eb2 - [InstCombine] update code/test comments; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 11 07:54:00 PDT 2021
Author: Sanjay Patel
Date: 2021-09-11T10:53:53-04:00
New Revision: 75e8eb2b10b15b027608adb0d3eaaefbd19e5993
URL: https://github.com/llvm/llvm-project/commit/75e8eb2b10b15b027608adb0d3eaaefbd19e5993
DIFF: https://github.com/llvm/llvm-project/commit/75e8eb2b10b15b027608adb0d3eaaefbd19e5993.diff
LOG: [InstCombine] update code/test comments; NFC
Follow-up for post-commit suggestion on:
28afaed691a0a7ca46bb9f64fac11
The comments were partly copied from the original
code, but not updated to match the new code.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/sub-minmax.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index d96c0f88b46f2..951b68b5d742d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -2057,11 +2057,11 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
return BinaryOperator::CreateAnd(
Op0, Builder.CreateNot(Y, Y->getName() + ".not"));
- // ~X - Min/Max(~X, O) -> Max/Min(X, ~O) - X
- // ~X - Min/Max(O, ~X) -> Max/Min(X, ~O) - X
- // Min/Max(~X, O) - ~X -> A - Max/Min(X, ~O)
- // Min/Max(O, ~X) - ~X -> A - Max/Min(X, ~O)
- // So long as O here is freely invertible, this will be neutral or a win.
+ // ~X - Min/Max(~X, Y) -> ~Min/Max(X, ~Y) - X
+ // ~X - Min/Max(Y, ~X) -> ~Min/Max(X, ~Y) - X
+ // Min/Max(~X, Y) - ~X -> X - ~Min/Max(X, ~Y)
+ // Min/Max(Y, ~X) - ~X -> X - ~Min/Max(X, ~Y)
+ // As long as Y is freely invertible, this will be neutral or a win.
// Note: We don't generate the inverse max/min, just create the 'not' of
// it and let other folds do the rest.
if (match(Op0, m_Not(m_Value(X))) &&
@@ -2094,7 +2094,7 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
match(NotA, m_Not(m_Value(A))) && (NotA == LHS || NotA == RHS)) {
if (NotA == LHS)
std::swap(LHS, RHS);
- // LHS is now O above and expected to have at least 2 uses (the min/max)
+ // LHS is now Y above and expected to have at least 2 uses (the min/max)
// NotA is expected to have 2 uses from the min/max and 1 from the sub.
if (isFreeToInvert(LHS, !LHS->hasNUsesOrMore(3)) &&
!NotA->hasNUsesOrMore(4)) {
diff --git a/llvm/test/Transforms/InstCombine/sub-minmax.ll b/llvm/test/Transforms/InstCombine/sub-minmax.ll
index a489c0f24ab8d..5593b228592cf 100644
--- a/llvm/test/Transforms/InstCombine/sub-minmax.ll
+++ b/llvm/test/Transforms/InstCombine/sub-minmax.ll
@@ -394,10 +394,10 @@ define void @umin3_not_all_ops_extra_uses_invert_subs(i8 %x, i8 %y, i8 %z) {
}
; Handle this pattern with extra uses because it shows up in benchmarks.
-; ~X - Min/Max(~X, O) -> Max/Min(X, ~O) - X
-; ~X - Min/Max(O, ~X) -> Max/Min(X, ~O) - X
-; Min/Max(~X, O) - ~X -> A - Max/Min(X, ~O)
-; Min/Max(O, ~X) - ~X -> A - Max/Min(X, ~O)
+; ~X - Min/Max(~X, Y) -> ~Min/Max(X, ~Y) - X
+; ~X - Min/Max(Y, ~X) -> ~Min/Max(X, ~Y) - X
+; Min/Max(~X, Y) - ~X -> X - ~Min/Max(X, ~Y)
+; Min/Max(Y, ~X) - ~X -> X - ~Min/Max(X, ~Y)
define i8 @umin_not_sub_intrinsic_commute0(i8 %x, i8 %y) {
; CHECK-LABEL: @umin_not_sub_intrinsic_commute0(
More information about the llvm-commits
mailing list