-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8347901: C2 should remove unused leaf / pure runtime calls #25760
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
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 |
|---|---|---|
|
|
@@ -913,6 +913,17 @@ class CallLeafNode : public CallRuntimeNode { | |
| #endif | ||
| }; | ||
|
|
||
| /* A pure function call, they are assumed not to be safepoints, not to read or write memory, | ||
| * have no exception... They just take parameters, return a value without side effect. It is | ||
| * always correct to create some, or remove them, if the result is not used. | ||
| * | ||
| * They still have control input to allow easy lowering into other kind of calls that require | ||
| * a control, but this is more a technical than a moral constraint. | ||
| * | ||
| * Pure calls must have only control and data input and output: I/O, Memory and so on must be top. | ||
| * Nevertheless, pure calls can typically be expensive math operations so care must be taken | ||
| * when letting the node float. | ||
| */ | ||
| class CallLeafPureNode : public CallLeafNode { | ||
|
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. You need a short description about what this node is for. What are the assumptions about it? |
||
| protected: | ||
| bool is_unused() const; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1517,19 +1517,17 @@ const Type* UModLNode::Value(PhaseGVN* phase) const { | |
| } | ||
|
|
||
| Node* ModFNode::Ideal(PhaseGVN* phase, bool can_reshape) { | ||
| if (!can_reshape) { | ||
| return nullptr; | ||
| Node* super = CallLeafPureNode::Ideal(phase, can_reshape); | ||
| if (super != nullptr) { | ||
| return super; | ||
|
||
| } | ||
| if (is_dead()) { // dead node | ||
|
|
||
| if (!can_reshape) { | ||
| return nullptr; | ||
| } | ||
|
|
||
| PhaseIterGVN* igvn = phase->is_IterGVN(); | ||
|
|
||
| if (is_unused()) { | ||
| return make_tuple_of_input_state_and_top_return_values(igvn->C); | ||
| } | ||
|
|
||
| // Either input is TOP ==> the result is TOP | ||
| const Type* t1 = phase->type(dividend()); | ||
| const Type* t2 = phase->type(divisor()); | ||
|
|
@@ -1571,19 +1569,17 @@ Node* ModFNode::Ideal(PhaseGVN* phase, bool can_reshape) { | |
| } | ||
|
|
||
| Node* ModDNode::Ideal(PhaseGVN* phase, bool can_reshape) { | ||
| if (!can_reshape) { | ||
| return nullptr; | ||
| Node* super = CallLeafPureNode::Ideal(phase, can_reshape); | ||
| if (super != nullptr) { | ||
| return super; | ||
| } | ||
| if (is_dead()) { // dead node | ||
|
|
||
| if (!can_reshape) { | ||
| return nullptr; | ||
| } | ||
|
|
||
| PhaseIterGVN* igvn = phase->is_IterGVN(); | ||
|
|
||
| if (is_unused()) { | ||
| return make_tuple_of_input_state_and_top_return_values(igvn->C); | ||
| } | ||
|
|
||
| // Either input is TOP ==> the result is TOP | ||
| const Type* t1 = phase->type(dividend()); | ||
| const Type* t2 = phase->type(divisor()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.