forked from OSchip/llvm-project
[DAGCombine] visitMULHS/visitMULHU - isBuildVectorAllZeros doesn't mean node is all zeros
Return a proper zero vector, just in case some elements are undef. Noticed by inspection after dealing with a similar issue in PR43159. llvm-svn: 370460
This commit is contained in:
parent
01a3c25c27
commit
7cbf823f93
|
@ -4183,10 +4183,10 @@ SDValue DAGCombiner::visitMULHS(SDNode *N) {
|
|||
|
||||
if (VT.isVector()) {
|
||||
// fold (mulhs x, 0) -> 0
|
||||
if (ISD::isBuildVectorAllZeros(N1.getNode()))
|
||||
return N1;
|
||||
if (ISD::isBuildVectorAllZeros(N0.getNode()))
|
||||
return N0;
|
||||
// do not return N0/N1, because undef node may exist.
|
||||
if (ISD::isBuildVectorAllZeros(N0.getNode()) ||
|
||||
ISD::isBuildVectorAllZeros(N1.getNode()))
|
||||
return DAG.getConstant(0, DL, VT);
|
||||
}
|
||||
|
||||
// fold (mulhs x, 0) -> 0
|
||||
|
@ -4230,10 +4230,10 @@ SDValue DAGCombiner::visitMULHU(SDNode *N) {
|
|||
|
||||
if (VT.isVector()) {
|
||||
// fold (mulhu x, 0) -> 0
|
||||
if (ISD::isBuildVectorAllZeros(N1.getNode()))
|
||||
return N1;
|
||||
if (ISD::isBuildVectorAllZeros(N0.getNode()))
|
||||
return N0;
|
||||
// do not return N0/N1, because undef node may exist.
|
||||
if (ISD::isBuildVectorAllZeros(N0.getNode()) ||
|
||||
ISD::isBuildVectorAllZeros(N1.getNode()))
|
||||
return DAG.getConstant(0, DL, VT);
|
||||
}
|
||||
|
||||
// fold (mulhu x, 0) -> 0
|
||||
|
|
Loading…
Reference in New Issue