-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[VPlan] Use wide IV if scalar lanes > 0 are used with scalable vectors. #169796
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 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 |
|---|---|---|
|
|
@@ -794,12 +794,19 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) { | |
| WideIV->getDebugLoc(), Builder); | ||
|
|
||
| // Update scalar users of IV to use Step instead. | ||
| if (!HasOnlyVectorVFs) | ||
| if (!HasOnlyVectorVFs) { | ||
| assert(!Plan.hasScalableVF() && | ||
| "plans containing a scalar VF cannot also include scalable VFs"); | ||
| WideIV->replaceAllUsesWith(Steps); | ||
| else | ||
| WideIV->replaceUsesWithIf(Steps, [WideIV](VPUser &U, unsigned) { | ||
| return U.usesScalars(WideIV); | ||
| }); | ||
| } else { | ||
| bool HasScalableVF = Plan.hasScalableVF(); | ||
| WideIV->replaceUsesWithIf(Steps, | ||
| [WideIV, HasScalableVF](VPUser &U, unsigned) { | ||
| if (HasScalableVF) | ||
|
Contributor
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. Are plans containing scalable VFs always guaranteed to never include a fixed-width VF? I think that's probably true in practice, but this might give strange behaviour if not.
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. Yes, currently we build the plans for scalable/fixed vectorr completely separately, so they should never mix. |
||
| return U.usesFirstLaneOnly(WideIV); | ||
| return U.usesScalars(WideIV); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Is it worth adding an assert here that the plan doesn't have a scalable VF? i.e.
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.
added thanks. If the plan contains the scalar VF, it should never include scalable VFs.