RFR: 8343148: C2: Refactor uses of "PhaseValue::*con*() + PhaseIdealLoop::set_ctrl()" into separate method [v4]
Vladimir Kozlov
kvn at openjdk.org
Tue Dec 3 18:18:50 UTC 2024
On Mon, 11 Nov 2024 07:38:44 GMT, theoweidmannoracle <duke at openjdk.org> wrote:
>> src/hotspot/share/opto/loopnode.cpp line 3147:
>>
>>> 3145: ConINode* zero = igvn->intcon(0);
>>> 3146: if (iloop != nullptr) {
>>> 3147: iloop->set_root_as_ctrl(zero);
>>
>> Please look on history of this code. This is suspicious - constant nodes should be always attached to Root.
>
> @TobiHartmann Pointed out that this method is also called from code outside of loop opts, for example, `PhaseMacroExpand::expand_macro_nodes`. Since there's no PhaseIdealLoop in this case, nullptr is passed instead and we cannot set control as we are not inside a loop opt.
>
> Maybe @rwestrel can also take a look as he originally introduced this code in [this PR](https://github.com/openjdk/jdk/pull/7364/files#diff-d49652d43244d52415873c37bf6990269b0d6e2f2111f4f971660470b6bca738R2860).
Got it. That is what `(iloop != nullptr)` check for.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21836#discussion_r1868196480
More information about the hotspot-compiler-dev
mailing list