[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 Peter Bergner changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #23 from Peter Bergner --- (In reply to Vladimir Makarov from comment #21) > (In reply to Jakub Jelinek from comment #20) > > That LGTM, but Vlad is the maintainer here... > > It looks ok for me too. Ok, the above patch bootstrapped with no errors and the testsuite run showed no regressions compared to the commit before Vlad's patch, so I pushed the fix as approved. Thanks for everyone's help!
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #22 from CVS Commits --- The master branch has been updated by Peter Bergner : https://gcc.gnu.org/g:44a13125a0d56dbabb9bc61de7ff8bf94fb57928 commit r13-6745-g44a13125a0d56dbabb9bc61de7ff8bf94fb57928 Author: Peter Bergner Date: Fri Mar 17 19:01:45 2023 -0500 lra: Ignore debug insns and notes in combine_reload_insn [PR109179] We ICE in combine_reload_insn if we've deleted the TO insn operand during processing, because lra_get_insn_recog_data doesn't expect to see the note that replaces the deleted insn. The solution here is to exit early if TO is a debug insn or note. 2023-03-17 Peter Bergner gcc/ PR rtl-optimization/109179 * lra-constraints.cc (combine_reload_insn): Enforce TO is not a debug insn or note. Move the tests earlier to guard lra_get_insn_recog_data.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #21 from Vladimir Makarov --- (In reply to Jakub Jelinek from comment #20) > That LGTM, but Vlad is the maintainer here... It looks ok for me too.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #20 from Jakub Jelinek --- That LGTM, but Vlad is the maintainer here...
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #19 from Peter Bergner --- (In reply to Peter Bergner from comment #18) > (In reply to Jakub Jelinek from comment #16) > > Can't you move all the tests that don't need id or static_id (all but one) > > before the > > lra_insn_recog_data_t id = lra_get_insn_recog_data (to); > > struct lra_static_insn_data *static_id = id->insn_static_data; > > instead? > > Ok, single_set is also a call, so maybe keep that one too? > > > > I know, microoptimizations... > > Looking at lra_get_insn_recog_data() versus the common case for > single_set(), I think moving the single_set() call earlier is fine too, and > it simplifies the final code with just the one early out tests rather than > splitting them up. Ah, nevermind, we have the "|| id->used_insn_alternative == LRA_UNKNOWN_ALT" which we can't move. Then I'll keep the single_set() close to it's use of the result just after. How about this? --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -5014,14 +5014,19 @@ combine_reload_insn (rtx_insn *from, rtx_insn *to) enum reg_class to_class, from_class; int n, nop; signed char changed_nops[MAX_RECOG_OPERANDS + 1]; - lra_insn_recog_data_t id = lra_get_insn_recog_data (to); - struct lra_static_insn_data *static_id = id->insn_static_data; /* Check conditions for second memory reload and original insn: */ if ((targetm.secondary_memory_needed == hook_bool_mode_reg_class_t_reg_class_t_false) - || NEXT_INSN (from) != to || CALL_P (to) - || id->used_insn_alternative == LRA_UNKNOWN_ALT + || NEXT_INSN (from) != to + || !NONDEBUG_INSN_P (to) + || CALL_P (to)) +return false; + + lra_insn_recog_data_t id = lra_get_insn_recog_data (to); + struct lra_static_insn_data *static_id = id->insn_static_data; + + if (id->used_insn_alternative == LRA_UNKNOWN_ALT || (set = single_set (from)) == NULL_RTX) return false; from_reg = SET_DEST (set);
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #18 from Peter Bergner --- (In reply to Jakub Jelinek from comment #16) > Can't you move all the tests that don't need id or static_id (all but one) > before the > lra_insn_recog_data_t id = lra_get_insn_recog_data (to); > struct lra_static_insn_data *static_id = id->insn_static_data; > instead? > Ok, single_set is also a call, so maybe keep that one too? > > I know, microoptimizations... Looking at lra_get_insn_recog_data() versus the common case for single_set(), I think moving the single_set() call earlier is fine too, and it simplifies the final code with just the one early out tests rather than splitting them up.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #17 from Peter Bergner --- (In reply to Jakub Jelinek from comment #16) > Can't you move all the tests that don't need id or static_id (all but one) > before the > lra_insn_recog_data_t id = lra_get_insn_recog_data (to); > struct lra_static_insn_data *static_id = id->insn_static_data; > instead? > Ok, single_set is also a call, so maybe keep that one too? > > I know, microoptimizations... I can do that after my current run is done. I just wanted to verify the one test was enough to fix the ICE and wasn't looking closely at what all could be moved earlier.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #16 from Jakub Jelinek --- Can't you move all the tests that don't need id or static_id (all but one) before the lra_insn_recog_data_t id = lra_get_insn_recog_data (to); struct lra_static_insn_data *static_id = id->insn_static_data; instead? Ok, single_set is also a call, so maybe keep that one too? I know, microoptimizations...
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #15 from Peter Bergner --- (In reply to Vladimir Makarov from comment #14) > Peter, sorry for troubles and thank you for working on it. The patch is ok > for me. Could you commit the patch if the bootstrap is ok. Will do and no problem. I'll also compare the testsuite results to the testsuite results from the commit before yours, just to be sure no other non-ICE errors crept in.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #14 from Vladimir Makarov --- (In reply to Peter Bergner from comment #13) > (In reply to Peter Bergner from comment #12) > > I'll try moving the test up earlier and testing with that. > > So this fixes the ICEs on the two test cases above. I'll try a full > bootstrap with it. > > --- a/gcc/lra-constraints.cc > +++ b/gcc/lra-constraints.cc > @@ -5014,6 +5014,10 @@ combine_reload_insn (rtx_insn *from, rtx_insn *to) >enum reg_class to_class, from_class; >int n, nop; >signed char changed_nops[MAX_RECOG_OPERANDS + 1]; > + > + if (!NONDEBUG_INSN_P (to)) > +return false; > + >lra_insn_recog_data_t id = lra_get_insn_recog_data (to); >struct lra_static_insn_data *static_id = id->insn_static_data; Peter, sorry for troubles and thank you for working on it. The patch is ok for me. Could you commit the patch if the bootstrap is ok.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #13 from Peter Bergner --- (In reply to Peter Bergner from comment #12) > I'll try moving the test up earlier and testing with that. So this fixes the ICEs on the two test cases above. I'll try a full bootstrap with it. --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -5014,6 +5014,10 @@ combine_reload_insn (rtx_insn *from, rtx_insn *to) enum reg_class to_class, from_class; int n, nop; signed char changed_nops[MAX_RECOG_OPERANDS + 1]; + + if (!NONDEBUG_INSN_P (to)) +return false; + lra_insn_recog_data_t id = lra_get_insn_recog_data (to); struct lra_static_insn_data *static_id = id->insn_static_data;
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #12 from Peter Bergner --- (In reply to Jakub Jelinek from comment #7) > So perhaps: > --- gcc/lra-constraints.cc.jj 2023-03-17 16:09:09.162136438 +0100 > +++ gcc/lra-constraints.cc2023-03-17 21:37:04.799285670 +0100 > @@ -5020,7 +5020,9 @@ combine_reload_insn (rtx_insn *from, rtx >/* Check conditions for second memory reload and original insn: */ >if ((targetm.secondary_memory_needed > == hook_bool_mode_reg_class_t_reg_class_t_false) > - || NEXT_INSN (from) != to || CALL_P (to) > + || NEXT_INSN (from) != to > + || !NONDEBUG_INSN_P (to) > + || CALL_P (to) >|| id->used_insn_alternative == LRA_UNKNOWN_ALT >|| (set = single_set (from)) == NULL_RTX) > return false; > ? This doesn't work as is, since the ICE is occurring on code before we get here in the function. Specifically here: lra_insn_recog_data_t id = lra_get_insn_recog_data (to); I'll try moving the test up earlier and testing with that.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #11 from Jakub Jelinek --- But in this case it has been removed in between: #0 set_insn_deleted (insn=0x7fffea13a340) at ../../gcc/emit-rtl.cc:4257 #1 0x00ac7d3e in lra_set_insn_deleted (insn=0x7fffea13a340) at ../../gcc/lra.cc:263 #2 0x00ad8de8 in check_and_process_move (change_p=0x7fffd26f, sec_mem_p=0x7fffd26e) at ../../gcc/lra-constraints.cc:1400 #3 0x00ae0034 in curr_insn_transform (check_only_p=false) at ../../gcc/lra-constraints.cc:4130 #4 0x00ae41d3 in lra_constraints (first_p=true) at ../../gcc/lra-constraints.cc:5314
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #10 from Peter Bergner --- (In reply to Jakub Jelinek from comment #7) > So perhaps: > --- gcc/lra-constraints.cc.jj 2023-03-17 16:09:09.162136438 +0100 > +++ gcc/lra-constraints.cc2023-03-17 21:37:04.799285670 +0100 > @@ -5020,7 +5020,9 @@ combine_reload_insn (rtx_insn *from, rtx >/* Check conditions for second memory reload and original insn: */ >if ((targetm.secondary_memory_needed > == hook_bool_mode_reg_class_t_reg_class_t_false) > - || NEXT_INSN (from) != to || CALL_P (to) > + || NEXT_INSN (from) != to > + || !NONDEBUG_INSN_P (to) > + || CALL_P (to) >|| id->used_insn_alternative == LRA_UNKNOWN_ALT >|| (set = single_set (from)) == NULL_RTX) > return false; > ? I can give this try. Although it would be good to know from Vlad whether it's invalid to ever pass a debug insn to combine_reload_insn() or not.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #9 from Vladimir Makarov --- (In reply to Jakub Jelinek from comment #7) > So perhaps: > --- gcc/lra-constraints.cc.jj 2023-03-17 16:09:09.162136438 +0100 > +++ gcc/lra-constraints.cc2023-03-17 21:37:04.799285670 +0100 > @@ -5020,7 +5020,9 @@ combine_reload_insn (rtx_insn *from, rtx >/* Check conditions for second memory reload and original insn: */ >if ((targetm.secondary_memory_needed > == hook_bool_mode_reg_class_t_reg_class_t_false) > - || NEXT_INSN (from) != to || CALL_P (to) > + || NEXT_INSN (from) != to > + || !NONDEBUG_INSN_P (to) > + || CALL_P (to) >|| id->used_insn_alternative == LRA_UNKNOWN_ALT >|| (set = single_set (from)) == NULL_RTX) > return false; > ? Yes, that is what I am trying to do. For me only question why is LRA works there on notes. LRA pushes only real insns to work stack.
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #8 from Peter Bergner --- Here's another creduced test case, this one with -O2 optimization: bergner@ltcden2-lp1:PR109179$ cat bug2.i union u { _Float128 flt; long sign; }; _Float128 foo (long src) { union u var; var.sign = src; return var.flt; } bergner@ltcden2-lp1:PR109179$ gcc -S -O2 -mcpu=power8 bug2.i during RTL pass: reload bug2.i: In function ‘foo’: bug2.i:13:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx note) in PATTERN, at rtl.h:1509 13 | } | ^ 0x1148c663 rtl_check_failed_type2(rtx_def const*, int, int, int, char const*, int, char const*) /home/bergner/gcc/gcc-fsf-mainline-chip-ice/gcc/rtl.cc:907 0x10a0a207 PATTERN(rtx_def*) /home/bergner/gcc/gcc-fsf-mainline-chip-ice/gcc/rtl.h:1509 0x1278c123 insn_extract(rtx_insn*) /home/bergner/gcc/build/gcc-fsf-mainline-chip-ice-regtest/gcc/insn-extract.cc:23 0x1118c9e7 lra_set_insn_recog_data(rtx_insn*) /home/bergner/gcc/gcc-fsf-mainline-chip-ice/gcc/lra.cc:1059 0x11194f23 lra_get_insn_recog_data(rtx_insn*) /home/bergner/gcc/gcc-fsf-mainline-chip-ice/gcc/lra-int.h:493 0x111b8de7 combine_reload_insn /home/bergner/gcc/gcc-fsf-mainline-chip-ice/gcc/lra-constraints.cc:5017
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 --- Comment #7 from Jakub Jelinek --- So perhaps: --- gcc/lra-constraints.cc.jj 2023-03-17 16:09:09.162136438 +0100 +++ gcc/lra-constraints.cc 2023-03-17 21:37:04.799285670 +0100 @@ -5020,7 +5020,9 @@ combine_reload_insn (rtx_insn *from, rtx /* Check conditions for second memory reload and original insn: */ if ((targetm.secondary_memory_needed == hook_bool_mode_reg_class_t_reg_class_t_false) - || NEXT_INSN (from) != to || CALL_P (to) + || NEXT_INSN (from) != to + || !NONDEBUG_INSN_P (to) + || CALL_P (to) || id->used_insn_alternative == LRA_UNKNOWN_ALT || (set = single_set (from)) == NULL_RTX) return false; ?
[Bug rtl-optimization/109179] [13 Regression] addkf3-sw.c:51:1: internal compiler error: RTL check: expected elt 3 type 'e' or 'u', have '0'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109179 Andrew Pinski changed: What|Removed |Added Severity|normal |blocker Keywords||build, ice-on-valid-code Summary|addkf3-sw.c:51:1: internal |[13 Regression] |compiler error: RTL check: |addkf3-sw.c:51:1: internal |expected elt 3 type 'e' or |compiler error: RTL check: |'u', have '0' |expected elt 3 type 'e' or ||'u', have '0'