public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly
@ 2014-09-03 17:06 carrot at google dot com
  2014-09-03 17:42 ` [Bug rtl-optimization/63156] " steven at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: carrot at google dot com @ 2014-09-03 17:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63156
           Summary: web can't handle AUTOINC correctly
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carrot at google dot com

Check out the latest trunk, apply the following patch to move web before IRA

Index: passes.def
===================================================================
--- passes.def    (revision 214881)
+++ passes.def    (working copy)
@@ -364,7 +364,6 @@
       NEXT_PASS (pass_rtl_loop_done);
       TERMINATE_PASS_LIST ()
       POP_INSERT_PASSES ()
-      NEXT_PASS (pass_web);
       NEXT_PASS (pass_rtl_cprop);
       NEXT_PASS (pass_cse2);
       NEXT_PASS (pass_rtl_dse1);
@@ -385,6 +384,7 @@
       NEXT_PASS (pass_sms);
       NEXT_PASS (pass_live_range_shrinkage);
       NEXT_PASS (pass_sched);
+      NEXT_PASS (pass_web);
       NEXT_PASS (pass_ira);
       NEXT_PASS (pass_reload);
       NEXT_PASS (pass_postreload);

Build an arm gcc, run following test

make check-gcc RUNTESTFLAGS="--target_board=arm-sim/arch=armv5te/thumb
execute.exp=20000422-1.c"

You can see all tests pass. But if I enable the web pass,

make check-gcc RUNTESTFLAGS="--target_board=arm-sim/arch=armv5te/thumb/-fweb
execute.exp=20000422-1.c"

I got one run time failure. The problem is web renamed the operand of post_inc
in following insn, which should not occurred.

(insn 34 122 36 2 (set (reg:SI 137 [ D.4191 ])
        (mem/c:SI (post_inc:SI (reg/f:SI 156)) [2 num+0 S4 A32]))
/usr/local/google/home/carrot/ssd/trunk3/gcc/testsuite/gcc.c-torture/execute/20000422-1.c:17
740 {*thumb1_movsi_insn}
     (expr_list:REG_INC (reg/f:SI 156)
        (expr_list:REG_EQUAL (mem/c:SI (symbol_ref:SI ("*.LANCHOR0") [flags
0x182]) [2 num+0 S4 A32])
            (nil))))


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
@ 2014-09-03 17:42 ` steven at gcc dot gnu.org
  2014-09-03 22:03 ` steven at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2014-09-03 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |steven at gcc dot gnu.org


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
  2014-09-03 17:42 ` [Bug rtl-optimization/63156] " steven at gcc dot gnu.org
@ 2014-09-03 22:03 ` steven at gcc dot gnu.org
  2014-09-03 23:41 ` carrot at google dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2014-09-03 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #2 from Steven Bosscher <steven at gcc dot gnu.org> ---
I am unable to reproduce this:

Test Run By stevenb on Wed Sep  3 14:56:17 2014
Target is arm-unknown-eabi
Host   is powerpc64-unknown-linux-gnu

                === gcc tests ===

Schedule of variations:
    arm-sim/-march=armv5te/-mthumb/-fweb

