-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[VPlan] Materialize VF and VFxUF using VPInstructions. #152879
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 1 commit
59322c5
3367a1f
e26258b
929db2e
4aa2925
f03fdfb
1cc3267
a404171
dab0d23
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 |
|---|---|---|
|
|
@@ -3339,6 +3339,50 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan, | |
| VectorTC.replaceAllUsesWith(Res); | ||
| } | ||
|
|
||
| void VPlanTransforms::materializeVFAndVFxUF(VPlan &Plan, VPBasicBlock *VectorPH, | ||
| ElementCount VFEC) { | ||
| VPBuilder Builder(VectorPH, VectorPH->begin()); | ||
| auto *TCTy = VPTypeAnalysis(Plan).inferScalarType(Plan.getTripCount()); | ||
| VPValue &VF = Plan.getVF(); | ||
| VPValue &VFxUF = Plan.getVFxUF(); | ||
|
Comment on lines
+3343
to
+3344
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. So Plan's getVF() and getVFxUF() become obsolete from this point? They will remain use-less, no longer retrieving the relevant values. Worth noting, or hooking them to their replacements?
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. Yep, for now, there are no users of getVF and getVFxUF at after this point. It would be good to mark them as such, but I'm not sure what the best way would be. Another alternative would be manage them as actual users. They should also be region-specific. I'll prepare some follow-ups for that. |
||
| if (VF.getNumUsers()) { | ||
|
||
| VPValue *RuntimeVF = | ||
| Plan.getOrAddLiveIn(ConstantInt::get(TCTy, VFEC.getKnownMinValue())); | ||
| if (VFEC.isScalable()) | ||
| RuntimeVF = Builder.createNaryOp( | ||
| Instruction::Mul, | ||
| {Builder.createNaryOp(VPInstruction::VScale, {}, TCTy), RuntimeVF}, | ||
| VPIRFlags::WrapFlagsTy(true, false)); | ||
lukel97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (any_of(VF.users(), [&VF](VPUser *U) { return !U->usesScalars(&VF); })) { | ||
| auto *BC = Builder.createNaryOp(VPInstruction::Broadcast, {RuntimeVF}); | ||
lukel97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| VF.replaceUsesWithIf( | ||
| BC, [&VF](VPUser &U, unsigned) { return !U.usesScalars(&VF); }); | ||
| } | ||
| VF.replaceAllUsesWith(RuntimeVF); | ||
|
||
|
|
||
| VPValue *UF = Plan.getOrAddLiveIn(ConstantInt::get(TCTy, Plan.getUF())); | ||
| auto *MulByUF = Plan.getUF() == 1 ? RuntimeVF | ||
lukel97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| : Builder.createNaryOp(Instruction::Mul, | ||
| {RuntimeVF, UF}); | ||
lukel97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| VFxUF.replaceAllUsesWith(MulByUF); | ||
| return; | ||
| } | ||
|
|
||
| unsigned VFMulUF = VFEC.getKnownMinValue() * Plan.getUF(); | ||
| VPValue *RuntimeVFxUF = Plan.getOrAddLiveIn(ConstantInt::get(TCTy, VFMulUF)); | ||
| if (VFEC.isScalable()) { | ||
| RuntimeVFxUF = | ||
| VFMulUF == 1 | ||
| ? RuntimeVFxUF | ||
| : Builder.createNaryOp( | ||
| Instruction::Mul, | ||
lukel97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {Builder.createNaryOp(VPInstruction::VScale, {}, TCTy), | ||
| RuntimeVFxUF}, | ||
| VPIRFlags::WrapFlagsTy(true, false)); | ||
| } | ||
| VFxUF.replaceAllUsesWith(RuntimeVFxUF); | ||
| } | ||
|
|
||
| /// Returns true if \p V is VPWidenLoadRecipe or VPInterleaveRecipe that can be | ||
| /// converted to a narrower recipe. \p V is used by a wide recipe that feeds a | ||
| /// store interleave group at index \p Idx, \p WideMember0 is the recipe feeding | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.