forked from OSchip/llvm-project
[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:
parent
68f73bf262
commit
8e1989e79a
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue