-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[DAGCombiner][RISCV] Add target hook to decide hoisting LogicOp with extension #136677
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 2 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 |
|---|---|---|
|
|
@@ -4462,6 +4462,16 @@ class TargetLowering : public TargetLoweringBase { | |
| return false; | ||
| } | ||
|
|
||
| /// Return true if it is profitable to hoist a LogicOp where both operands | ||
| /// have the same extension op. This transformation may not be desirable if | ||
| /// it disrupts a particularly auspicious target-specific tree (e.g. | ||
| /// (or disjoint (zext A), (zext B)) -> vwaddu.wv on RISC-V). By default it | ||
| /// returns true. | ||
| virtual bool isDesirableToHoistLogicOpWithExt(const SDNode *LogicOp, | ||
| unsigned ExtOp) const { | ||
| return true; | ||
| } | ||
|
Comment on lines
+4470
to
+4473
Contributor
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. Can't you just select on the hoisted form of the pattern
Contributor
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. See #136716 |
||
|
|
||
| /// Return true if the target supports swifterror attribute. It optimizes | ||
| /// loads and stores to reading and writing a specific register. | ||
| virtual bool supportSwiftError() const { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19893,6 +19893,14 @@ bool RISCVTargetLowering::isDesirableToCommuteWithShift( | |
| return true; | ||
| } | ||
|
|
||
| bool RISCVTargetLowering::isDesirableToHoistLogicOpWithExt( | ||
| const SDNode *LogicOp, unsigned ExtOp) const { | ||
| if ((ExtOp == ISD::ZERO_EXTEND || ExtOp == ISD::SIGN_EXTEND) && | ||
| NodeExtensionHelper::isSupportedRoot(LogicOp, Subtarget)) | ||
| return false; | ||
| return true; | ||
|
Comment on lines
+19898
to
+19901
Member
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. maybe combine this into a single return? |
||
| } | ||
|
|
||
| bool RISCVTargetLowering::targetShrinkDemandedConstant( | ||
| SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, | ||
| TargetLoweringOpt &TLO) const { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.