RFR: 8290432: C2 compilation fails with assert(node->_last_del == _last) failed: must have deleted the edge just produced
Vladimir Kozlov
kvn at openjdk.org
Thu Aug 4 17:30:59 UTC 2022
On Sun, 31 Jul 2022 09:28:59 GMT, Yi Yang <yyang at openjdk.org> wrote:
> Hi, can I have a review for this patch? [JDK-8273585](https://bugs.openjdk.org/browse/JDK-8273585) recognized the form of `Phi->CastII->AddI` as additional parallel induction variables. In the following program:
>
> class Test {
> static int dontInline() {
> return 0;
> }
>
> static long test(int val, boolean b) {
> long ret = 0;
> long dArr[] = new long[100];
> for (int i = 15; 293 > i; ++i) {
> ret = val;
> int j = 1;
> while (++j < 6) {
> int k = (val--);
> for (long l = i; 1 > l; ) {
> if (k != 0) {
> ret += dontInline();
> }
> }
> if (b) {
> break;
> }
> }
> }
> return ret;
> }
>
> public static void main(String[] args) {
> for (int i = 0; i < 1000; i++) {
> test(0, false);
> }
> }
> }
>
> `val` is incorrectly matched with the new parallel IV form:
> 
> And C2 further replaces it with newly added nodes, which finally leads the crash:
> 
>
> I think we can add more constraints to the new form. The form of `Phi->CastXX->AddX` appears when using Preconditions.checkIndex, and it would be recognized as additional IV when 1) Phi != phi2, 2) CastXX is controlled by RangeCheck(to reflect changes in Preconditions checkindex intrinsic)
>From your test I assume internal loop `for (long l=` is processed. But `val` is updated outside it. Its `AddI` node should not be part of loop's body. Could you explain?
src/hotspot/share/opto/loopnode.cpp line 3679:
> 3677: incr2->Opcode() != Op_AddI ||
> 3678: !incr2->in(2)->is_Con())
> 3679: continue;
Since you touch near code, please update style in these lines too to use `{}`.
src/hotspot/share/opto/loopnode.cpp line 3682:
> 3680:
> 3681: if (incr2->in(1)->is_ConstraintCast()) {
> 3682: if (!incr2->in(1)->in(0)->is_RangeCheck()) {
You can use `&&` instead of nested condition.
-------------
PR: https://git.openjdk.org/jdk/pull/9695
More information about the hotspot-compiler-dev
mailing list