[llvm] 51e92b2 - [X86] Speculatively apply the same fix from 361853c96f46848d2ad0739dfa7613e62e7fb530 to PromoteIntOp_MGATHER.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 12:02:45 PDT 2020


Author: Craig Topper
Date: 2020-07-01T11:57:59-07:00
New Revision: 51e92b223bf13c3b529220b80ef8bc972e46e564

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

LOG: [X86] Speculatively apply the same fix from 361853c96f46848d2ad0739dfa7613e62e7fb530 to PromoteIntOp_MGATHER.

The UpdateNodeOperands here is also subject to CSE.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 54dff1c57673..4e0e8c5b052b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -1751,7 +1751,14 @@ SDValue DAGTypeLegalizer::PromoteIntOp_MGATHER(MaskedGatherSDNode *N,
   } else
     NewOps[OpNo] = GetPromotedInteger(N->getOperand(OpNo));
 
-  return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
+  SDNode *Res = DAG.UpdateNodeOperands(N, NewOps);
+  if (Res == N)
+    return SDValue(Res, 0);
+
+  // Update triggered CSE, do our own replacement since caller can't.
+  ReplaceValueWith(SDValue(N, 0), SDValue(Res, 0));
+  ReplaceValueWith(SDValue(N, 1), SDValue(Res, 1));
+  return SDValue();
 }
 
 SDValue DAGTypeLegalizer::PromoteIntOp_MSCATTER(MaskedScatterSDNode *N,


        


More information about the llvm-commits mailing list