Combine madness

Mark Mitchell mark@markmitchell.com
Fri Oct 2 13:07:00 GMT 1998


At present, on my x86-linux-gnu system, I'm seeing rather odd behavior
on this test (from c-torture):

  double g ();
  typedef union {
    struct {
      unsigned s:1, e:8, f:23;
    } u;
    float f;
  } s;

  f(x, n)
       float x;
  {
    ((s *)&x)->u.e -= n;
    x = g((double)x, -n);
  }

In particular, combine calls subst, which begins an exponentially
growing process.  The initial input is:

(set (reg/v:SF 26)
    (ior:SF (and:SF (reg/v:SF 26)
            (const_int -65536))
        (and:SF (subreg:SF (reg:HI 38) 0)
            (const_int 65535))))

This grows quickly to things like:

(ior:SF (and:SF (zero_extend:SF (ior:HI (subreg:HI (reg/v:SF 26) 0)
                (reg:HI 32)))
        (ior:SF (ior:SF (zero_extend:SF (ior:HI (subreg:HI (reg/v:SF 26) 0)
                        (reg:HI 32)))
                (const_int -65536))
            (and:SF (ior:SF (zero_extend:SF (ior:HI (subreg:HI (reg/v:SF 26) 0)
                            (reg:HI 32)))
                    (const_int -65536))
                (reg/v:SF 26))))
    (and:SF (and:SF (ior:SF (zero_extend:SF (ior:HI (subreg:HI (reg/v:SF 26) 0)
                        (reg:HI 32)))
                (const_int -65536))
            (reg/v:SF 26))
        (ior:SF (ior:SF (zero_extend:SF (ior:HI (subreg:HI (reg/v:SF 26) 0)
                        (reg:HI 32)))
                (const_int -65536))
            (and:SF (ior:SF (zero_extend:SF (ior:HI (subreg:HI (reg/v:SF 26) 0)
                            (reg:HI 32)))
                    (const_int -65536))
                (reg/v:SF 26)))))

and then to things that fill multiple entire screens.  The CPU is
pegged, and memory usage goes through the roof.  Anybody know what's
going on?

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com



More information about the Gcc-bugs mailing list