1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test
Evan Cheng c5f50f7322 SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IR
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
2011-03-19 17:17:39 +00:00
..
Analysis Propagate SCEV no-wrap flags whenever possible. 2011-03-15 00:37:00 +00:00
Archive
Assembler Reapply: Add type output to llvm-dis annotations. Patch by Yuri! 2011-03-17 19:50:04 +00:00
Bindings/Ocaml XFAIL vg_leak the new test as the rest. 2010-12-23 21:22:09 +00:00
Bitcode
BugPoint
CodeGen SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IR 2011-03-19 17:17:39 +00:00
DebugInfo Remove obsolete tests. 2011-02-24 19:09:52 +00:00
ExecutionEngine
Feature
FrontendAda Testcase for dragonegg commit 124128. 2011-01-24 18:04:33 +00:00
FrontendC Disable test to unbreak Linux. Radar 9156771. 2011-03-19 03:56:38 +00:00
FrontendC++ remove a small scattering of basically pointless tests. These are 2011-02-09 16:41:31 +00:00
FrontendFortran
FrontendObjC Testcase for r127301. 2011-03-09 01:05:00 +00:00
FrontendObjC++
Integer
lib
Linker Correctly merge available_externally and regular definitions when they have 2011-02-01 05:33:52 +00:00
LLVMC
MC Fixed an assert by the ARM disassembler for LDRD_PRE/POST. 2011-03-19 01:16:20 +00:00
Object Revert "Object: Renable the tests now that none of the build bots complain about aliasing." 2011-01-21 06:27:04 +00:00
Other
Scripts Print all 64bits for st_value and st_size. Adjust tests accordingly. 2010-12-20 20:49:43 +00:00
TableGen Rename lisp-like functions as suggested by Gabor Greif as loooong time 2011-01-07 17:05:37 +00:00
Transforms Avoid creating canonical induction variables for non-native types. 2011-03-18 16:50:32 +00:00
Unit
Verifier
CMakeLists.txt Put targets on folders, if the IDE supports the feature. 2011-02-20 22:06:10 +00:00
lit.cfg test/lit.cfg: Add PATHEXT to 'substitution', to recognize tools on Windows hosts. Thanks to Danil Malyshev! 2011-02-24 12:34:34 +00:00
lit.site.cfg.in CMake: Add the new option LLVM_LIT_TOOLS_DIR. It can specify "Path to GnuWin32 tools". 2011-02-09 04:18:58 +00:00
Makefile Reapply r127073(partially): Introduce $(ECHOPATH) to print DOSish path string on MSYS bash for alternative of $(ECHO). 2011-03-08 12:25:10 +00:00
Makefile.tests
site.exp.in
TestRunner.sh