From 50c1138796c14014e1a30c7e87c65950440bd831 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 17 Aug 2021 13:46:08 -0400 Subject: [PATCH] [InstCombine] add TODO about another min/max fold; NFC Suggested in post-commit for d0975b7cb0e1 --- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 579a4bb77377..9e4dd754be07 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1067,6 +1067,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) { if (IID == Intrinsic::smax || IID == Intrinsic::smin) { // smax (neg nsw X), (neg nsw Y) --> neg nsw (smin X, Y) // smin (neg nsw X), (neg nsw Y) --> neg nsw (smax X, Y) + // TODO: Canonicalize neg after min/max if I1 is constant. if (match(I0, m_NSWNeg(m_Value(X))) && match(I1, m_NSWNeg(m_Value(Y))) && (I0->hasOneUse() || I1->hasOneUse())) { Intrinsic::ID InvID = getInverseMinMaxIntrinsic(IID);