[InstSimplify] move minnum/maxnum with same arg fold from instcombine
llvm-svn: 338652
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 7fc7c15..b1601bf 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4764,6 +4764,9 @@
break;
case Intrinsic::maxnum:
case Intrinsic::minnum:
+ // If the arguments are the same, this is a no-op.
+ if (Op0 == Op1) return Op0;
+
// If one argument is NaN, return the other argument.
if (match(Op0, m_NaN())) return Op1;
if (match(Op1, m_NaN())) return Op0;