public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14562] New: Incorrect loop code caused by pass_ch
@ 2004-03-12 21:25 fjahanian at apple dot com
  2004-03-12 22:22 ` [Bug optimization/14562] " fjahanian at apple dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fjahanian at apple dot com @ 2004-03-12 21:25 UTC (permalink / raw)
  To: gcc-bugs

Following test case produces incorrect PHI functions in pacc_ch, when compiled with
tree-ssa compiler with -O1 on ppc-darwin. This prevents gap of the SPEC benchmark
to build correctly with -O1 and higher optimizations.

typedef struct TypHeader {
    unsigned long size;
    struct TypHeader * * ptr;
} * TypHandle;

TypHandle gorf (unsigned long h, unsigned long k, TypHandle hdRes, TypHandle hdTmp)
{
    while ( hdTmp < ((hdRes)->ptr)[k-h] ) {
         ((hdRes)->ptr)[k] = ((hdRes)->ptr)[k-h];
         k = k-h;
    }
    return hdRes;
}


gorf (h, k, hdRes, hdTmp)
{
  struct TypHeader * * T.8;
  struct TypHeader * * T.7;
  long unsigned int T.6;
  struct TypHeader * T.5;
  struct TypHeader * * T.4;
  struct TypHeader * * T.3;
  long unsigned int T.2;
  long unsigned int T.1;
  struct TypHeader * * T.0;
  
  # BLOCK 0
  # PRED: ENTRY (fallthru)
  T.0<D1054>_26 = hdRes<D1048>_3->ptr;
  T.1<D1055>_27 = k<D1047>_2 - h<D1046>_5;
  T.2<D1056>_28 = T.1<D1055>_27 * 4;
  T.3<D1057>_29 = (struct TypHeader * *)T.2<D1056>_28;
  T.4<D1058>_30 = T.0<D1054>_26 + T.3<D1057>_29;
  T.5<D1059>_31 = *T.4<D1058>_30;

  if (T.5<D1059>_31 > hdTmp<D1049>_11) goto <L0>; else goto <L2>;

  # SUCC: 1 (true) 2 (false)

  # BLOCK 1
  # PRED: 0 (true) 1 (true)
  # T.3<D1057>_25 = PHI <T.3<D1057>_29(0), T.3<D1057>_40(1)>;
  # T.1<D1055>_24 = PHI <T.1<D1055>_27(0), T.1<D1055>_38(1)>;
  # k<D1047>_1 = PHI <k<D1047>_2(0), k<D1047>_36(1)>;

<L0>:;
  T.0<D1054>_32 = hdRes<D1048>_3->ptr;
  T.6<D1061>_14 = k<D1047>_1 * 4;
  T.7<D1062>_15 = (struct TypHeader * *)T.6<D1061>_14;
  T.8<D1063>_16 = T.0<D1054>_32 + T.7<D1062>_15;
  T.0<D1054>_33 = hdRes<D1048>_3->ptr;
  T.4<D1058>_34 = T.0<D1054>_33 + T.3<D1057>_25;
  T.5<D1059>_35 = *T.4<D1058>_34;
  *T.8<D1063>_16 = T.5<D1059>_35;
  k<D1047>_36 = T.1<D1055>_24;
  T.0<D1054>_37 = hdRes<D1048>_3->ptr;
  T.1<D1055>_38 = k<D1047>_36 - h<D1046>_5;
  T.2<D1056>_39 = T.1<D1055>_38 * 4;
  T.3<D1057>_40 = (struct TypHeader * *)T.2<D1056>_39;
  T.4<D1058>_41 = T.0<D1054>_37 + T.3<D1057>_40;
  T.5<D1059>_42 = *T.4<D1058>_41;
  if (T.5<D1059>_42 > hdTmp<D1049>_11) goto <L0>; else goto <L2>;
  # SUCC: 2 (false) 1 (true)

  # BLOCK 2
  # PRED: 0 (false) 1 (false)
<L2>:;
  return hdRes<D1048>_3;
  # SUCC: EXIT

}


2004-02-20  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
...

      * tree-optimize.c (init_tree_optimization_passes): Add pass_ch.
        * tree-pass.h (pass_ch): Declare.
        * tree-ssa-loop.c: Include tree-inline.h.
        (call_expr_p, should_duplicate_loop_header_p, mark_defs_for_rewrite,
        duplicate_blocks, copy_loop_headers, gate_ch): New functions.
        (pass_ch): New.
...

- fariborz (fjahanian@apple.com)

-- 
           Summary: Incorrect loop code caused by pass_ch
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P1
         Component: optimization
        AssignedTo: rakdver at atrey dot karlin dot mff dot cuni dot cz
        ReportedBy: fjahanian at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.2.0
  GCC host triplet: powerpc-apple-darwin7.2.0
GCC target triplet: powerpc-apple-darwin7.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14562


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

end of thread, other threads:[~2004-03-16 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-12 21:25 [Bug optimization/14562] New: Incorrect loop code caused by pass_ch fjahanian at apple dot com
2004-03-12 22:22 ` [Bug optimization/14562] " fjahanian at apple dot com
2004-03-12 22:29 ` [Bug optimization/14562] [tree-ssa] Incorrect loop code caused by copyrename pinskia at gcc dot gnu dot org
2004-03-15 23:20 ` [Bug optimization/14562] [tree-ssa] Incorrect loop code caused by PRE pinskia at gcc dot gnu dot org
2004-03-16 15:59 ` cvs-commit at gcc dot gnu dot org
2004-03-16 16:00 ` dberlin at gcc dot gnu dot 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).