Skip to content
  1. Oct 11, 2004
  2. Oct 10, 2004
  3. Oct 09, 2004
    • Chris Lattner's avatar
      A testcase that globalopt now handles · ed8d7678
      Chris Lattner authored
      llvm-svn: 16872
      ed8d7678
    • Chris Lattner's avatar
      Eliminate global pointers that are only stored a single value and null if · 09a52729
      Chris Lattner authored
      we know that all uses of the global will trap if the pointer contained is
      null.  In this case, we forward substitute the stored value to any uses.
      
      This has the effect of devirtualizing trivial globals in trivial cases.  For
      example, 164.gzip contains this:
      
      gzip.h:extern   int (*read_buf) OF((char *buf, unsigned size));
      bits.c: read_buf  = file_read;
      deflate.c:    lookahead = read_buf((char*)window,
      deflate.c:        n = read_buf((char*)window+strstart+lookahead, more);
      
      Since read_buf has to point to file_read at every use, we just replace
      the calls through read_buf with a direct call to file_read.
      
      This occurs in several benchmarks, including 176.gcc and 164.gzip.  Direct
      calls are good and stuff.
      
      llvm-svn: 16871
      09a52729
Loading