-
Notifications
You must be signed in to change notification settings - Fork 14.2k
[VPlan] Ignore incoming values with constant false mask. #89384
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
fe47c38
97fc5c9
d66acc1
d799e16
3aeb6a4
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 |
---|---|---|
|
@@ -884,18 +884,19 @@ void VPlanTransforms::clearReductionWrapFlags(VPlan &Plan) { | |
|
||
/// Try to simplify recipe \p R. | ||
static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) { | ||
using namespace llvm::VPlanPatternMatch; | ||
// Try to remove redundant blend recipes. | ||
if (auto *Blend = dyn_cast<VPBlendRecipe>(&R)) { | ||
VPValue *Inc0 = Blend->getIncomingValue(0); | ||
for (unsigned I = 1; I != Blend->getNumIncomingValues(); ++I) | ||
if (Inc0 != Blend->getIncomingValue(I)) | ||
if (Inc0 != Blend->getIncomingValue(I) && | ||
!match(Blend->getMask(I), m_False())) | ||
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. This is fine, but could be more general: first filter all operands having false masks by replacing the original blend with a simpler blend, then apply the existing check if all operands are the same? May deserve additional tests. 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. (Ah, mentioned in the commit message as follow-up, very well.) 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. Will do separately, thanks! |
||
return; | ||
Blend->replaceAllUsesWith(Inc0); | ||
Blend->eraseFromParent(); | ||
return; | ||
} | ||
|
||
using namespace llvm::VPlanPatternMatch; | ||
VPValue *A; | ||
if (match(&R, m_Trunc(m_ZExtOrSExt(m_VPValue(A))))) { | ||
VPValue *Trunc = R.getVPSingleValue(); | ||
|
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.
Better assert the bitwidth is 1 when one tries to match False or True, rather than mismatch?
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 an assert before checking
APInt::isSameValue(CI->getValue(), Val)
, thanks!