public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c
@ 2014-05-20  7:29 vincenzo.innocente at cern dot ch
  2014-05-20  8:18 ` [Bug middle-end/61245] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2014-05-20  7:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

            Bug ID: 61245
           Summary: ICE at in expand_ANNOTATE, at internal-fn.c:127 called
                    from cfgexpand.c
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch

apologize for not reducing (trivial reduction (bar below) works)
given 
cat NaiveDod.cc
#include<array>
#include<vector>
#include<utility>

unsigned int N;
float * a, *b, *c;

void bar() {
#pragma GCC ivdep
  for (auto i=0U; i<N; ++i)
    a[i] = b[i]*c[i];
}



template<int N>
struct SoA {
  using s_t = unsigned int;   
  using Ind = unsigned int;

  auto size() const { return m_n;}

  float & operator()(Ind i, Ind j) { return data[j][i];}
  float const & operator()(Ind i, Ind j) const { return data[j][i];}

  std::array<std::vector<float>,N> data;
  s_t m_n=0;
};


template<int N>
void doT(SoA<N> & soa) {
#pragma GCC ivdep
  for (auto i=0U; i<soa.size(); ++i)
    soa(i,0) = soa(i,1)*soa(i,2);
}


void doIt(SoA<3> & soa) {
  doT(soa);
}


produces

c++ -std=c++1y -Ofast -Wall -fopt-info-vec -fno-tree-slp-vectorize
-march=nehalem -S NaiveDod.cc
NaiveDod.cc:10:17: note: loop vectorized
NaiveDod.cc:10:17: note: loop peeled for vectorization to enhance alignment
NaiveDod.cc: In function 'void doIt(SoA<3>&)':
NaiveDod.cc:34:17: internal compiler error: in expand_ANNOTATE, at
internal-fn.c:127
   for (auto i=0U; i<soa.size(); ++i)
                 ^
0x9e9a97 expand_ANNOTATE
    ../../gcc-trunk/gcc/internal-fn.c:127
0x820a7a expand_call_stmt
    ../../gcc-trunk/gcc/cfgexpand.c:2236
0x820a7a expand_gimple_stmt_1
    ../../gcc-trunk/gcc/cfgexpand.c:3202
0x820a7a expand_gimple_stmt
    ../../gcc-trunk/gcc/cfgexpand.c:3354
0x821aee expand_gimple_basic_block
    ../../gcc-trunk/gcc/cfgexpand.c:5194
0x823746 execute
    ../../gcc-trunk/gcc/cfgexpand.c:5803
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/afs/cern.ch/user/i/innocent/w4/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk//configure
--prefix=/afs/cern.ch/user/i/innocent/w4 --enable-languages=c,c++,lto,fortran
-enable-gold=yes --enable-lto --with-gmp-lib=/usr/local/lib64
--with-mpfr-lib=/usr/local/lib64 -with-mpc-lib=/usr/local/lib64
--enable-cloog-backend=isl --with-cloog=/usr/local
--with-ppl-lib=/usr/local/lib64 -enable-libitm -disable-multilib
Thread model: posix
gcc version 4.10.0 20140520 (experimental) [trunk revision 210630] (GCC)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/61245] ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
@ 2014-05-20  8:18 ` rguenth at gcc dot gnu.org
  2014-05-20  8:24 ` [Bug c++/61245] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-20  8:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-20
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
          Component|tree-optimization           |middle-end
     Ever confirmed|0                           |1
      Known to fail|                            |4.10.0, 4.9.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  An ANNOTATE survives CFG building:

;; 2 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2 3 4 5
;;
;; Loop 1
;;  header 4, latch 3
;;  depth 1, outer 0
;;  nodes: 4 3

void doT(SoA<N>&) [with int N = 3] (struct SoA & soa)
{
...
  <bb 3>:
  D.30093 = SoA<3>::operator() (soa, i, 0);
  D.30094 = SoA<3>::operator() (soa, i, 1);
  D.30095 = *D.30094;
  D.30096 = SoA<3>::operator() (soa, i, 2);
  D.30097 = *D.30096;
  D.30098 = D.30095 * D.30097;
  *D.30093 = D.30098;
  i = i + 1;

  <bb 4>:
  D.30101 = SoA<3>::size (soa);
  D.30102 = D.30101 > i;
  D.30100 = ANNOTATE (D.30102, 0);
  retval.4 = D.30100;
  if (retval.4 != 0)
    goto <bb 3>;
  else
    goto <bb 5>;

  <bb 5>:


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/61245] ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
  2014-05-20  8:18 ` [Bug middle-end/61245] " rguenth at gcc dot gnu.org
