-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[VPlan] Replace ExtractFromEnd with Extract(Last|Penultimate)Element (NFC). #137030
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
Changes from 3 commits
876f977
80d1d0e
65178dd
20740c7
e5ecd86
1a5a728
733f4b5
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -337,16 +337,17 @@ void UnrollState::unrollBlock(VPBlockBase *VPB) { | |||||
| continue; | ||||||
| } | ||||||
| VPValue *Op0; | ||||||
| if (match(&R, m_VPInstruction<VPInstruction::ExtractFromEnd>( | ||||||
| m_VPValue(Op0), m_VPValue(Op1)))) { | ||||||
| if (match(&R, | ||||||
| m_VPInstruction<VPInstruction::ExtractLast>(m_VPValue(Op0))) || | ||||||
| match(&R, m_VPInstruction<VPInstruction::ExtractPenultimateLane>( | ||||||
| m_VPValue(Op0)))) { | ||||||
| addUniformForAllParts(cast<VPSingleDefRecipe>(&R)); | ||||||
| if (Plan.hasScalarVFOnly()) { | ||||||
|
Collaborator
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. Handle simpler vector VF case first?
Contributor
Author
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. Can do separately, leaving as-is for now to not pull in unrelated changes. |
||||||
| // Extracting from end with VF = 1 implies retrieving the scalar part UF | ||||||
| // - Op1. | ||||||
| unsigned Offset = | ||||||
| cast<ConstantInt>(Op1->getLiveInIRValue())->getZExtValue(); | ||||||
| R.getVPSingleValue()->replaceAllUsesWith( | ||||||
| getValueForPart(Op0, UF - Offset)); | ||||||
| auto *I = cast<VPInstruction>(&R); | ||||||
| // Extracting from end with VF = 1 implies retrieving retrieving the | ||||||
|
||||||
| // Extracting from end with VF = 1 implies retrieving retrieving the | |
| // Extracting from end with VF = 1 implies retrieving the |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should be further clarified: extract penultimate is used also for part when VF=1, but gets replaced by hooking up to penultimate part during unrolling-by-UF (right?). So during code-gen extract penultimate expects VF>1, i.e., it's per lane rather than per part; but so does extract last? So perhaps better rename
ExtractPenultimatetoo, explaining that both apply to lane or part, where the latter are abstract - dissolved prior to code-gen?Could also have
ExtractLastElementandExtractPenultimateElement, leaving the element to be either lane or full part.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated in the latest version to use
Elementsuffix for both, mention that for the scalar case it extracts the last/second-to-last part and that in this case it gets removed by unrolling.