-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[VPlan] Fold NOT into predicate of wide compares. #129430
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
16041bb
89c97c7
f1fe3a1
2702792
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -978,6 +978,21 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) { | |||||
| TypeInfo.inferScalarType(R.getOperand(1)) == | ||||||
| TypeInfo.inferScalarType(R.getVPSingleValue())) | ||||||
| return R.getVPSingleValue()->replaceAllUsesWith(R.getOperand(1)); | ||||||
|
|
||||||
| if (match(&R, m_Not(m_VPValue(A))) && isa<VPWidenRecipe>(A) && | ||||||
|
||||||
| A->getNumUsers() == 1) { | ||||||
|
||||||
| auto *WideCmp = cast<VPWidenRecipe>(A); | ||||||
| if (WideCmp->getOpcode() == Instruction::ICmp || | ||||||
| WideCmp->getOpcode() == Instruction::FCmp) { | ||||||
| WideCmp->setPredicate( | ||||||
| CmpInst::getInversePredicate(WideCmp->getPredicate())); | ||||||
| R.getVPSingleValue()->replaceAllUsesWith(WideCmp); | ||||||
| // If WideCmp doesn't have a debug location, use the one from the | ||||||
| // negation, to preserve the location. | ||||||
| if (!WideCmp->getDebugLoc()) | ||||||
|
||||||
| if (!WideCmp->getDebugLoc()) | |
| if (!WideCmp->getDebugLoc() && R.getDebugLoc()) |
?
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.
Recipe expected to have a predicate, which this method replaces?
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.
I presume this was meant to mirror the LLVM IR method in
CmpInst::setPredicate. Is it a thing where we try to keep the methods onVPRecipein sync with theirInstructioncounterparts?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.
Yep this was to mirror the corresponding API at CmpInst.