Skip to content
  1. Jun 20, 2011
    • Jay Foad's avatar
      Make better use of the PHINode API. · 372ad64b
      Jay Foad authored
      Change various bits of code to make better use of the existing PHINode
      API, to insulate them from forthcoming changes in how PHINodes store
      their operands.
      
      llvm-svn: 133434
      372ad64b
  2. Apr 29, 2011
  3. Apr 09, 2011
  4. Feb 15, 2011
  5. Jan 11, 2011
  6. Jan 08, 2011
    • Chris Lattner's avatar
      When loop rotation happens, it is *very* common for the duplicated condbr · 59c82f85
      Chris Lattner authored
      to be foldable into an uncond branch.  When this happens, we can make a
      much simpler CFG for the loop, which is important for nested loop cases
      where we want the outer loop to be aggressively optimized.
      
      Handle this case more aggressively.  For example, previously on
      phi-duplicate.ll we would get this:
      
      
      define void @test(i32 %N, double* %G) nounwind ssp {
      entry:
        %cmp1 = icmp slt i64 1, 1000
        br i1 %cmp1, label %bb.nph, label %for.end
      
      bb.nph:                                           ; preds = %entry
        br label %for.body
      
      for.body:                                         ; preds = %bb.nph, %for.cond
        %j.02 = phi i64 [ 1, %bb.nph ], [ %inc, %for.cond ]
        %arrayidx = getelementptr inbounds double* %G, i64 %j.02
        %tmp3 = load double* %arrayidx
        %sub = sub i64 %j.02, 1
        %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
        %tmp7 = load double* %arrayidx6
        %add = fadd double %tmp3, %tmp7
        %arrayidx10 = getelementptr inbounds double* %G, i64 %j.02
        store double %add, double* %arrayidx10
        %inc = add nsw i64 %j.02, 1
        br label %for.cond
      
      for.cond:                                         ; preds = %for.body
        %cmp = icmp slt i64 %inc, 1000
        br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
      
      for.cond.for.end_crit_edge:                       ; preds = %for.cond
        br label %for.end
      
      for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry
        ret void
      }
      
      Now we get the much nicer:
      
      define void @test(i32 %N, double* %G) nounwind ssp {
      entry:
        br label %for.body
      
      for.body:                                         ; preds = %entry, %for.body
        %j.01 = phi i64 [ 1, %entry ], [ %inc, %for.body ]
        %arrayidx = getelementptr inbounds double* %G, i64 %j.01
        %tmp3 = load double* %arrayidx
        %sub = sub i64 %j.01, 1
        %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
        %tmp7 = load double* %arrayidx6
        %add = fadd double %tmp3, %tmp7
        %arrayidx10 = getelementptr inbounds double* %G, i64 %j.01
        store double %add, double* %arrayidx10
        %inc = add nsw i64 %j.01, 1
        %cmp = icmp slt i64 %inc, 1000
        br i1 %cmp, label %for.body, label %for.end
      
      for.end:                                          ; preds = %for.body
        ret void
      }
      
      With all of these recent changes, we are now able to compile:
      
      void foo(char *X) {
       for (int i = 0; i != 100; ++i) 
         for (int j = 0; j != 100; ++j)
           X[j+i*100] = 0;
      }
      
      into a single memset of 10000 bytes.  This series of changes
      should also be helpful for other nested loop scenarios as well.
      
      llvm-svn: 123079
      59c82f85
    • Chris Lattner's avatar
      split ssa updating code out to its own helper function. Don't bother · 30f318e5
      Chris Lattner authored
      moving the OrigHeader block anymore: we just merge it away anyway so
      its code layout doesn't matter.
      
      llvm-svn: 123077
      30f318e5
    • Chris Lattner's avatar
      Implement a TODO: Enhance loopinfo to merge away the unconditional branch · 2615130e
      Chris Lattner authored
      that it was leaving in loops after rotation (between the original latch
      block and the original header.
      
      With this change, it is possible for rotated loops to have just a single
      basic block, which is useful.
      
      llvm-svn: 123075
      2615130e
    • Chris Lattner's avatar
      inline preserveCanonicalLoopForm now that it is simple. · fee37c5f
      Chris Lattner authored
      llvm-svn: 123073
      fee37c5f
    • Chris Lattner's avatar
      Three major changes: · 063dca0f
      Chris Lattner authored
      1. Rip out LoopRotate's domfrontier updating code.  It isn't
         needed now that LICM doesn't use DF and it is super complex
         and gross.
      2. Make DomTree updating code a lot simpler and faster.  The 
         old loop over all the blocks was just to find a block??
      3. Change the code that inserts the new preheader to just use
         SplitCriticalEdge instead of doing an overcomplex 
         reimplementation of it.
      
      No behavior change, except for the name of the inserted preheader.
      
      llvm-svn: 123072
      063dca0f
    • Chris Lattner's avatar
      LoopRotate requires canonical loop form, so it always has preheaders · 7fab23bc
      Chris Lattner authored
      and latch blocks.  Reorder entry conditions to make hte pass faster
      and more logical.
      
      llvm-svn: 123069
      7fab23bc
    • Chris Lattner's avatar
      use the LI ivar. · d62691f4
      Chris Lattner authored
      llvm-svn: 123068
      d62691f4
    • Chris Lattner's avatar
      some cleanups: remove dead arguments and eliminate ivars · 385f2ec6
      Chris Lattner authored
      that are just passed to one function.
      
      llvm-svn: 123067
      385f2ec6
    • Chris Lattner's avatar
      fix an issue duncan pointed out, which could cause loop rotate · 25ba40a0
      Chris Lattner authored
      to violate LCSSA form
      
      llvm-svn: 123066
      25ba40a0
    • Chris Lattner's avatar
      Have loop-rotate simplify instructions (yay instsimplify!) as it clones · 8c5defd0
      Chris Lattner authored
      them into the loop preheader, eliminating silly instructions like
      "icmp i32 0, 100" in fixed tripcount loops.  This also better exposes the 
      bigger problem with loop rotate that I'd like to fix: once this has been
      folded, the duplicated conditional branch *often* turns into an uncond branch.
      
      Not aggressively handling this is pessimizing later loop optimizations 
      somethin' fierce by making "dominates all exit blocks" checks fail.
      
      llvm-svn: 123060
      8c5defd0
    • Chris Lattner's avatar
      Revamp the ValueMapper interfaces in a couple ways: · 43f8d164
      Chris Lattner authored
      1. Take a flags argument instead of a bool.  This makes
         it more clear to the reader what it is used for.
      2. Add a flag that says that "remapping a value not in the
         map is ok".
      3. Reimplement MapValue to share a bunch of code and be a lot
         more efficient.  For lookup failures, don't drop null values
         into the map.
      4. Using the new flag a bunch of code can vaporize in LinkModules
         and LoopUnswitch, kill it.
      
      No functionality change.
      
      llvm-svn: 123058
      43f8d164
    • Chris Lattner's avatar
      two minor changes: switch to the standard ValueToValueMapTy · 2b3f20e6
      Chris Lattner authored
      map from ValueMapper.h (giving us access to its utilities)
      and add a fastpath in the loop rotation code, avoiding expensive
      ssa updator manipulation for values with nothing to update.
      
      llvm-svn: 123057
      2b3f20e6
  7. Jan 02, 2011
  8. Oct 19, 2010
    • Owen Anderson's avatar
      Passes do not need to recursively initialize passes that they preserve, if · a4fefc19
      Owen Anderson authored
      they do not also require them.  This allows us to reduce inter-pass linkage
      dependencies.
      
      llvm-svn: 116854
      a4fefc19
    • Owen Anderson's avatar
      Get rid of static constructors for pass registration. Instead, every pass... · 6c18d1aa
      Owen Anderson authored
      Get rid of static constructors for pass registration.  Instead, every pass exposes an initializeMyPassFunction(), which
      must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
      the pass's dependencies.
      
      Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
      CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
      before parsing commandline arguments.
      
      I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
      with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
      registration/creation, please send the testcase to me directly.
      
      llvm-svn: 116820
      6c18d1aa
  9. Oct 12, 2010
  10. Oct 08, 2010
  11. Sep 06, 2010
    • Chris Lattner's avatar
      Teach loop rotate to hoist trivially invariant instructions · b01c24a9
      Chris Lattner authored
      in the duplicated block instead of duplicating them.  
      
      Duplicating them into the end of the loop and the preheader 
      means that we got a phi node in the header of the loop, 
      which prevented LICM from hoisting them.  GVN would
      usually come around later and merge the duplicated 
      instructions so we'd get reasonable output... except that
      anything dependent on the shoulda-been-hoisted value can't
      be hoisted.  In PR5319 (which this fixes), a memory value
      didn't get promoted.
      
      llvm-svn: 113134
      b01c24a9
  12. Sep 02, 2010
    • Duncan Sands's avatar
      Reapply commit 112699, speculatively reverted by echristo, since · 6778149f
      Duncan Sands authored
      I'm sure it is harmless.  Original commit message:
      If PrototypeValue is erased in the middle of using the SSAUpdator
      then the SSAUpdator may access freed memory.  Instead, simply pass
      in the type and name explicitly, which is all that was used anyway.
      
      llvm-svn: 112810
      6778149f
  13. Sep 01, 2010
  14. Aug 17, 2010
  15. Aug 06, 2010
  16. Jul 22, 2010
  17. Jul 16, 2010
  18. Jun 22, 2010
  19. Nov 05, 2009
  20. Oct 31, 2009
  21. Oct 26, 2009
  22. Oct 25, 2009
Loading