-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[LV] Use ExtractLane(LastActiveLane, V) live outs when tail-folding. #149042
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
b7b23a9
9985387
6b0c9d2
2a45f94
7d1ab3c
8ca0426
96c827b
72f3796
f3fdac7
af82079
cc7e913
2d3012f
4fa7442
ae81e08
f10fa37
2758f96
73b3197
d8e77ca
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 |
|---|---|---|
|
|
@@ -638,7 +638,12 @@ Value *VPInstruction::generate(VPTransformState &State) { | |
| llvm_unreachable("should be handled by VPPhi::execute"); | ||
| } | ||
| case Instruction::Select: { | ||
| bool OnlyFirstLaneUsed = vputils::onlyFirstLaneUsed(this); | ||
| bool OnlyFirstLaneUsed = | ||
| vputils::onlyFirstLaneUsed(this) || | ||
|
||
| (isa<VPInstruction>(getOperand(1)) && | ||
|
||
| cast<VPInstruction>(getOperand(1))->isVectorToScalar() && | ||
| isa<VPInstruction>(getOperand(2)) && | ||
| cast<VPInstruction>(getOperand(2))->isVectorToScalar()); | ||
| Value *Cond = State.get(getOperand(0), OnlyFirstLaneUsed); | ||
| Value *Op1 = State.get(getOperand(1), OnlyFirstLaneUsed); | ||
| Value *Op2 = State.get(getOperand(2), OnlyFirstLaneUsed); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1941,6 +1941,35 @@ bool VPlanTransforms::adjustFixedOrderRecurrences(VPlan &Plan, | |||||
| // Set the first operand of RecurSplice to FOR again, after replacing | ||||||
| // all users. | ||||||
| RecurSplice->setOperand(0, FOR); | ||||||
|
|
||||||
| // Check for users extracting the second-to-last active lane of the FOR. If | ||||||
| // only a single lane is active in the current iteration, we need to select | ||||||
| // the last element of the value from the previous iteration, directly from | ||||||
| // the FOR phi. | ||||||
| for (VPUser *U : RecurSplice->users()) { | ||||||
| if (!match(U, m_VPInstruction<VPInstruction::ExtractLane>( | ||||||
| m_Sub(m_VPInstruction<VPInstruction::FirstActiveLane>( | ||||||
| m_VPValue()), | ||||||
| m_SpecificInt(1)), | ||||||
| m_Specific(RecurSplice)))) | ||||||
| continue; | ||||||
|
|
||||||
| VPBuilder B(cast<VPInstruction>(U)); | ||||||
| VPValue *LastActiveLane = cast<VPInstruction>(U)->getOperand(0); | ||||||
| Type *I64Ty = Type::getInt64Ty(Plan.getContext()); | ||||||
| VPValue *Zero = Plan.getOrAddLiveIn(ConstantInt::get(I64Ty, 0)); | ||||||
| VPValue *One = Plan.getOrAddLiveIn(ConstantInt::get(I64Ty, 1)); | ||||||
| VPValue *PenultimateIndex = | ||||||
| B.createNaryOp(Instruction::Sub, {LastActiveLane, One}); | ||||||
| VPValue *PenultimateLastIter = | ||||||
| B.createNaryOp(VPInstruction::ExtractLane, | ||||||
| {PenultimateIndex, FOR->getBackedgeValue()}); | ||||||
| VPValue *LastPrevIter = | ||||||
| B.createNaryOp(VPInstruction::ExtractLastElement, {FOR}); | ||||||
|
||||||
| B.createNaryOp(VPInstruction::ExtractLastElement, {FOR}); | |
| B.createNaryOp(VPInstruction::ExtractLastElement, FOR); |
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.
done thanks
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.
Does the PR handle the IV liveout user as well?
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 patch still leaves inductions untouched for now