RFR: 8296545: C2 Blackholes should allow load optimizations [v2]

Andrew Dinn adinn at openjdk.org
Wed Nov 9 13:54:26 UTC 2022


On Wed, 9 Nov 2022 11:56:43 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/hotspot/share/opto/library_call.cpp line 7790:
>> 
>>> 7788:   MemBarNode* mb = MemBarNode::make(C, Op_Blackhole);
>>> 7789:   mb->init_req(TypeFunc::Control, control());
>>> 7790:   mb->init_req(TypeFunc::Memory,  mem);
>> 
>> Does it need memory at all? In other words, is `Blackhole` still a `MemBar` or can it become a pure control node now?
>
> That's a good question. I don't think it needs memory. I disconnected the input memory in new commit as well, and all tests seem fine. This also allows to simplify anti-dependence logic, as `Blackhole` does not have the asymmetry of "takes memory, but does not produce it" anymore.
> 
> AFAICS, `Blackhole` being a subclass of `MemBar` helps to avoid additional checks in other places in compiler, where we can test for `is_MemBar`. I can see if we can move `Blackhole` out of `MemBar` class without messing things up.

Yeah, I also cannot see why it would need the memory input so long as it has the data dependency.

The key question is whether it's status as a membar is stopping things being re-ordered around it. Changing it's type might immediately show a problem ... or it might not (the problem with a 'suck it and see' approach is that you need to be sure you have sucked every type of sweetie in the sweet tin).

-------------

PR: https://git.openjdk.org/jdk/pull/11041


More information about the hotspot-compiler-dev mailing list