public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/46758] [4.5/4.6 Regression] -fgraphite-identity produces wrong code when using 64bit constants
Date: Mon, 13 Dec 2010 17:25:00 -0000	[thread overview]
Message-ID: <bug-46758-4-MRYpupMA3A@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46758-4@http.gcc.gnu.org/bugzilla/>

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
         AssignedTo|amonakov at gcc dot gnu.org |unassigned at gcc dot
                   |                            |gnu.org

--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-12-13 17:24:59 UTC ---
Ouch.  The "obvious" fix:

diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 5036fba..8fda288 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -626,16 +626,9 @@ scan_tree_for_params_int (tree cst,
ppl_Linear_Expression_t expr, mpz_t k)
 {
   mpz_t val;
   ppl_Coefficient_t coef;
-  int v = int_cst_value (cst);

   mpz_init (val);
-  mpz_set_si (val, 0);
-
-  /* Necessary to not get "-1 = 2^n - 1". */
-  if (v < 0)
-    mpz_sub_ui (val, val, -v);
-  else
-    mpz_add_ui (val, val, v);
+  tree_int_to_gmp (cst, val);

   mpz_mul (val, val, k);
   ppl_new_Coefficient (&coef);

Makes Graphite fail most tests because this scanning machinery curiously
depends on signed/unsigned conversions/overflow.  For example, when an IV upper
bound N-1 is expressed as (unsigned)(N + 0xFFFFFFFFU), the patch makes Graphite
actually generate N + 0xFFFFFFFFU as upper bound in the corresponding PPL
expression:

(gdb) p nb_iters
$2 = (tree) 0x7ffff7ff9ee0
(gdb) pt
 <plus_expr 0x7ffff7ff9ee0
    type <integer_type 0x7ffff7ed0540 unsigned int public unsigned SI
        size <integer_cst 0x7ffff7ebd6e0 constant 32>
        unit size <integer_cst 0x7ffff7ebd3e8 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x7ffff7ed0540 precision
32 min <integer_cst 0x7ffff7ebd708 0> max <integer_cst 0x7ffff7ebd6b8
4294967295>
        pointer_to_this <pointer_type 0x7ffff7ee5150>>

    arg 0 <nop_expr 0x7ffff5a72420 type <integer_type 0x7ffff7ed0540 unsigned
int>

        arg 0 <ssa_name 0x7ffff5a73370 type <integer_type 0x7ffff7ed0498 int>
            visited var <parm_decl 0x7ffff7ec6880 y>def_stmt GIMPLE_NOP

            version 6>>
    arg 1 <integer_cst 0x7ffff7ebd6b8 type <integer_type 0x7ffff7ed0540
unsigned int> constant 4294967295>>
(gdb) call debug_ppl_linear_expr (ub_expr)
1 5
0 0 1 0 4294967295 

I don't know how to fix this; thus, unassigning.  Sorry.


  parent reply	other threads:[~2010-12-13 17:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  1:11 [Bug middle-end/46758] New: " zsojka at seznam dot cz
2010-12-02  9:43 ` [Bug middle-end/46758] " rguenth at gcc dot gnu.org
2010-12-03 15:27 ` amonakov at gcc dot gnu.org
2010-12-05 11:57 ` rguenth at gcc dot gnu.org
2010-12-08 18:04 ` amonakov at gcc dot gnu.org
2010-12-13 17:25 ` amonakov at gcc dot gnu.org [this message]
2010-12-16 13:22 ` rguenth at gcc dot gnu.org
2010-12-23  0:19 ` spop at gcc dot gnu.org
2010-12-23 16:26 ` spop at gcc dot gnu.org
2010-12-23 16:35 ` spop at gcc dot gnu.org
2010-12-23 18:52 ` spop at gcc dot gnu.org
2010-12-23 18:54 ` spop at gcc dot gnu.org

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=bug-46758-4-MRYpupMA3A@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).