[llvm] [Legalizer] Check full condition for UMIN and UMAX just like the code below does for SMIN and SMAX (PR #87932)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 7 10:22:22 PDT 2024


https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/87932

None

>From b7637b270c034173d47c3a3e4e74a1b0513ab1b1 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Sun, 7 Apr 2024 13:21:32 -0400
Subject: [PATCH] [Legalizer] Check full condition for UMIN and UMAX just like
 the code below does for SMIN and SMAX

---
 llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 95c6a359e52ec6..83d8d2944c2b10 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -3943,7 +3943,7 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT LowerHintTy) {
     // target can override this with custom lowering and calling the
     // implementation functions.
     LLT Ty = MRI.getType(MI.getOperand(0).getReg());
-    if (LI.isLegalOrCustom({G_UMIN, Ty}))
+    if (LI.isLegalOrCustom({G_UMIN, Ty}) && LI.isLegalOrCustom({G_UMAX, Ty}))
       return lowerAddSubSatToMinMax(MI);
     return lowerAddSubSatToAddoSubo(MI);
   }



More information about the llvm-commits mailing list