RFR: 8262837: handle split_USE correctly [v2]

kuaiwei github.com+1981974+kuaiwei at openjdk.java.net
Wed Mar 3 08:12:32 UTC 2021


On Wed, 3 Mar 2021 01:30:47 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> kuaiwei has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8262837: handle split_USE correctly
>
> src/hotspot/share/opto/reg_split.cpp line 230:
> 
>> 228:         }
>> 229:         // insert into basic block
>> 230:         insert_proj( b, bindex, spill, maxlrg++ );
> 
> Do we need `maxlrg` post-increment here with this change?

Remove the post-increment.

> src/hotspot/share/opto/reg_split.cpp line 279:
> 
>> 277:   // Insert SpillCopy before the USE, which uses the reaching DEF as
>> 278:   // its input, and defs a new live range, which is used by this node.
>> 279:   insert_proj( b, bindex, spill, maxlrg++ );
> 
> `maxlrg++`  again

Remove post-increment

> src/hotspot/share/opto/reg_split.cpp line 1106:
> 
>> 1104:                   const RegMask* tmp_rm = Matcher::idealreg2regmask[def_ideal];
>> 1105:                   Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, def, dmask, *tmp_rm);
>> 1106:                   insert_proj( b, insidx, spill, maxlrg );
> 
> I think it missed `maxlrg` increment. May be also use `insidx++` here so in the following code you need to increment only by `delta`.

added maxlrg++ and insidx++, the following insidx is added with delta

> src/hotspot/share/opto/reg_split.cpp line 501:
> 
>> 499:   uint                 bidx, pidx, slidx, insidx, inpidx, twoidx;
>> 500:   uint                 non_phi = 1, spill_cnt = 0;
>> 501:   int                  delta;
> 
> I think it should be local variable where it is used.

changed to local variable.

> src/hotspot/share/opto/reg_split.cpp line 283:
> 
>> 281:   use->set_req(useidx,spill);
>> 282: 
>> 283:   // return generated node count
> 
> The comment is confusing. I would suggest to add comment at the header of this method to describe all returned values [-1, 0, 1].

Add comment in method header of split_USE and remove this comment.

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

PR: https://git.openjdk.java.net/jdk/pull/2791


More information about the hotspot-compiler-dev mailing list