RFR(M): 8220376: C2: Int >0 not recognized as !=0 for div by 0 check
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Tue Nov 26 15:04:17 UTC 2019
>>
>> + if (is_If() && (cmp = in(1)->in(1))->Opcode() == Op_CmpP) {
>> + if (cmp->in(2) != NULL && // make sure cmp is not already dead
>> + cmp->in(2)->bottom_type() == TypePtr::NULL_PTR) {
>>
>> Merge nested ifs?
>>
> I to have problems with this part but for other reasons. What about: (?)
>
> - Node* cmp;
> int dist = 4; // Cutoff limit for search
> - if (is_If() && (cmp = in(1)->in(1))->Opcode() == Op_CmpP) {
> - if (cmp->in(2) != NULL && // make sure cmp is not already dead
> + if (is_If() && in(1)->is_Bool()) {
> + Node* cmp = in(1)->in(1);
> + if (cmp->Opcode() == Op_CmpP &&
> + cmp->in(2) != NULL && // make sure cmp is not already dead
Looks even better.
Best regards,
Vladimir Ivanov
>> Looks like extracting the following code into a helper function (along
>> with the enum and the table) can improve readability.
>>
>> + int drel = subsuming_bool_test_encode(dom->in(1));
>> + int trel = subsuming_bool_test_encode(bol);
>> + int bout = pre->is_IfFalse() ? 1 : 0;
>> +
>> + if (drel < 0 || trel < 0) {
>> + return NULL;
>> + }
>> + int br = s_subsume_map[trel][2*drel+bout];
>> + if (br == na) {
>> + return NULL;
>> + }
>>
>> New function can return intcon(0/1) or bol(or NULL?) and the caller
>> decides whether the update is needed.
>>
>>> On 12/11/2019 15:16, Patric Hedlin wrote:
>>>> Dear all,
>>>>
>>>> I would like to ask for help to review the following change/update:
>>>>
>>>> Issue: https://bugs.openjdk.java.net/browse/JDK-8220376
>>>> Webrev: http://cr.openjdk.java.net/~phedlin/tr8220376/
>>>>
>>>> 8220376: C2: Int >0 not recognized as !=0 for div by 0 check
>>>>
>>>> Adding a simple subsumption test to IfNode::Ideal to enable a local
>>>> short-circuit for (obviously) redundant if-nodes.
>>>>
>>>> Testing: hs-tier1-4, hs-precheckin-comp
>>>>
>>>>
>>>> Best regards,
>>>> Patric
>
More information about the hotspot-compiler-dev
mailing list