-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[InstCombine] Fold fcmp into select #86482
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
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 |
---|---|---|
|
@@ -8052,6 +8052,8 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) { | |
m_Select(m_Value(), m_Value(X), m_FNeg(m_Deferred(X)))) || | ||
match(LHSI, m_Select(m_Value(), m_FNeg(m_Value(X)), m_Deferred(X))))) | ||
return replaceOperand(I, 0, X); | ||
if (Instruction *NV = FoldOpIntoSelect(I, cast<SelectInst>(LHSI))) | ||
return NV; | ||
break; | ||
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. If both arms are constant, should we allow multiuse select? 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. Yeah, we can relax it in 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. IMO here, we have the argument |
||
case Instruction::PHI: | ||
if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI))) | ||
|
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.
Should we update
constantFoldOperationIntoSelectOperand
to recognizefcmp
?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.
It should be done in a separate patch.
Related patch: https://reviews.llvm.org/D146349