-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[DAGCombiner] Don't fold cheap extracts of multiple use splats #134120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20223,17 +20223,18 @@ performExtractSubvectorCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, | |
return SDValue(); | ||
|
||
EVT VT = N->getValueType(0); | ||
if (!VT.isScalableVector() || VT.getVectorElementType() != MVT::i1) | ||
return SDValue(); | ||
|
||
SDValue V = N->getOperand(0); | ||
|
||
if (VT.isScalableVector() != V->getValueType(0).isScalableVector()) | ||
return SDValue(); | ||
Comment on lines
+20228
to
+20229
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was needed to prevent an infinite loop where fixed length splats got legalized to scalable + an fixed extract There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a explanatory comment to explain this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes please. |
||
|
||
// NOTE: This combine exists in DAGCombiner, but that version's legality check | ||
// blocks this combine because the non-const case requires custom lowering. | ||
// We also want to perform it even when the splat has multiple uses. | ||
// | ||
// ty1 extract_vector(ty2 splat(const))) -> ty1 splat(const) | ||
if (V.getOpcode() == ISD::SPLAT_VECTOR) | ||
if (isa<ConstantSDNode>(V.getOperand(0))) | ||
if (isa<ConstantSDNode, ConstantFPSDNode>(V.getOperand(0))) | ||
return DAG.getNode(ISD::SPLAT_VECTOR, SDLoc(N), VT, V.getOperand(0)); | ||
|
||
return SDValue(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.