[llvm] r370468 - [DAGCombine] visitMULHS - use getScalarValueSizeInBits() to make safe for vector types.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 05:22:06 PDT 2019


Author: rksimon
Date: Fri Aug 30 05:22:06 2019
New Revision: 370468

URL: http://llvm.org/viewvc/llvm-project?rev=370468&view=rev
Log:
[DAGCombine] visitMULHS - use getScalarValueSizeInBits() to make safe for vector types.

This is hidden behind a (scalar-only) isOneConstant(N1) check at the moment, but once we get around to adding vector support we need to ensure we're dealing with the scalar bitwidth, not the total.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=370468&r1=370467&r2=370468&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Aug 30 05:22:06 2019
@@ -4195,7 +4195,7 @@ SDValue DAGCombiner::visitMULHS(SDNode *
   // fold (mulhs x, 1) -> (sra x, size(x)-1)
   if (isOneConstant(N1))
     return DAG.getNode(ISD::SRA, DL, N0.getValueType(), N0,
-                       DAG.getConstant(N0.getValueSizeInBits() - 1, DL,
+                       DAG.getConstant(N0.getScalarValueSizeInBits() - 1, DL,
                                        getShiftAmountTy(N0.getValueType())));
 
   // fold (mulhs x, undef) -> 0




More information about the llvm-commits mailing list