Running target arm-sim/-march=armv5te/-mthumb/-fweb
Running
/home/stevenb/devel/combined/gcc/testsuite/gcc.c-torture/execute/execute.exp
...
PASS: gcc.c-torture/execute/20000422-1.c   -O0  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O0  execution test
PASS: gcc.c-torture/execute/20000422-1.c   -O1  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O1  execution test
PASS: gcc.c-torture/execute/20000422-1.c   -O2  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O2  execution test
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -fomit-frame-pointer  (test for
excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -fomit-frame-pointer  execution
test
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -fomit-frame-pointer
-funroll-loops  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -fomit-frame-pointer
-funroll-loops  execution test
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -g  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -O3 -g  execution test
PASS: gcc.c-torture/execute/20000422-1.c   -Os  (test for excess errors)
PASS: gcc.c-torture/execute/20000422-1.c   -Os  execution test

                === gcc Summary ===

# of expected passes            16
/home/stevenb/devel/build-arm/gcc/xgcc  version 5.0.0 20140903 (experimental)
[trunk revision 214887] (GCC)


What is your command line for configure?


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
  2014-09-03 17:42 ` [Bug rtl-optimization/63156] " steven at gcc dot gnu.org
  2014-09-03 22:03 ` steven at gcc dot gnu.org
@ 2014-09-03 23:41 ` carrot at google dot com
  2014-09-04  3:24 ` carrot at google dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: carrot at google dot com @ 2014-09-03 23:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Carrot <carrot at google dot com> ---
../trunk3/configure '--build=x86_64-build_unknown-linux-gnu'
'--host=x86_64-build_unknown-linux-gnu' '--target=arm-unknown-linux-gnueabi'
'--prefix=/usr/local/google/home/carrot/x-tools/arm-unknown-linux-gnueabi'
'--with-sysroot=/usr/local/google/home/carrot/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot'
'--with-float=soft' '--with-pkgversion=crosstool-NG 1.19.0'
'--disable-sjlj-exceptions' '--enable-__cxa_atexit' '--disable-libmudflap'
'--disable-libgomp' '--disable-libssp' '--disable-libquadmath'
'--disable-libquadmath-support'
'--with-gmp=/usr/local/google/home/carrot/crosstool-ng/work1/.build/arm-unknown-linux-gnueabi/buildtools'
'--with-mpfr=/usr/local/google/home/carrot/crosstool-ng/work1/.build/arm-unknown-linux-gnueabi/buildtools'
'--with-mpc=/usr/local/google/home/carrot/crosstool-ng/work1/.build/arm-unknown-linux-gnueabi/buildtools'
'--with-ppl=no' '--with-isl=no' '--with-cloog=no' '--with-libelf=no'
'--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
'--enable-threads=posix' '--enable-target-optspace' '--disable-nls'
'--disable-multilib'
'--with-local-prefix=/usr/local/google/home/carrot/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot'
'--enable-c99' '--enable-long-long' '--disable-libitm'
'build_alias=x86_64-build_unknown-linux-gnu'
'host_alias=x86_64-build_unknown-linux-gnu'
'target_alias=arm-unknown-linux-gnueabi' '--disable-libasan'
'--disable-libsanitizer' '--enable-languages=c,c++,lto'


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
                   ` (2 preceding siblings ...)
  2014-09-03 23:41 ` carrot at google dot com
@ 2014-09-04  3:24 ` carrot at google dot com
  2014-09-04  8:24 ` steven at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: carrot at google dot com @ 2014-09-04  3:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Carrot <carrot at google dot com> ---
In function df_uses_record, we have:

    ...
    case PRE_DEC:
    case POST_DEC:
    case PRE_INC:
    case POST_INC:
    case PRE_MODIFY:
    case POST_MODIFY:
      gcc_assert (!DEBUG_INSN_P (insn_info->insn));
      /* Catch the def of the register being modified.  */
      df_ref_record (DF_REF_REGULAR, collection_rec, XEXP (x, 0), &XEXP (x, 0),
                     bb, insn_info,
                     DF_REF_REG_DEF,
                     flags | DF_REF_READ_WRITE | DF_REF_PRE_POST_MODIFY);

      /* ... Fall through to handle uses ...  */

    default:
      break;
    }    

  /* Recursively scan the operands of this expression.  */
  {
    const char *fmt = GET_RTX_FORMAT (code);
    int i;

    for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) 
      {    
        if (fmt[i] == 'e') 
          {
            /* Tail recursive case: save a function call level.  */
            if (i == 0)
              {    
                loc = &XEXP (x, 0);
                goto retry;
              }    
            df_uses_record (collection_rec, &XEXP (x, i), ref_type,
                            bb, insn_info, flags);
          }
        ...


For a AUTOINC rtl expression, we create two refs, one def and one use, but only
the def gets the flag DF_REF_READ_WRITE, the use doesn't have this flag.

While in web_main, it checks only use refs, but the use ref doesn't have the
flag DF_REF_READ_WRITE, so it can't actually catch the AUTOINC cases, and does
wrong renaming.


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
                   ` (3 preceding siblings ...)
  2014-09-04  3:24 ` carrot at google dot com
@ 2014-09-04  8:24 ` steven at gcc dot gnu.org
  2014-09-05 22:14 ` steven at gcc dot gnu.org
  2014-09-07  2:46 ` carrot at google dot com
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2014-09-04  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #5 from Steven Bosscher <steven at gcc dot gnu.org> ---
(In reply to Carrot from comment #4)
> For a AUTOINC rtl expression, we create two refs, one def and one use, but
> only the def gets the flag DF_REF_READ_WRITE, the use doesn't have this flag.

Then this is fall-out of PR32339.


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
                   ` (4 preceding siblings ...)
  2014-09-04  8:24 ` steven at gcc dot gnu.org
@ 2014-09-05 22:14 ` steven at gcc dot gnu.org
  2014-09-07  2:46 ` carrot at google dot com
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2014-09-05 22:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> ---
(In reply to Carrot from comment #6)
> Since it is intentionally to remove flag DF_REF_READ_WRITE on use,

Ah, but I don't think that was the correct fix. The DEF and USE refs should
both have the flag set.


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

* [Bug rtl-optimization/63156] web can't handle AUTOINC correctly
  2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
                   ` (5 preceding siblings ...)
  2014-09-05 22:14 ` steven at gcc dot gnu.org
@ 2014-09-07  2:46 ` carrot at google dot com
  6 siblings, 0 replies; 8+ messages in thread
From: carrot at google dot com @ 2014-09-07  2:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Carrot <carrot at google dot com> ---
(In reply to Steven Bosscher from comment #7)
> (In reply to Carrot from comment #6)
> > Since it is intentionally to remove flag DF_REF_READ_WRITE on use,
> 
> Ah, but I don't think that was the correct fix. The DEF and USE refs should
> both have the flag set.

I agree it's more reasonable to set DF_REF_READ_WRITE flag on both use and def,
it means we need to revert r125736 and reopen bug 32339.


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

end of thread, other threads:[~2014-09-07  2:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03 17:06 [Bug rtl-optimization/63156] New: web can't handle AUTOINC correctly carrot at google dot com
2014-09-03 17:42 ` [Bug rtl-optimization/63156] " steven at gcc dot gnu.org
2014-09-03 22:03 ` steven at gcc dot gnu.org
2014-09-03 23:41 ` carrot at google dot com
2014-09-04  3:24 ` carrot at google dot com
2014-09-04  8:24 ` steven at gcc dot gnu.org
2014-09-05 22:14 ` steven at gcc dot gnu.org
2014-09-07  2:46 ` carrot at google dot com

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