public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christophe Lyon <christophe.lyon@linaro.org>
To: Marc Glisse <marc.glisse@inria.fr>
Cc: Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: VEC_COND_EXPR optimizations v2
Date: Thu, 6 Aug 2020 14:00:32 +0200	[thread overview]
Message-ID: <CAKdteOYyK+QHhmiDMHbh-a-t-ix7U9ApWVabs2h3_gJz8zZ5Zg@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.23.453.2008061335420.8021@stedding.saclay.inria.fr>

[-- Attachment #1: Type: text/plain, Size: 6686 bytes --]

On Thu, 6 Aug 2020 at 13:42, Marc Glisse <marc.glisse@inria.fr> wrote:
>
> On Thu, 6 Aug 2020, Christophe Lyon wrote:
>
> > On Thu, 6 Aug 2020 at 11:06, Marc Glisse <marc.glisse@inria.fr> wrote:
> >>
> >> On Thu, 6 Aug 2020, Christophe Lyon wrote:
> >>
> >>>>> 2020-08-05  Marc Glisse  <marc.glisse@inria.fr>
> >>>>>
> >>>>>         PR tree-optimization/95906
> >>>>>         PR target/70314
> >>>>>         * match.pd ((c ? a : b) op d, (c ? a : b) op (c ? d : e),
> >>>>>         (v ? w : 0) ? a : b, c1 ? c2 ? a : b : b): New transformations.
> >>>>>         (op (c ? a : b)): Update to match the new transformations.
> >>>>>
> >>>>>         * gcc.dg/tree-ssa/andnot-2.c: New file.
> >>>>>         * gcc.dg/tree-ssa/pr95906.c: Likewise.
> >>>>>         * gcc.target/i386/pr70314.c: Likewise.
> >>>>>
> >>>
> >>> I think this patch is causing several ICEs on arm-none-linux-gnueabihf
> >>> --with-cpu cortex-a9 --with-fpu neon-fp16:
> >>>  Executed from: gcc.c-torture/compile/compile.exp
> >>>    gcc.c-torture/compile/20160205-1.c   -O3 -fomit-frame-pointer
> >>> -funroll-loops -fpeel-loops -ftracer -finline-functions  (internal
> >>> compiler error)
> >>>    gcc.c-torture/compile/20160205-1.c   -O3 -g  (internal compiler error)
> >>>  Executed from: gcc.dg/dg.exp
> >>>    gcc.dg/pr87746.c (internal compiler error)
> >>>  Executed from: gcc.dg/tree-ssa/tree-ssa.exp
> >>>    gcc.dg/tree-ssa/ifc-cd.c (internal compiler error)
> >>
> >> I tried a cross from x86_64-linux with current master
> >>
> >> .../configure --target=arm-none-linux-gnueabihf --enable-languages=c,c++ --with-system-zlib --disable-nls --with-cpu=cortex-a9 --with-fpu=neon-fp16
> >> make
> >>
> >> it stops at some point with an error, but I have xgcc and cc1 in
> >> build/gcc.
> >>
> >> I copied 2 of the testcases and compiled
> >>
> >> ./xgcc pr87746.c -Ofast -S -B.
> >> ./xgcc -O3 -fdump-tree-ifcvt-details-blocks-details ifc-cd.c -S -B.
> >>
> >> without getting any ICE.
> >
> > Sorry for the delay, I had to reproduce the problem manually.
> >>
> >> Is there a machine on the compile farm where this is easy to reproduce?
> > I don't think there is any arm machine in the compile farm.
> >
> >> Or could you attach the .optimized dump that corresponds to the
> >> backtrace below? It looks like we end up with a comparison with an
> >> unexpected return type.
> >>
> >
> > I've compiled pr87746.c with -fdump-tree-ifcvt-details-blocks-details,
> > here is the log.
> > Is that what you need?
>
> Thanks.
> The one from -fdump-tree-optimized would be closer to the ICE.
Here it is.

> Though it would also be convenient to know which stmt is being expanded
> when we ICE, etc.
I think it's when expanding
_96 = _86 | _95;
(that the value of "stmt" in expand_gimple_stmt_1 when we enter do_store_flag

> Was I on the right track configuring with
> --target=arm-none-linux-gnueabihf --with-cpu=cortex-a9
> --with-fpu=neon-fp16
> then compiling without any special option?
>
Maybe you also need --with-float=hard, I don't remember if it's
implied by the 'hf' target suffix
(I saw similar problems with arm-none-linux-gnueabi anyway)

> > Thanks,
> >
> > Christophe
> >
> >>>  Executed from: gcc.dg/vect/vect.exp
> >>>    gcc.dg/vect/pr59591-1.c (internal compiler error)
> >>>    gcc.dg/vect/pr59591-1.c -flto -ffat-lto-objects (internal compiler error)
> >>>    gcc.dg/vect/pr86927.c (internal compiler error)
> >>>    gcc.dg/vect/pr86927.c -flto -ffat-lto-objects (internal compiler error)
> >>>    gcc.dg/vect/slp-cond-5.c (internal compiler error)
> >>>    gcc.dg/vect/slp-cond-5.c -flto -ffat-lto-objects (internal compiler error)
> >>>    gcc.dg/vect/vect-23.c (internal compiler error)
> >>>    gcc.dg/vect/vect-23.c -flto -ffat-lto-objects (internal compiler error)
> >>>    gcc.dg/vect/vect-24.c (internal compiler error)
> >>>    gcc.dg/vect/vect-24.c -flto -ffat-lto-objects (internal compiler error)
> >>>    gcc.dg/vect/vect-cond-reduc-6.c (internal compiler error)
> >>>    gcc.dg/vect/vect-cond-reduc-6.c -flto -ffat-lto-objects (internal
> >>> compiler error)
> >>>
> >>> Backtrace for gcc.c-torture/compile/20160205-1.c   -O3
> >>> -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer
> >>> -finline-functions
> >>> during RTL pass: expand
> >>> /gcc/testsuite/gcc.c-torture/compile/20160205-1.c:2:5: internal
> >>> compiler error: in do_store_flag, at expr.c:12259
> >>> 0x8feb26 do_store_flag
> >>>        /gcc/expr.c:12259
> >>> 0x900201 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
> >>> expand_modifier)
> >>>        /gcc/expr.c:9617
> >>> 0x908cd0 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
> >>> expand_modifier, rtx_def**, bool)
> >>>        /gcc/expr.c:10159
> >>> 0x91174e expand_expr
> >>>        /gcc/expr.h:282
> >>> 0x91174e expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
> >>> rtx_def**, expand_modifier)
> >>>        /gcc/expr.c:8065
> >>> 0x8ff543 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
> >>> expand_modifier)
> >>>        /gcc/expr.c:9950
> >>> 0x908cd0 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
> >>> expand_modifier, rtx_def**, bool)
> >>>        /gcc/expr.c:10159
> >>> 0x91174e expand_expr
> >>>        /gcc/expr.h:282
> >>> 0x91174e expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
> >>> rtx_def**, expand_modifier)
> >>>        /gcc/expr.c:8065
> >>> 0x8ff543 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
> >>> expand_modifier)
> >>>        /gcc/expr.c:9950
> >>> 0x908cd0 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
> >>> expand_modifier, rtx_def**, bool)
> >>>        /gcc/expr.c:10159
> >>> 0x91174e expand_expr
> >>>        /gcc/expr.h:282
> >>> 0x91174e expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
> >>> rtx_def**, expand_modifier)
> >>>        /gcc/expr.c:8065
> >>> 0x8ff543 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
> >>> expand_modifier)
> >>>        /gcc/expr.c:9950
> >>> 0x908cd0 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
> >>> expand_modifier, rtx_def**, bool)
> >>>        /gcc/expr.c:10159
> >>> 0x91174e expand_expr
> >>>        /gcc/expr.h:282
> >>> 0x91174e expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
> >>> rtx_def**, expand_modifier)
> >>>        /gcc/expr.c:8065
> >>> 0x8ff543 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
> >>> expand_modifier)
> >>>        /gcc/expr.c:9950
> >>> 0x908cd0 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
> >>> expand_modifier, rtx_def**, bool)
> >>>        /gcc/expr.c:10159
> >>> 0x91174e expand_expr
> >>>        /gcc/expr.h:282
> >>>
> >>> Christophe
> >>
> >> --
> >> Marc Glisse
> >
>
> --
> Marc Glisse

