[llvm] [ConstraintElim] Simplify `MinMaxIntrinsic` (PR #75306)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 06:56:21 PST 2024


================
@@ -1392,6 +1396,31 @@ static bool checkAndReplaceCondition(
   return false;
 }
 
+static bool checkAndReplaceMinMax(MinMaxIntrinsic *MinMax, ConstraintInfo &Info,
+                                  unsigned NumIn, unsigned NumOut,
+                                  Instruction *ContextInst, DominatorTree &DT,
+                                  SmallVectorImpl<Instruction *> &ToRemove) {
+  auto ReplaceMinMaxWithOperand = [&](MinMaxIntrinsic *MinMax, bool UseLHS) {
+    // TODO: generate reproducer for min/max.
+    MinMax->replaceAllUsesWith(MinMax->getOperand(UseLHS ? 0 : 1));
+    if (MinMax->use_empty())
----------------
nikic wrote:

This check is redundant.

https://github.com/llvm/llvm-project/pull/75306


More information about the llvm-commits mailing list