Bug 29779 - [4.3 Regression] vectorizer fortran testcases failing
Summary: [4.3 Regression] vectorizer fortran testcases failing
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, ice-on-valid-code, patch
: 29617 (view as bug list)
Depends on:
Blocks: 23983
  Show dependency treegraph
 
Reported: 2006-11-09 11:58 UTC by Dorit Naishlos
Modified: 2006-12-19 08:29 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc*-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-11-12 08:20:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dorit Naishlos 2006-11-09 11:58:54 UTC
Looks like sometime between Oct27 
(http://gcc.gnu.org/ml/gcc-testresults/2006-10/msg01336.html) 
and Oct30 
(http://gcc.gnu.org/ml/gcc-testresults/2006-10/msg01538.html) 
the fortran vectorizer testcases started ICEing on:

gfortran.dg/vect/vect-3.f90:0: warning: 'const' attribute directive ignored
gfortran.dg/vect/vect-3.f90:4: internal compiler error: in vect_setup_realignment, at tree-vect-transform.c:2534

Should be related somehow to this code in rs6000.c:

      /* Initialize target builtin that implements
         targetm.vectorize.builtin_mask_for_load.  */

      decl = add_builtin_function ("__builtin_altivec_mask_for_load",
                                   v16qi_ftype_long_pcvoid,
                                   ALTIVEC_BUILTIN_MASK_FOR_LOAD,
                                   BUILT_IN_MD, NULL,
                                   tree_cons (get_identifier ("const"),
                                              NULL_TREE, NULL_TREE));
 

Anybody knows which patch caused this?
Comment 1 Paul Thomas 2006-11-09 20:04:45 UTC
Dorit,

Nothing stands out in the gfortran patches in that interval, although I am not sure what I am looking for.  I base my remark on the fact that none of the patches between 10/27 and 10/31 would appear to touch that subroutine.  The code generated for vect-3.f90 looks OK, so I would have to suppose that the problem has arisen further downstream.

Regards

Paul
Comment 2 Andrew Pinski 2006-11-11 00:32:26 UTC
Actually I think this bug was caused by:
2006-10-23 Rafael Avila de Espindola  <rafael.espindola@gmail.com>

        * tree.c (local_define_builtin): Replace calls to
        lang_hooks.builtin_function with add_builtin_function.
        * c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as
        c_builtin_function.
        * c-tree.h (builtin_function): Rename to c_builtin_function. Change
        the signature.
        * c-decl.c (builtin_function): Rename to c_builtin_function. Move
        common code to add_builtin_function.
...
Comment 3 Andrew Pinski 2006-11-11 00:34:07 UTC
*** Bug 29617 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2006-11-11 00:36:32 UTC
I am going to look into this, this weekend and see why that patch caused a difference.
Comment 5 Andrew Pinski 2006-11-12 08:20:20 UTC
I am going to try to fix this, it blocks my other work on getting altivec builtins marked as const/pure.
Comment 6 Andrew Pinski 2006-11-12 19:58:57 UTC
This patch should fix the problem:
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c      (revision 118728)
+++ config/rs6000/rs6000.c      (working copy)
@@ -8711,9 +8711,8 @@ altivec_init_builtins (void)
       decl = add_builtin_function ("__builtin_altivec_mask_for_load",
                                   v16qi_ftype_long_pcvoid,
                                   ALTIVEC_BUILTIN_MASK_FOR_LOAD,
-                                  BUILT_IN_MD, NULL,
-                                  tree_cons (get_identifier ("const"),
-                                             NULL_TREE, NULL_TREE));
+                                  BUILT_IN_MD, NULL, NULL);
+      TREE_READONLY (decl) = 1;
       /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
       altivec_builtin_mask_for_load = decl;
     }

I don't think we should be using attributes here really.
Comment 7 Dorit Naishlos 2006-11-17 06:46:45 UTC
(In reply to comment #6)
> This patch should fix the problem:

indeed it does, thanks!
are you going to submit it to mainline?
Comment 8 Andrew Pinski 2006-11-17 15:11:04 UTC
(In reply to comment #7)
> indeed it does, thanks!
> are you going to submit it to mainline?

Should be submitted this weekend, today is a party day for me, launch and all :).
Comment 9 Tobias Burnus 2006-12-05 20:51:59 UTC
I think this was fixed by:
http://gcc.gnu.org/ml/gcc-cvs/2006-11/msg00427.html
Comment 10 Andrew Pinski 2006-12-05 22:15:15 UTC
(In reply to comment #9)
> I think this was fixed by:
> http://gcc.gnu.org/ml/gcc-cvs/2006-11/msg00427.html

No it was not.
Comment 11 Tobias Burnus 2006-12-06 22:10:43 UTC
> > I think this was fixed by:
> > http://gcc.gnu.org/ml/gcc-cvs/2006-11/msg00427.html
> No it was not.
Thanks for checking. (This was actually the PR, for which I asked yesterday on IRC whether it was commited or not.)

By the way, you wrote 2006-11-17:
> Should be submitted this weekend
Any new ETA?
Comment 12 Dorit Naishlos 2006-12-06 22:22:28 UTC
> By the way, you wrote 2006-11-17:
> > Should be submitted this weekend
> Any new ETA?

It was already submitted: 
http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00110.html
Comment 13 Andrew Pinski 2006-12-19 08:28:57 UTC
Subject: Bug 29779

Author: pinskia
Date: Tue Dec 19 08:28:46 2006
New Revision: 120045

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120045
Log:
2006-12-18  Andrew Pinski  <pinskia@gmail.com>

        PR target/29779
        * config/rs6000/rs6000.c (altivec_init_builtins): Change to set
        READONLY on __builtin_altivec_mask_for_load instead of adding
        the attribute.



Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c

Comment 14 Andrew Pinski 2006-12-19 08:29:17 UTC
Fixed.