- 
    Bug 
- 
    Resolution: Duplicate
- 
     P4 P4
- 
    19
                    SonarCloud reports: "code will never be executed" in compress_expand_identity
Node* compress_expand_identity(PhaseGVN* phase, Node* n) {
BasicType bt = n->bottom_type()->basic_type();
// compress(x, 0) == 0, expand(x, 0) == 0
if(phase->type(n->in(2))->higher_equal(TypeInteger::zero(bt))) return n->in(2);
// compress(x, -1) == x, expand(x, -1) == x
if(phase->type(n->in(2))->higher_equal(TypeInteger::minus_1(bt))) return n->in(1);
return n;
// DEAD CODE FOLLOWS:
// expand(-1, x) == x
if(n->Opcode() == Op_ExpandBits &&
phase->type(n->in(1))->higher_equal(TypeInteger::minus_1(bt))) return n->in(2);
return n;
}
Note how "return n" is unconditional, which makes the rest of the code dead.
Node* compress_expand_identity(PhaseGVN* phase, Node* n) {
BasicType bt = n->bottom_type()->basic_type();
// compress(x, 0) == 0, expand(x, 0) == 0
if(phase->type(n->in(2))->higher_equal(TypeInteger::zero(bt))) return n->in(2);
// compress(x, -1) == x, expand(x, -1) == x
if(phase->type(n->in(2))->higher_equal(TypeInteger::minus_1(bt))) return n->in(1);
return n;
// DEAD CODE FOLLOWS:
// expand(-1, x) == x
if(n->Opcode() == Op_ExpandBits &&
phase->type(n->in(1))->higher_equal(TypeInteger::minus_1(bt))) return n->in(2);
return n;
}
Note how "return n" is unconditional, which makes the rest of the code dead.
- duplicates
- 
                    JDK-8287851 C2 crash: assert(t->meet(t0) == t) failed: Not monotonic -           
- Resolved
 
-         
- relates to
- 
                    JDK-8283894 Intrinsify compress and expand bits on x86 -           
- Resolved
 
-