forked from OSchip/llvm-project
[DAGCombiner] Move or/xor/and opcode check in ReduceLoadOpStoreWidth before hasOneUse check.
hasOneUse is not cheap on nodes with chain results that might have many uses. By checking the opcode first, we can avoid a costly walk of the use list on nodes we aren't interested in. Found by investigating calls to hasNUsesOfValue from the example provided in D123857.
This commit is contained in:
parent
81143b69dd
commit
a7b9d75e7a
|
@ -17375,11 +17375,15 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
|
|||
SDValue Ptr = ST->getBasePtr();
|
||||
EVT VT = Value.getValueType();
|
||||
|
||||
if (ST->isTruncatingStore() || VT.isVector() || !Value.hasOneUse())
|
||||
if (ST->isTruncatingStore() || VT.isVector())
|
||||
return SDValue();
|
||||
|
||||
unsigned Opc = Value.getOpcode();
|
||||
|
||||
if ((Opc != ISD::OR && Opc != ISD::XOR && Opc != ISD::AND) ||
|
||||
!Value.hasOneUse())
|
||||
return SDValue();
|
||||
|
||||
// If this is "store (or X, Y), P" and X is "(and (load P), cst)", where cst
|
||||
// is a byte mask indicating a consecutive number of bytes, check to see if
|
||||
// Y is known to provide just those bytes. If so, we try to replace the
|
||||
|
@ -17404,8 +17408,7 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
|
|||
if (!EnableReduceLoadOpStoreWidth)
|
||||
return SDValue();
|
||||
|
||||
if ((Opc != ISD::OR && Opc != ISD::XOR && Opc != ISD::AND) ||
|
||||
Value.getOperand(1).getOpcode() != ISD::Constant)
|
||||
if (Value.getOperand(1).getOpcode() != ISD::Constant)
|
||||
return SDValue();
|
||||
|
||||
SDValue N0 = Value.getOperand(0);
|
||||
|
|
Loading…
Reference in New Issue