[-- Attachment #2: pr87746.c.237t.optimized --]
[-- Type: application/octet-stream, Size: 5177 bytes --]


;; Function move_replacements (move_replacements, funcdef_no=0, decl_uid=5678, cgraph_uid=1, symbol_order=1)

Removing basic block 15
Removing basic block 16
Removing basic block 17
Removing basic block 18
Removing basic block 19
Removing basic block 20
Removing basic block 21
Removing basic block 22
move_replacements (struct rtx_def * * x, struct rtx_def * * y, int n_replacements)
{
  unsigned int ivtmp.34;
  unsigned int ivtmp.27;
  vector(4) unsigned int vect_patt_19.23;
  vector(4) unsigned int vect_patt_35.19;
  vector(4) unsigned int vect__ifc__36.15;
  vector(4) unsigned int vect__1.13;
  vector(4) unsigned int vect__1.12;
  vector(4) unsigned int vect_array.11[3];
  unsigned int[12] * {ref-all} vectp_replacements.9;
  int tmp.8;
  unsigned int niters_vector_mult_vf.7;
  unsigned int bnd.6;
  unsigned int niters.5;
  int i;
  sizetype _1;
  struct replacement[150] * _2;
  void * _14;
  unsigned int _26;
  unsigned int _30;
  sizetype _36;
  struct rtx_def * * _55;
  struct rtx_def * * _58;
  unsigned int _64;
  unsigned int _76;
  vector(4) unsigned int vect_cst__77;
  unsigned int _78;
  vector(4) unsigned int vect_cst__79;
  vector(4) <signed-boolean:32> _86;
  vector(4) <signed-boolean:32> _95;
  vector(4) <signed-boolean:32> _96;
  unsigned int _119;
  unsigned int _122;
  unsigned int _125;
  unsigned int _128;
  unsigned int _132;
  unsigned int _135;
  unsigned int _138;
  unsigned int _141;

  <bb 2> [local count: 118111598]:
  if (n_replacements_7(D) > 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 14>; [11.00%]

  <bb 3> [local count: 105119322]:
  niters.5_52 = (unsigned int) n_replacements_7(D);
  _64 = niters.5_52 + 4294967295;
  if (_64 <= 61)
    goto <bb 7>; [10.00%]
  else
    goto <bb 4>; [90.00%]

  <bb 4> [local count: 94607390]:
  bnd.6_67 = niters.5_52 >> 2;
  _76 = (unsigned int) x_8(D);
  vect_cst__77 = {_76, _76, _76, _76};
  _78 = (unsigned int) y_9(D);
  vect_cst__79 = {_78, _78, _78, _78};
  ivtmp.34_143 = (unsigned int) &replacements;
  _30 = bnd.6_67 * 48;
  _26 = _30 + ivtmp.34_143;

  <bb 5> [local count: 567644337]:
  # ivtmp.34_42 = PHI <ivtmp.34_143(4), ivtmp.34_130(5)>
  vectp_replacements.9_71 = (unsigned int[12] * {ref-all}) ivtmp.34_42;
  vect_array.11 = .LOAD_LANES (MEM <unsigned int[12]> [(struct rtx_def * * *)vectp_replacements.9_71]);
  vect__1.12_73 = vect_array.11[0];
  vect__1.13_74 = vect_array.11[1];
  vect_array.11 ={v} {CLOBBER};
  vect__ifc__36.15_81 = .VCONDU (vect__1.13_74, vect_cst__77, vect__1.13_74, vect_cst__79, 113);
  _86 = vect__1.13_74 == vect_cst__77;
  _95 = vect__1.12_73 != vect_cst__77;
  _96 = _86 | _95;
  vect_patt_35.19_99 = .VCOND (_96, { 0, 0, 0, 0 }, vect__1.12_73, vect_cst__79, 107);
  vect_patt_19.23_116 = .VCOND (_96, { 0, 0, 0, 0 }, vect__ifc__36.15_81, { 0, 0, 0, 0 }, 107);
  _119 = BIT_FIELD_REF <vect_patt_35.19_99, 32, 0>;
  MEM[base: vectp_replacements.9_71, offset: 0B] = _119;
  _122 = BIT_FIELD_REF <vect_patt_35.19_99, 32, 32>;
  MEM[base: vectp_replacements.9_71, offset: 12B] = _122;
  _125 = BIT_FIELD_REF <vect_patt_35.19_99, 32, 64>;
  MEM[base: vectp_replacements.9_71, offset: 24B] = _125;
  _128 = BIT_FIELD_REF <vect_patt_35.19_99, 32, 96>;
  MEM[base: vectp_replacements.9_71, offset: 36B] = _128;
  _132 = BIT_FIELD_REF <vect_patt_19.23_116, 32, 0>;
  MEM[base: vectp_replacements.9_71, offset: 4B] = _132;
  _135 = BIT_FIELD_REF <vect_patt_19.23_116, 32, 32>;
  MEM[base: vectp_replacements.9_71, offset: 16B] = _135;
  _138 = BIT_FIELD_REF <vect_patt_19.23_116, 32, 64>;
  MEM[base: vectp_replacements.9_71, offset: 28B] = _138;
  _141 = BIT_FIELD_REF <vect_patt_19.23_116, 32, 96>;
  MEM[base: vectp_replacements.9_71, offset: 40B] = _141;
  ivtmp.34_130 = ivtmp.34_42 + 48;
  if (_26 != ivtmp.34_130)
    goto <bb 5>; [83.33%]
  else
    goto <bb 6>; [16.67%]

  <bb 6> [local count: 105119322]:
  niters_vector_mult_vf.7_68 = niters.5_52 & 4294967292;
  tmp.8_69 = (int) niters_vector_mult_vf.7_68;
  if (niters.5_52 == niters_vector_mult_vf.7_68)
    goto <bb 13>; [25.00%]
  else
    goto <bb 7>; [75.00%]

  <bb 7> [local count: 81467474]:
  # i_65 = PHI <0(3), tmp.8_69(6)>
  _1 = (sizetype) i_65;
  _36 = _1 * 12;
  _2 = &replacements + _36;
  ivtmp.27_75 = (unsigned int) _2;

  <bb 8> [local count: 822903805]:
  # i_53 = PHI <i_65(7), i_57(9)>
  # ivtmp.27_24 = PHI <ivtmp.27_75(7), ivtmp.27_16(9)>
  _14 = (void *) ivtmp.27_24;
  _55 = MEM[base: _14, offset: 4B];
  if (x_8(D) == _55)
    goto <bb 12>; [30.00%]
  else
    goto <bb 10>; [70.00%]

  <bb 9> [local count: 822903806]:
  i_57 = i_53 + 1;
  ivtmp.27_16 = ivtmp.27_24 + 12;
  if (n_replacements_7(D) > i_57)
    goto <bb 8>; [89.00%]
  else
    goto <bb 13>; [11.00%]

  <bb 10> [local count: 576032666]:
  _58 = MEM[base: _14, offset: 0B];
  if (x_8(D) == _58)
    goto <bb 11>; [30.00%]
  else
    goto <bb 9>; [70.00%]

  <bb 11> [local count: 172809798]:
  MEM[base: _14, offset: 0B] = y_9(D);
  MEM[base: _14, offset: 4B] = 0B;
  goto <bb 9>; [100.00%]

  <bb 12> [local count: 246871139]:
  MEM[base: _14, offset: 4B] = y_9(D);
  goto <bb 9>; [100.00%]

  <bb 13> [local count: 116799249]:

  <bb 14> [local count: 118111600]:
  return;

}



  reply	other threads:[~2020-08-06 12:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30  7:49 VEC_COND_EXPR optimizations Marc Glisse
2020-07-31 11:18 ` Richard Sandiford
2020-07-31 11:38   ` Marc Glisse
2020-07-31 11:43     ` Richard Biener
2020-07-31 11:57       ` Marc Glisse
2020-07-31 12:50     ` Richard Sandiford
2020-07-31 12:59       ` Richard Biener
2020-07-31 13:01       ` Marc Glisse
2020-07-31 13:13         ` Marc Glisse
2020-07-31 11:35 ` Richard Biener
2020-07-31 11:39   ` Richard Biener
2020-07-31 11:47     ` Richard Biener
2020-07-31 12:08       ` Richard Biener
2020-07-31 12:12       ` Marc Glisse
2020-08-05 13:32 ` VEC_COND_EXPR optimizations v2 Marc Glisse
2020-08-05 14:24   ` Richard Biener
2020-08-06  8:17     ` Christophe Lyon
2020-08-06  9:05       ` Marc Glisse
2020-08-06 11:25         ` Christophe Lyon
2020-08-06 11:42           ` Marc Glisse
2020-08-06 12:00             ` Christophe Lyon [this message]
2020-08-06 18:07               ` Marc Glisse
2020-08-07  6:38                 ` Richard Biener
2020-08-07  8:33                   ` Marc Glisse
2020-08-07  8:47                     ` Richard Biener
2020-08-07 12:15                       ` Marc Glisse
2020-08-07 13:04                         ` Richard Biener
2020-08-06 10:29       ` Richard Biener
2020-08-06 11:11         ` Marc Glisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKdteOYyK+QHhmiDMHbh-a-t-ix7U9ApWVabs2h3_gJz8zZ5Zg@mail.gmail.com \
    --to=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).