[Bug rtl-optimization/58679] [4.9 regression] ICE in create_pre_exit, at mode-switching.c:421 with -mavx after r202915
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Oct 26 07:38:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58679
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-10-26
Host|x86 |
Ever confirmed|0 |1
--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
The patch at [1] now removes useless moves in the exit bb. This change breaks
assumption in the mode-switching pass that all USEs of return values have a
corresponding simple return value copy somewhere up in the insn stream.
The testcase:
--cut here--
typedef long long __m128i __attribute__ ((__vector_size__ (16)));
typedef char __v16qi __attribute__ ((__vector_size__ (16)));
__m128i _mm_cmpistrm (__m128i __X, __m128i __Y, const int __M)
{
return (__m128i) __builtin_ia32_pcmpistrm128((__v16qi)__X, (__v16qi)__Y, 1);
}
--cut here--
Before the above change, RA generated:
(insn 2 6 3 2 (set (reg/v:V2DI 21 xmm0 [orig:92 __X ] [92])
(reg:V2DI 21 xmm0 [ __X ])) tt.c:6 1156 {*movv2di_internal}
(nil))
(note 3 2 5 2 NOTE_INSN_DELETED)
(note 5 3 20 2 NOTE_INSN_FUNCTION_BEG)
(insn 20 5 14 2 (parallel [
(set (reg:V16QI 21 xmm0 [95])
(unspec:V16QI [
(reg:V16QI 21 xmm0 [orig:92 __X ] [92])
(reg:V16QI 22 xmm1 [ __Y ])
(const_int 1 [0x1])
] UNSPEC_PCMPISTR))
(set (reg:CC 17 flags)
(unspec:CC [
(reg:V16QI 21 xmm0 [orig:92 __X ] [92])
(reg:V16QI 22 xmm1 [ __Y ])
(const_int 1 [0x1])
] UNSPEC_PCMPISTR))
]) tt.c:7 1979 {sse4_2_pcmpistrm}
(nil))
(insn 14 20 17 2 (set (reg/i:V2DI 21 xmm0)
(reg:V2DI 21 xmm0 [95])) tt.c:8 1156 {*movv2di_internal}
(nil))
(insn 17 14 21 2 (use (reg/i:V2DI 21 xmm0)) tt.c:8 -1
(nil))
Please note useless (insn 14), expected by mode switching pass (this insn was
actually removed by later passes). After the change, following insn stream is
generated:
(insn 20 5 17 2 (parallel [
(set (reg:V16QI 21 xmm0 [95])
(unspec:V16QI [
(reg:V16QI 21 xmm0 [orig:92 __X ] [92])
(reg:V16QI 22 xmm1 [ __Y ])
(const_int 1 [0x1])
] UNSPEC_PCMPISTR))
(set (reg:CC 17 flags)
(unspec:CC [
(reg:V16QI 21 xmm0 [orig:92 __X ] [92])
(reg:V16QI 22 xmm1 [ __Y ])
(const_int 1 [0x1])
] UNSPEC_PCMPISTR))
]) tt.c:7 1979 {sse4_2_pcmpistrm}
(nil))
(insn 17 20 21 2 (use (reg/i:V2DI 21 xmm0)) tt.c:8 -1
(nil))
There is no return value copy insn.
The assumption in the mode switching pass, that there is a return value copy is
not correct anymore, due to recent enhancements in the RA. The mode switching
pass should perform life analysis by itself. Simply looking for a return copy
is not correct anymore.
Confirmed by above testcase.
More information about the Gcc-bugs
mailing list