[Bug tree-optimization/56049] New: [4.8 Regression] Simplification to constants not done

tkoenig at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 20 10:23:00 GMT 2013


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

             Bug #: 56049
           Summary: [4.8 Regression] Simplification to constants not done
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org


>From http://gcc.gnu.org/ml/fortran/2013-01/msg00158.html :

program inline

    integer i
    integer a(8,8), b(8,8)

    a = 0
    do i = 1, 10000000
        call add(b, a, 1)
        a = b
    end do

    print *, a

contains

    subroutine add(b, a, o)
        integer, intent(inout) :: b(8,8)
        integer, intent(in) :: a(8,8), o
        b = a + o
    end subroutine add

end program inline

is simplified all the way to the final constant with 4.6 and
4.7 (example for 4.6.2):

;; Function inline (MAIN__) (executed once)

inline ()
{
  struct array2_integer(kind=4) parm.3;
  struct __st_parameter_dt dt_parm.2;
  integer(kind=4) a[64];

<bb 2>:
  a = {};
  MEM[(integer(kind=4)[64] *)&a] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 4B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 8B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 12B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 16B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 20B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 24B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 28B] = 10000000;
  MEM[(integer(kind=4)[64] *)&a + 32B] = 10000000;

... and so on.  Current trunk converts this to

;; Function inline (MAIN__, funcdef_no=0, decl_uid=1874, cgraph_uid=1)
(executed once)

inline ()
{
  vector(4) integer(kind=4) vect_var_.16;
  vector(4) integer(kind=4) vect_var_.15;
  vector(4) integer(kind=4) vect_var_.14;
  struct array2_integer(kind=4) parm.3;
  struct __st_parameter_dt dt_parm.2;
  integer(kind=4) b[64];
  integer(kind=4) a[64];
  unsigned int ivtmp_153;
  unsigned int ivtmp_154;

  <bb 2>:
  a = {};

  <bb 3>:
  # ivtmp_154 = PHI <10000000(2), ivtmp_153(4)>
  vect_var_.14_1 = MEM[(integer(kind=4)[64] *)&a];
  vect_var_.15_42 = MEM[(integer(kind=4)[64] *)&a + 16B];
  vect_var_.16_43 = vect_var_.14_1 + { 1, 1, 1, 1 };
  vect_var_.16_44 = vect_var_.15_42 + { 1, 1, 1, 1 };
  MEM[(integer(kind=4)[64] *)&b] = vect_var_.16_43;
  MEM[(integer(kind=4)[64] *)&b + 16B] = vect_var_.16_44;
  vect_var_.14_71 = MEM[(integer(kind=4)[64] *)&a + 32B];
  vect_var_.15_77 = MEM[(integer(kind=4)[64] *)&a + 48B];
  vect_var_.16_78 = vect_var_.14_71 + { 1, 1, 1, 1 };
  vect_var_.16_79 = vect_var_.15_77 + { 1, 1, 1, 1 };



More information about the Gcc-bugs mailing list