Safety and legality of optimizations(Re: Optimizing Across && And ||)

Vinod.Grover@Eng.Sun.COM (Vinod Grover)
Sat, 18 Mar 1995 10:12:34 GMT

          From comp.compilers

Related articles
Re: Optimizing Across && And || bart@cs.uoregon.edu (1995-02-23)
Re: Optimizing Across && And || chase@centerline.com (1995-03-14)
Safety and legality of optimizations(Re: Optimizing Across && And ||) Vinod.Grover@Eng.Sun.COM (1995-03-18)
Re: Safety and legality of optimizations cliffc@crocus.hpl.hp.com (1995-03-21)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Vinod.Grover@Eng.Sun.COM (Vinod Grover)
Keywords: optimize, design
Organization: Sun Microsystems Computer Corporation
References: 95-02-179 95-03-086
Date: Sat, 18 Mar 1995 10:12:34 GMT

David Chase <chase@centerline.com> wrote:
>SSA-transformation, though well-documented and delightfully fast
>and elegant, is not the most obvious thing on the face of the earth.
>There are a couple of instances where it is "too good" -- it's
>a relatively straightforward task to write a dead code eliminator
>that performs "infinite optimization" on infinite loops (that is,
>the loop disappears and control falls through).


Yes, but is it safe to eliminate infinite loops? Consider:


      /* fire the rockets if f is null or acyclic */
      void doit_or_die(foo *f, int n) {
          foo *x;
          for (x=f; x; x = x->next) {}
          /* fire 'em */
              ...
      }


Eliminating the loop or moving code across infinite loop can be argued
as unsafe.


Furthermore, this transformation is based on the notion of control
dependence. And one needs to be extra careful when basing
optimizations like above on the notion of control dependences.


Vinod Grover
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.