Skip to content
  1. Apr 10, 2004
    • Chris Lattner's avatar
      Implement select.ll:test12* · 56e4d3d8
      Chris Lattner authored
      This transforms code like this:
      
         %C = or %A, %B
         %D = select %cond, %C, %A
      into:
         %C = select %cond, %B, 0
         %D = or %A, %C
      
      Since B is often a constant, the select can often be eliminated.  In any case,
      this reduces the usage count of A, allowing subsequent optimizations to happen.
      
      This xform applies when the operator is any of:
        add, sub, mul, or, xor, and, shl, shr
      
      llvm-svn: 12800
      56e4d3d8
    • Chris Lattner's avatar
      Fold code like: · 0aa56564
      Chris Lattner authored
        if (C)
          V1 |= V2;
      
      into:
        Vx = V1 | V2;
        V1 = select C, V1, Vx
      
      when the expression can be evaluated unconditionally and is *cheap* to
      execute.  This limited form of if conversion is quite handy in lots of cases.
      For example, it turns this testcase into straight-line code:
      
      int in0 ; int in1 ; int in2 ; int in3 ;
      int in4 ; int in5 ; int in6 ; int in7 ;
      int in8 ; int in9 ; int in10; int in11;
      int in12; int in13; int in14; int in15;
      long output;
      
      void mux(void) {
        output =
            (in0   ?  0x00000001 : 0) | (in1   ?  0x00000002 : 0) |
            (in2   ?  0x00000004 : 0) | (in3   ?  0x00000008 : 0) |
            (in4   ?  0x00000010 : 0) | (in5   ?  0x00000020 : 0) |
            (in6   ?  0x00000040 : 0) | (in7   ?  0x00000080 : 0) |
            (in8   ?  0x00000100 : 0) | (in9   ?  0x00000200 : 0) |
            (in10  ?  0x00000400 : 0) | (in11  ?  0x00000800 : 0) |
            (in12  ?  0x00001000 : 0) | (in13  ?  0x00002000 : 0) |
            (in14  ?  0x00004000 : 0) | (in15  ?  0x00008000 : 0) ;
      }
      
      llvm-svn: 12798
      0aa56564
  2. Apr 09, 2004
  3. Apr 08, 2004
  4. Apr 07, 2004
  5. Apr 05, 2004
  6. Apr 02, 2004
  7. Apr 01, 2004
  8. Mar 31, 2004
  9. Mar 30, 2004
  10. Mar 26, 2004
  11. Mar 25, 2004
    • Chris Lattner's avatar
      Two changes: · 57c67b06
      Chris Lattner authored
      #1 is to unconditionally strip constantpointerrefs out of
      instruction operands where they are absolutely pointless and inhibit
      optimization.  GRRR!
      
      #2 is to implement InstCombine/getelementptr_const.ll
      
      llvm-svn: 12519
      57c67b06
  12. Mar 19, 2004
  13. Mar 18, 2004
  14. Mar 17, 2004
    • Chris Lattner's avatar
      Fix compilation of mesa, which I broke earlier today · a078f47b
      Chris Lattner authored
      llvm-svn: 12465
      a078f47b
    • Chris Lattner's avatar
      Be more accurate · 684fa5ac
      Chris Lattner authored
      llvm-svn: 12464
      684fa5ac
    • Chris Lattner's avatar
      Fix bug in previous checkin · a3783a57
      Chris Lattner authored
      llvm-svn: 12458
      a3783a57
    • Chris Lattner's avatar
      Okay, so there is no reasonable way for tail duplication to update SSA form, · 95057f6a
      Chris Lattner authored
      as it is making effectively arbitrary modifications to the CFG and we don't
      have a domset/domfrontier implementations that can handle the dynamic updates.
      Instead of having a bunch of code that doesn't actually work in practice,
      just demote any potentially tricky values to the stack (causing the problem
      to go away entirely).  Later invocations of mem2reg will rebuild SSA for us.
      
      This fixes all of the major performance regressions with tail duplication
      from LLVM 1.1.  For example, this loop:
      
      ---
      int popcount(int x) {
        int result = 0;
        while (x != 0) {
          result = result + (x & 0x1);
          x = x >> 1;
        }
        return result;
      }
      ---
      Used to be compiled into:
      
      int %popcount(int %X) {
      entry:
      	br label %loopentry
      
      loopentry:		; preds = %entry, %no_exit
      	%x.0 = phi int [ %X, %entry ], [ %tmp.9, %no_exit ]		; <int> [#uses=3]
      	%result.1.0 = phi int [ 0, %entry ], [ %tmp.6, %no_exit ]		; <int> [#uses=2]
      	%tmp.1 = seteq int %x.0, 0		; <bool> [#uses=1]
      	br bool %tmp.1, label %loopexit, label %no_exit
      
      no_exit:		; preds = %loopentry
      	%tmp.4 = and int %x.0, 1		; <int> [#uses=1]
      	%tmp.6 = add int %tmp.4, %result.1.0		; <int> [#uses=1]
      	%tmp.9 = shr int %x.0, ubyte 1		; <int> [#uses=1]
      	br label %loopentry
      
      loopexit:		; preds = %loopentry
      	ret int %result.1.0
      }
      
      And is now compiled into:
      
      int %popcount(int %X) {
      entry:
              br label %no_exit
      
      no_exit:                ; preds = %entry, %no_exit
              %x.0.0 = phi int [ %X, %entry ], [ %tmp.9, %no_exit ]          ; <int> [#uses=2]
              %result.1.0.0 = phi int [ 0, %entry ], [ %tmp.6, %no_exit ]             ; <int> [#uses=1]
              %tmp.4 = and int %x.0.0, 1              ; <int> [#uses=1]
              %tmp.6 = add int %tmp.4, %result.1.0.0          ; <int> [#uses=2]
              %tmp.9 = shr int %x.0.0, ubyte 1                ; <int> [#uses=2]
              %tmp.1 = seteq int %tmp.9, 0            ; <bool> [#uses=1]
              br bool %tmp.1, label %loopexit, label %no_exit
      
      loopexit:               ; preds = %no_exit
              ret int %tmp.6
      }
      
      llvm-svn: 12457
      95057f6a
Loading