Bug 111478 - [12 Regression] aarch64 SVE ICE: in compute_live_loop_exits, at tree-ssa-loop-manip.cc:250
Summary: [12 Regression] aarch64 SVE ICE: in compute_live_loop_exits, at tree-ssa-loop...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 14.0
: P2 normal
Target Milestone: 12.4
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2023-09-19 13:29 UTC by nsz
Modified: 2024-03-01 13:54 UTC (History)
3 users (show)

See Also:
Host:
Target: aarch64
Build:
Known to work: 12.2.0, 13.2.1, 14.0
Known to fail: 12.3.0, 13.1.0, 13.2.0
Last reconfirmed: 2023-11-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nsz 2023-09-19 13:29:39 UTC
$ cat bug.c
float a, d, e, f, g;
int b, c;
void h() {
  for (; b; b++) {
    for (; c;) {
      float i = d = i;
    }
    a += f - e * g;
    a += g + e * f;
  }
}


$ gcc -c -O3 -march=armv8-a+sve bug.c
during GIMPLE pass: vect
<source>: In function 'h':
<source>:3:6: internal compiler error: in compute_live_loop_exits, at tree-ssa-loop-manip.cc:250
    3 | void h() {
      |      ^
0x1168eb4 compute_live_loop_exits
	/data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:250
0x1168eb4 add_exit_phis_var
	/data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:332
0x1168eb4 add_exit_phis
	/data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:393
0x1168eb4 rewrite_into_loop_closed_ssa_1
	/data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:606
0x1168eb4 rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int)
	/data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:628
0x130a1e8 execute
	/data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-vectorizer.cc:1358
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
Comment 1 nsz 2023-09-19 13:36:55 UTC
see also bug 111479
Comment 2 Richard Biener 2023-09-19 14:30:05 UTC
Confirmed.  We have a two-operator operation in the preheader instead of in the loop body.  IIRC we have a duplicate for this, this is all invariant operations and we get confused applying loop masking to it somehow.
Comment 3 ktkachov 2023-09-27 10:10:01 UTC
Marking as P1. We hit this with a Fortran reproducer:
      SUBROUTINE REPRODUCER( M, A, LDA )
      IMPLICIT NONE
      INTEGER            LDA, M, I
      COMPLEX            A( LDA, * )
      DO I = 2, M
        A( I, 1 ) = A( I, 1 ) / A( 1, 1 )
      END DO
      RETURN
      END

on aarch64 with -march=armv8-a+sve -O3
The ICE triggeres on 12.3 but compiles fine wiht 12.2
Comment 4 Andrew Pinski 2023-12-05 22:50:28 UTC
I can't reproduce either of the testcases here any more .
Comment 5 Andrew Pinski 2023-12-05 22:51:28 UTC
(In reply to Andrew Pinski from comment #4)
> I can't reproduce either of the testcases here any more .

I should say on the trunk.
Comment 6 Richard Biener 2024-01-17 12:38:55 UTC
Fixed by r14-5320-ge5f1956498251a4973d52c8aad3faf34d0443169, I'll take that for backporting.
Comment 7 Richard Biener 2024-02-06 13:22:56 UTC
Backported to GCC 13.
Comment 8 Saurabh Jha 2024-02-07 10:29:12 UTC
Hi Richard,

Are you also planning to backport it to gcc-12?

Regards,
Saurabh
Comment 9 Richard Biener 2024-02-07 10:44:28 UTC
(In reply to Saurabh Jha from comment #8)
> Hi Richard,
> 
> Are you also planning to backport it to gcc-12?

Yes.
Comment 10 avieira 2024-03-01 13:46:51 UTC
This has now been backported to gcc-13 and gcc-12, so I think we should close, will leave that to Richard.
Comment 11 Richard Biener 2024-03-01 13:54:35 UTC
Fixed.