[llvm] 50c1138 - [InstCombine] add TODO about another min/max fold; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 17 11:14:35 PDT 2021


Author: Sanjay Patel
Date: 2021-08-17T14:14:25-04:00
New Revision: 50c1138796c14014e1a30c7e87c65950440bd831

URL: https://github.com/llvm/llvm-project/commit/50c1138796c14014e1a30c7e87c65950440bd831
DIFF: https://github.com/llvm/llvm-project/commit/50c1138796c14014e1a30c7e87c65950440bd831.diff

LOG: [InstCombine] add TODO about another min/max fold; NFC

Suggested in post-commit for d0975b7cb0e1

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Removed: 
    


################################################################################
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);


        


More information about the llvm-commits mailing list