[llvm] b8d2b77 - [SelectionDAGBuilder] Avoid const_cast on call to matchSelectPattern. NFC (#100053)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 08:58:06 PDT 2024


Author: Craig Topper
Date: 2024-07-23T08:58:02-07:00
New Revision: b8d2b775f2feada0016648d09c078838dedf11f6

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

LOG: [SelectionDAGBuilder] Avoid const_cast on call to matchSelectPattern. NFC (#100053)

By making the LHS and RHS const pointers, we can use the const signature
of matchSelectPattern.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 37b1131d2f8a3..548be3c272421 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3730,8 +3730,8 @@ void SelectionDAGBuilder::visitSelect(const User &I) {
     // ValueTracking's select pattern matching does not account for -0.0,
     // so we can't lower to FMINIMUM/FMAXIMUM because those nodes specify that
     // -0.0 is less than +0.0.
-    Value *LHS, *RHS;
-    auto SPR = matchSelectPattern(const_cast<User*>(&I), LHS, RHS);
+    const Value *LHS, *RHS;
+    auto SPR = matchSelectPattern(&I, LHS, RHS);
     ISD::NodeType Opc = ISD::DELETED_NODE;
     switch (SPR.Flavor) {
     case SPF_UMAX:    Opc = ISD::UMAX; break;


        


More information about the llvm-commits mailing list