[patch] Fix ICE during RTL expansion at -O1

Eric Botcazou ebotcazou@adacore.com
Thu Mar 21 16:27:00 GMT 2013


Hi,

this fixes an ICE on the mainline at -O1:

eric@polaris:~/gnat/bugs/M129-026> ~/install/gcc/bin/gcc -S p.adb -O
+===========================GNAT BUG DETECTED==============================+
| 4.9.0 20130320 (experimental) [trunk revision 196816] (x86_64-suse-linux) 
GCC error:|
| in expand_assignment, at expr.c:4761                                     |
| Error detected around p.ads:11:9      

  MEM[(struct p__rec &)&ret].d = 0;
  MEM[(struct p__rec &)&ret].b1 = 0;
  _26 = MEM[(struct p__rec &)&ret].d;
  p0.8_27 = (integer) _26;
  _28 = (sizetype) p0.8_27;
  _29 = _28 * 8;
  _30 = _29 + _29;
  _31 = _30 + 8;
  _32 = _31 /[ex] 8;
  MEM[(struct p__rec &)&ret].b2{off: _32 * 8} = 1;

The ICE occurs because ret is put into a register instead of memory (it has
an integral mode) and you cannot have a variable offset within an object in
a register.

But, if you look at the above GIMPLE from .optimized, you'll see that the
offset is actually fixed and that the GIMPLE optimizers weren't powerful
enough to see it.  Ironically enough, the RTL optimizers would have been!

So the attached patch adds a clone of nonoverlapping_component_refs_p from
alias.c to tree-ssa-alias.c to disambiguate the memory accesses.  It also
contains a small tweak to both functions to cater to a LTO-specific quirk.

With it, a bunch of testcases of the vectorization testsuite are optimized
so the patch also contains counter-measures for them.

Tested on x86_64-suse-linux, OK for the mainline?


2013-03-21  Eric Botcazou  <ebotcazou@adacore.com>

	* alias.c (nonoverlapping_component_refs_p): Protect again LTO quirk.
	* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.
	(decl_refs_may_alias_p): Add REF1 and REF2 parameters.
	Use it to disambiguate component references.
	(refs_may_alias_p_1): Adjust call to decl_refs_may_alias_p.


2013-03-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/discr41.ad[sb]: New test.
	* gcc.dg/vect/slp-24-big-array.c: Beef up anti-vectorization trick.
	* gcc.dg/vect/slp-24.c: Likewise.
	* gcc.dg/vect/vect-strided-a-mult.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u16-i2.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u16-i4.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u16-mult.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i2-gap.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Likewise.
	* gcc.dg/vect/vect-strided-mult-char-ls.c: Likewise.
	* gcc.dg/vect/vect-strided-mult.c: Likewise.
	* gcc.dg/vect/vect-strided-same-dr.c: Likewise.
	* gcc.dg/vect/vect-strided-u16-i2.c: Likewise.
	* gcc.dg/vect/vect-strided-u16-i4.c: Likewise.
	* gcc.dg/vect/vect-strided-u32-i4.c: Likewise.
	* gcc.dg/vect/vect-strided-u32-i8.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i2-gap.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i2.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap2.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap7.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8.c: Likewise.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discr41.ads
Type: text/x-adasrc
Size: 436 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130321/4e19032d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discr41.adb
Type: text/x-adasrc
Size: 167 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130321/4e19032d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 22640 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130321/4e19032d/attachment-0002.bin>


More information about the Gcc-patches mailing list