[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.

llvm-svn: 370468
This commit is contained in:
Simon Pilgrim 2019-08-30 12:22:06 +00:00
parent 68f73bf262
commit 8e1989e79a
1 changed files with 1 additions and 1 deletions

View File

@ -4195,7 +4195,7 @@ SDValue DAGCombiner::visitMULHS(SDNode *N) {
// fold (mulhs x, 1) -> (sra x, size(x)-1) // fold (mulhs x, 1) -> (sra x, size(x)-1)
if (isOneConstant(N1)) if (isOneConstant(N1))
return DAG.getNode(ISD::SRA, DL, N0.getValueType(), N0, return DAG.getNode(ISD::SRA, DL, N0.getValueType(), N0,
DAG.getConstant(N0.getValueSizeInBits() - 1, DL, DAG.getConstant(N0.getScalarValueSizeInBits() - 1, DL,
getShiftAmountTy(N0.getValueType()))); getShiftAmountTy(N0.getValueType())));
// fold (mulhs x, undef) -> 0 // fold (mulhs x, undef) -> 0