@ 2014-05-20  8:24 ` rguenth at gcc dot gnu.org
  2021-06-20  9:30 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-20  8:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |c++

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
For some reason we create a temporary, probably because the very specific
ANNOTATE is inside a cleanup_point:

    if (<<cleanup_point ANNOTATE_EXPR <SoA<3>::size ((struct SoA *) soa) > i,
ivdep>>>) goto <D.28269>; else goto <D.28267>;

that is, the wrapped expressions has side-effects.  We should build the
ANNOTATE_EXPR outside of that cleanup.

C++ FE support issue.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/61245] ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
  2014-05-20  8:18 ` [Bug middle-end/61245] " rguenth at gcc dot gnu.org
  2014-05-20  8:24 ` [Bug c++/61245] " rguenth at gcc dot gnu.org
@ 2021-06-20  9:30 ` pinskia at gcc dot gnu.org
  2021-06-20  9:34 ` [Bug c++/61245] #pragma GCC ivdep is ignored with call inside the test of a for loop pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-20  9:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-valid-code           |missed-optimization

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Do we get a warning now instead of an internal compiler error:
t6.cc:34:17: warning: ignoring loop annotation
   34 |   for (auto i=0U; i<soa.size(); ++i)
      |                 ^

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/61245] #pragma GCC ivdep is ignored with call inside the test of a for loop
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2021-06-20  9:30 ` pinskia at gcc dot gnu.org
@ 2021-06-20  9:34 ` pinskia at gcc dot gnu.org
  2021-06-20  9:38 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-20  9:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE at in expand_ANNOTATE,  |#pragma GCC ivdep is
                   |at internal-fn.c:127 called |ignored with call inside
                   |from cfgexpand.c            |the test of a for loop

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The ICE to warning was fixed with r5-4959.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/61245] #pragma GCC ivdep is ignored with call inside the test of a for loop
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2021-06-20  9:34 ` [Bug c++/61245] #pragma GCC ivdep is ignored with call inside the test of a for loop pinskia at gcc dot gnu.org
@ 2021-06-20  9:38 ` pinskia at gcc dot gnu.org
  2021-07-31 22:07 ` pinskia at gcc dot gnu.org
  2021-08-02  6:45 ` [Bug c++/61245] #pragma GCC ivdep is handled incorrectly inside templates rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-20  9:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The loop is still vectorized though. As it looks like it was versioned.

t6.cc: In function ‘void doT(SoA<N>&) [with int N = 3]’:
t6.cc:34:17: warning: ignoring loop annotation
   34 |   for (auto i=0U; i<soa.size(); ++i)
      |                 ^
t6.cc:10:17: optimized: loop vectorized using 16 byte vectors
t6.cc:10:17: optimized: loop vectorized using 8 byte vectors
t6.cc:34:17: optimized: loop vectorized using 16 byte vectors
t6.cc:34:17: optimized:  loop versioned for vectorization because of possible
aliasing
t6.cc:34:17: optimized: loop vectorized using 8 byte vectors

I don't know how useful "#pragma GCC ivdep" is these days really.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/61245] #pragma GCC ivdep is ignored with call inside the test of a for loop
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2021-06-20  9:38 ` pinskia at gcc dot gnu.org
@ 2021-07-31 22:07 ` pinskia at gcc dot gnu.org
  2021-08-02  6:45 ` [Bug c++/61245] #pragma GCC ivdep is handled incorrectly inside templates rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-31 22:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fwinter at jlab dot org

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 79047 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/61245] #pragma GCC ivdep is handled incorrectly inside templates
  2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2021-07-31 22:07 ` pinskia at gcc dot gnu.org
@ 2021-08-02  6:45 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-02  6:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61245

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Just as a wild guess maybe the ANNOTATE_EXPR should get a TARGET_EXPR as
argument which might avoid this issue.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-02  6:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-20  7:29 [Bug tree-optimization/61245] New: ICE at in expand_ANNOTATE, at internal-fn.c:127 called from cfgexpand.c vincenzo.innocente at cern dot ch
2014-05-20  8:18 ` [Bug middle-end/61245] " rguenth at gcc dot gnu.org
2014-05-20  8:24 ` [Bug c++/61245] " rguenth at gcc dot gnu.org
2021-06-20  9:30 ` pinskia at gcc dot gnu.org
2021-06-20  9:34 ` [Bug c++/61245] #pragma GCC ivdep is ignored with call inside the test of a for loop pinskia at gcc dot gnu.org
2021-06-20  9:38 ` pinskia at gcc dot gnu.org
2021-07-31 22:07 ` pinskia at gcc dot gnu.org
2021-08-02  6:45 ` [Bug c++/61245] #pragma GCC ivdep is handled incorrectly inside templates rguenth at gcc dot gnu.org

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).