Skip to content
  1. Sep 30, 2011
  2. Sep 27, 2011
  3. Sep 06, 2011
  4. Aug 18, 2011
  5. Aug 16, 2011
  6. Aug 15, 2011
  7. Jul 18, 2011
  8. May 29, 2011
  9. May 27, 2011
  10. May 26, 2011
  11. May 22, 2011
    • Frits van Bommel's avatar
      Add a parameter to ConstantFoldTerminator() that callers can use to ask it to... · ad964559
      Frits van Bommel authored
      Add a parameter to ConstantFoldTerminator() that callers can use to ask it to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior.
      
      I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this.
      
      llvm-svn: 131855
      ad964559
  12. May 18, 2011
  13. Apr 09, 2011
  14. Mar 24, 2011
  15. Mar 21, 2011
  16. Mar 19, 2011
    • Daniel Dunbar's avatar
      Revert r127953, "SimplifyCFG has stopped duplicating returns into predecessors · 327cd36f
      Daniel Dunbar authored
      to canonicalize IR", it broke a lot of things.
      
      llvm-svn: 127954
      327cd36f
    • Evan Cheng's avatar
      SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IR · 824a7113
      Evan Cheng authored
      to have single return block (at least getting there) for optimizations. This
      is general goodness but it would prevent some tailcall optimizations.
      One specific case is code like this:
      int f1(void);
      int f2(void);
      int f3(void);
      int f4(void);
      int f5(void);
      int f6(void);
      int foo(int x) {
        switch(x) {
        case 1: return f1();
        case 2: return f2();
        case 3: return f3();
        case 4: return f4();
        case 5: return f5();
        case 6: return f6();
        }
      }
      
      =>
      LBB0_2:                                 ## %sw.bb
        callq   _f1
        popq    %rbp
        ret
      LBB0_3:                                 ## %sw.bb1
        callq   _f2
        popq    %rbp
        ret
      LBB0_4:                                 ## %sw.bb3
        callq   _f3
        popq    %rbp
        ret
      
      This patch teaches codegenprep to duplicate returns when the return value
      is a phi and where the phi operands are produced by tail calls followed by
      an unconditional branch:
      
      sw.bb7:                                           ; preds = %entry
        %call8 = tail call i32 @f5() nounwind
        br label %return
      sw.bb9:                                           ; preds = %entry
        %call10 = tail call i32 @f6() nounwind
        br label %return
      return:
        %retval.0 = phi i32 [ %call10, %sw.bb9 ], [ %call8, %sw.bb7 ], ... [ 0, %entry ]
        ret i32 %retval.0
      
      This allows codegen to generate better code like this:
      
      LBB0_2:                                 ## %sw.bb
              jmp     _f1                     ## TAILCALL
      LBB0_3:                                 ## %sw.bb1
              jmp     _f2                     ## TAILCALL
      LBB0_4:                                 ## %sw.bb3
              jmp     _f3                     ## TAILCALL
      
      rdar://9147433
      
      llvm-svn: 127953
      824a7113
  17. Mar 11, 2011
  18. Mar 05, 2011
  19. Mar 02, 2011
  20. Mar 01, 2011
  21. Jan 18, 2011
  22. Jan 15, 2011
Loading