RFR(S): 8213419: C2 may hang in MulLNode::Ideal()/MulINode::Ideal() with gcc 8.2.1

dean.long at oracle.com dean.long at oracle.com
Fri Nov 9 10:28:42 UTC 2018


It looks like log2_intptr() here is converting bit1 from unsigned to signed:

200 unsigned int bit1 = abs_con & -abs_con; // Extract low bit
201 if (bit1 == abs_con) { // Found a power of 2?
202 res = new LShiftINode(in(1), phase->intcon(log2_intptr(bit1)));

and bit1 can be 0x80000000 unless I'm missing something.  If INT_MIN
is the only problem, can we just have special handling for INT_MIN, and
leave the rest of the code unchanged:

     if (con == INT_MIN) {
         ...
         return ...
     }

     bool sign_flip = false;
if( con < 0 ) {
con = -con;

       sign_flip = true;
     }
[...]

On 11/9/18 1:33 AM, Roland Westrelin wrote:
> Hi Dean,
>
>> jint abs_con = uabs(con);
>>
>>
>> if the unsigned value is too big to fit in a signed int?
> Yes, you must be right. So move all computations to unsigned:
>
> http://cr.openjdk.java.net/~roland/8213419/webrev.01/
>
> ?
>
> Roland.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20181109/097a574c/attachment-0001.html>


More information about the hotspot-compiler-dev mailing list