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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 03:20:55 PST 2023


================
@@ -1349,6 +1351,47 @@ static bool checkAndReplaceCondition(
   return false;
 }
 
+static bool checkAndReplaceMinMax(MinMaxIntrinsic *MinMax, ConstraintInfo &Info,
+                                  unsigned NumIn, unsigned NumOut,
+                                  Instruction *ContextInst,
+                                  Module *ReproducerModule,
+                                  ArrayRef<ReproducerEntry> ReproducerCondStack,
+                                  DominatorTree &DT,
+                                  SmallVectorImpl<Instruction *> &ToRemove) {
+  auto ReplaceMinMaxWithOperand = [&](MinMaxIntrinsic *MinMax, bool UseLHS) {
+    // TODO: generate reproducer for min/max.
+    MinMax->replaceUsesWithIf(MinMax->getOperand(UseLHS ? 0 : 1),
----------------
fhahn wrote:

As the current version doesn't try to simplify uses, it should be possible to just use `replaceAllUsesWith` here for now?

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


More information about the llvm-commits mailing list