1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/lib/Transforms/IPO
Jun Bum Lim d171e076c9 Add CallSiteSplitting pass
Summary:
This change add a pass which tries to split a call-site to pass
more constrained arguments if its argument is predicated in the control flow
so that we can expose better context to the later passes (e.g, inliner, jump
threading, or IPA-CP based function cloning, etc.).
As of now we support two cases :

1) If a call site is dominated by an OR condition and if any of its arguments
are predicated on this OR condition, try to split the condition with more
constrained arguments. For example, in the code below, we try to split the
call site since we can predicate the argument (ptr) based on the OR condition.

Split from :
      if (!ptr || c)
        callee(ptr);
to :
      if (!ptr)
        callee(null ptr)  // set the known constant value
      else if (c)
        callee(nonnull ptr)  // set non-null attribute in the argument

2) We can also split a call-site based on constant incoming values of a PHI
For example,
from :
      BB0:
       %c = icmp eq i32 %i1, %i2
       br i1 %c, label %BB2, label %BB1
      BB1:
       br label %BB2
      BB2:
       %p = phi i32 [ 0, %BB0 ], [ 1, %BB1 ]
       call void @bar(i32 %p)
to
      BB0:
       %c = icmp eq i32 %i1, %i2
       br i1 %c, label %BB2-split0, label %BB1
      BB1:
       br label %BB2-split1
      BB2-split0:
       call void @bar(i32 0)
       br label %BB2
      BB2-split1:
       call void @bar(i32 1)
       br label %BB2
      BB2:
       %p = phi i32 [ 0, %BB2-split0 ], [ 1, %BB2-split1 ]

Reviewers: davidxl, huntergr, chandlerc, mcrosier, eraman, davide

Reviewed By: davidxl

Subscribers: sdesmalen, ashutosh.nema, fhahn, mssimpso, aemerson, mgorny, mehdi_amini, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D39137

llvm-svn: 317351
2017-11-03 19:01:57 +00:00
..
AlwaysInliner.cpp
ArgumentPromotion.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-19 21:21:30 +00:00
BarrierNoopPass.cpp
CalledValuePropagation.cpp Attempt to unbreak the expensive-checks-win bot 2017-10-25 22:46:34 +00:00
CMakeLists.txt Add CalledValuePropagation pass 2017-10-25 13:40:08 +00:00
ConstantMerge.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
CrossDSOCFI.cpp [cfi] Fixed non-determinism in codegen due to DenseSet iteration order 2017-08-30 04:47:21 +00:00
DeadArgumentElimination.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
ElimAvailExtern.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
ExtractGV.cpp [ExtractGV] Fix the doxygen comment on the constructor and the class to refer to global values instead of functions. While there fix an 80 column violation. NFC 2017-06-08 23:38:19 +00:00
ForceFunctionAttrs.cpp Add strictfp attribute to prevent unwanted optimizations of libm calls 2017-08-14 21:15:13 +00:00
FunctionAttrs.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-19 21:21:30 +00:00
FunctionImport.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
GlobalDCE.cpp [GlobalDCE] Use DenseMap instead of unordered_multimap for GVDependencies. 2017-10-17 23:47:06 +00:00
GlobalOpt.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
GlobalSplit.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
InferFunctionAttrs.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Inliner.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-19 21:21:30 +00:00
InlineSimple.cpp [Inliner] Only compute fully inline cost when remarks are enabled. 2017-08-25 22:01:42 +00:00
Internalize.cpp
IPConstantPropagation.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
IPO.cpp Add CalledValuePropagation pass 2017-10-25 13:40:08 +00:00
LLVMBuild.txt
LoopExtractor.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
LowerTypeTests.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-19 21:21:30 +00:00
MergeFunctions.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-19 21:21:30 +00:00
PartialInlining.cpp [PartialInliner] Skip call sites where inlining fails. 2017-11-03 11:29:00 +00:00
PassManagerBuilder.cpp Add CallSiteSplitting pass 2017-11-03 19:01:57 +00:00
PruneEH.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
SampleProfile.cpp Include GUIDs from the same module when computing GUIDs that needs to be imported. 2017-11-01 20:26:47 +00:00
StripDeadPrototypes.cpp
StripSymbols.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ThinLTOBitcodeWriter.cpp ThinLTO Minimized Bitcode File Size Reduction 2017-07-21 17:25:20 +00:00
WholeProgramDevirt.cpp Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.* 2017-10-09 23:19:02 +00:00