Bug 84845 - [8 Regression] ICE: in extract_insn, at recog.c:2304: unrecognizable insn at -O2 and above at aarch64
Summary: [8 Regression] ICE: in extract_insn, at recog.c:2304: unrecognizable insn at ...
Status: RESOLVED DUPLICATE of bug 84164
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-03-13 12:18 UTC by Zdenek Sojka
Modified: 2018-03-20 10:59 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: aarch64-unknown-linux-gnu
Build:
Known to work: 7.3.1
Known to fail: 8.0
Last reconfirmed: 2018-03-13 00:00:00


Attachments
reduced testcase (108 bytes, text/plain)
2018-03-13 12:18 UTC, Zdenek Sojka
Details
gcc8-pr84845.patch (1.01 KB, patch)
2018-03-13 17:52 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2018-03-13 12:18:17 UTC
Created attachment 43640 [details]
reduced testcase

Compiler output:
$ aarch64-unknown-linux-gnu-gcc -O2 testcase.c
testcase.c: In function 'foo':
testcase.c:9:1: error: unrecognizable insn:
 }
 ^
(insn 30 29 26 2 (set (reg:DI 114)
        (rotatert:DI (reg:DI 115 [ d ])
            (subreg:QI (and:SI (reg:SI 118)
                    (const_int 65535 [0xffff])) 0))) "testcase.c":8 -1
     (expr_list:REG_DEAD (reg:SI 118)
        (expr_list:REG_DEAD (reg:DI 115 [ d ])
            (nil))))
during RTL pass: sched1
testcase.c:9:1: internal compiler error: in extract_insn, at recog.c:2304
0x5b87a4 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        /repo/gcc-trunk/gcc/rtl-error.c:108
0x5b8828 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /repo/gcc-trunk/gcc/rtl-error.c:116
0xbbd41c extract_insn(rtx_insn*)
        /repo/gcc-trunk/gcc/recog.c:2304
0xa68ad7 scan_one_insn
        /repo/gcc-trunk/gcc/ira-costs.c:1449
0xa68ad7 process_bb_for_costs
        /repo/gcc-trunk/gcc/ira-costs.c:1613
0xa696c4 find_costs_and_classes
        /repo/gcc-trunk/gcc/ira-costs.c:1720
0xa6abaa ira_set_pseudo_classes(bool, _IO_FILE*)
        /repo/gcc-trunk/gcc/ira-costs.c:2267
0x1487e00 alloc_global_sched_pressure_data
        /repo/gcc-trunk/gcc/haifa-sched.c:7157
0x1487e00 sched_init()
        /repo/gcc-trunk/gcc/haifa-sched.c:7314
0x148978d haifa_sched_init()
        /repo/gcc-trunk/gcc/haifa-sched.c:7326
0xc220b9 schedule_insns()
        /repo/gcc-trunk/gcc/sched-rgn.c:3504
0xc22973 schedule_insns()
        /repo/gcc-trunk/gcc/sched-rgn.c:3498
0xc22973 rest_of_handle_sched
        /repo/gcc-trunk/gcc/sched-rgn.c:3717
0xc22973 execute
        /repo/gcc-trunk/gcc/sched-rgn.c:3825
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


$ aarch64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-258459-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/8.0.1/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --with-sysroot=/usr/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu --with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld --with-as=/usr/bin/aarch64-unknown-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-258459-checking-yes-rtl-df-extra-aarch64
Thread model: posix
gcc version 8.0.1 20180312 (experimental) (GCC)
Comment 1 Jakub Jelinek 2018-03-13 16:54:49 UTC
Started with r249774.
Comment 2 Jakub Jelinek 2018-03-13 17:10:19 UTC
First of all, I'd say it is very weird not to include the actual operation name in the instruction name, that is the most important part.

So something like:
--- gcc/config/aarch64/aarch64.md.jj	2018-03-13 00:38:26.000000000 +0100
+++ gcc/config/aarch64/aarch64.md	2018-03-13 18:08:23.513894885 +0100
@@ -4262,7 +4262,7 @@
   [(set_attr "type" "shift_reg")]
 )
 
-(define_insn_and_split "*aarch64_reg_<mode>3_neg_mask2"
+(define_insn_and_split "*aarch64_<optab>_reg_<mode>3_neg_mask2"
   [(set (match_operand:GPI 0 "register_operand" "=&r")
 	(SHIFT:GPI
 	  (match_operand:GPI 1 "register_operand" "r")
@@ -4286,7 +4286,7 @@
   }
 )
 
-(define_insn_and_split "*aarch64_reg_<mode>3_minus_mask"
+(define_insn_and_split "*aarch64_ashl_reg_<mode>3_minus_mask"
   [(set (match_operand:GPI 0 "register_operand" "=&r")
 	(ashift:GPI
 	  (match_operand:GPI 1 "register_operand" "r")
@@ -4333,7 +4333,7 @@
   [(set_attr "type" "shift_reg")]
 )
 
-(define_insn_and_split "*aarch64_reg_<optab>_minus<mode>3"
+(define_insn_and_split "*aarch64_<optab>_reg_minus<mode>3"
   [(set (match_operand:GPI 0 "register_operand" "=&r")
 	(ASHIFT:GPI
 	  (match_operand:GPI 1 "register_operand" "r")
Comment 3 Jakub Jelinek 2018-03-13 17:52:45 UTC
Created attachment 43645 [details]
gcc8-pr84845.patch

Untested fix.
Comment 4 ktkachov 2018-03-14 13:51:41 UTC
Dup.

*** This bug has been marked as a duplicate of bug 84164 ***
Comment 5 Jakub Jelinek 2018-03-20 10:59:58 UTC
Author: jakub
Date: Tue Mar 20 10:59:26 2018
New Revision: 258678

URL: https://gcc.gnu.org/viewcvs?rev=258678&root=gcc&view=rev
Log:
	PR target/84845
	* config/aarch64/aarch64.md (*aarch64_reg_<mode>3_neg_mask2): Rename
	to ...
	(*aarch64_<optab>_reg_<mode>3_neg_mask2): ... this.  If pseudos can't
	be created, use lowpart_subreg of operands[0] rather than operands[0]
	itself.
	(*aarch64_reg_<mode>3_minus_mask): Rename to ...
	(*aarch64_ashl_reg_<mode>3_minus_mask): ... this.
	(*aarch64_<optab>_reg_di3_mask2): Use const_int_operand predicate
	and n constraint instead of aarch64_shift_imm_di and Usd.
	(*aarch64_reg_<optab>_minus<mode>3): Rename to ...
	(*aarch64_<optab>_reg_minus<mode>3): ... this.

	* gcc.c-torture/compile/pr84845.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr84845.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.md
    trunk/gcc/testsuite/ChangeLog