-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[VPlan] Return invalid cost if any skeleton block has invalid costs. #151940
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -1072,9 +1072,13 @@ InstructionCost VPlan::cost(ElementCount VF, VPCostContext &Ctx) { | |||||
// blocks, like the preheader or middle blocks. | ||||||
InstructionCost Cost = getVectorLoopRegion()->cost(VF, Ctx); | ||||||
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. Better bail out first if invalid? 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, added a check to the if and updated the comment, thanks! |
||||||
|
||||||
// If any instructions in the middle block are invalid return invalid. | ||||||
// TODO: Remove once no VPlans with VF == vscale x 1 and first-order recurrences are created. | ||||||
if (!getMiddleBlock()->cost(VF, Ctx).isValid()) | ||||||
// If any instructions in the skeleton outside loop regions are invalid return | ||||||
// invalid. | ||||||
if (any_of(VPBlockUtils::blocksOnly<VPBasicBlock>( | ||||||
vp_depth_first_shallow(getEntry())), | ||||||
[&VF, &Ctx](VPBasicBlock *VPBB) { | ||||||
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.
Suggested change
Nit. I hope cost() is marked cost? |
||||||
return !VPBB->cost(VF, Ctx).isValid(); | ||||||
})) | ||||||
return InstructionCost::getInvalid(); | ||||||
|
||||||
return Cost; | ||||||
|
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.
Comment deserves updating?
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.
Updated to clarify that other blocks are checked for recipes with invalid costs, thanks.