LLVM  14.0.0git
Cloning.h
Go to the documentation of this file.
1 //===- Cloning.h - Clone various parts of LLVM programs ---------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines various functions that are used to clone chunks of LLVM
10 // code for various purposes. This varies from copying whole modules into new
11 // modules, to cloning functions with different arguments, to inlining
12 // functions, to copying basic blocks to support loop unrolling or superblock
13 // formation, etc.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_TRANSFORMS_UTILS_CLONING_H
18 #define LLVM_TRANSFORMS_UTILS_CLONING_H
19 
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/Twine.h"
24 #include "llvm/IR/ValueHandle.h"
26 #include <functional>
27 #include <memory>
28 #include <vector>
29 
30 namespace llvm {
31 
32 class AAResults;
33 class AllocaInst;
34 class BasicBlock;
35 class BlockFrequencyInfo;
36 class CallInst;
37 class CallGraph;
38 class DebugInfoFinder;
39 class DominatorTree;
40 class Function;
41 class Instruction;
42 class InvokeInst;
43 class Loop;
44 class LoopInfo;
45 class Module;
46 class ProfileSummaryInfo;
47 class ReturnInst;
48 class DomTreeUpdater;
49 
50 /// Return an exact copy of the specified module
51 std::unique_ptr<Module> CloneModule(const Module &M);
52 std::unique_ptr<Module> CloneModule(const Module &M, ValueToValueMapTy &VMap);
53 
54 /// Return a copy of the specified module. The ShouldCloneDefinition function
55 /// controls whether a specific GlobalValue's definition is cloned. If the
56 /// function returns false, the module copy will contain an external reference
57 /// in place of the global definition.
58 std::unique_ptr<Module>
60  function_ref<bool(const GlobalValue *)> ShouldCloneDefinition);
61 
62 /// This struct can be used to capture information about code
63 /// being cloned, while it is being cloned.
65  /// This is set to true if the cloned code contains a normal call instruction.
66  bool ContainsCalls = false;
67 
68  /// This is set to true if the cloned code contains a 'dynamic' alloca.
69  /// Dynamic allocas are allocas that are either not in the entry block or they
70  /// are in the entry block but are not a constant size.
71  bool ContainsDynamicAllocas = false;
72 
73  /// All cloned call sites that have operand bundles attached are appended to
74  /// this vector. This vector may contain nulls or undefs if some of the
75  /// originally inserted callsites were DCE'ed after they were cloned.
76  std::vector<WeakTrackingVH> OperandBundleCallSites;
77 
78  /// Like VMap, but maps only unsimplified instructions. Values in the map
79  /// may be dangling, it is only intended to be used via isSimplified(), to
80  /// check whether the main VMap mapping involves simplification or not.
82 
83  ClonedCodeInfo() = default;
84 
85  bool isSimplified(const Value *From, const Value *To) const {
86  return OrigVMap.lookup(From) != To;
87  }
88 };
89 
90 /// Return a copy of the specified basic block, but without
91 /// embedding the block into a particular function. The block returned is an
92 /// exact copy of the specified basic block, without any remapping having been
93 /// performed. Because of this, this is only suitable for applications where
94 /// the basic block will be inserted into the same function that it was cloned
95 /// from (loop unrolling would use this, for example).
96 ///
97 /// Also, note that this function makes a direct copy of the basic block, and
98 /// can thus produce illegal LLVM code. In particular, it will copy any PHI
99 /// nodes from the original block, even though there are no predecessors for the
100 /// newly cloned block (thus, phi nodes will have to be updated). Also, this
101 /// block will branch to the old successors of the original block: these
102 /// successors will have to have any PHI nodes updated to account for the new
103 /// incoming edges.
104 ///
105 /// The correlation between instructions in the source and result basic blocks
106 /// is recorded in the VMap map.
107 ///
108 /// If you have a particular suffix you'd like to use to add to any cloned
109 /// names, specify it as the optional third parameter.
110 ///
111 /// If you would like the basic block to be auto-inserted into the end of a
112 /// function, you can specify it as the optional fourth parameter.
113 ///
114 /// If you would like to collect additional information about the cloned
115 /// function, you can specify a ClonedCodeInfo object with the optional fifth
116 /// parameter.
118  const Twine &NameSuffix = "", Function *F = nullptr,
119  ClonedCodeInfo *CodeInfo = nullptr,
120  DebugInfoFinder *DIFinder = nullptr);
121 
122 /// Return a copy of the specified function and add it to that
123 /// function's module. Also, any references specified in the VMap are changed
124 /// to refer to their mapped value instead of the original one. If any of the
125 /// arguments to the function are in the VMap, the arguments are deleted from
126 /// the resultant function. The VMap is updated to include mappings from all of
127 /// the instructions and basicblocks in the function from their old to new
128 /// values. The final argument captures information about the cloned code if
129 /// non-null.
130 ///
131 /// \pre VMap contains no non-identity GlobalValue mappings.
132 ///
133 Function *CloneFunction(Function *F, ValueToValueMapTy &VMap,
134  ClonedCodeInfo *CodeInfo = nullptr);
135 
140  ClonedModule,
141 };
142 
143 /// Clone OldFunc into NewFunc, transforming the old arguments into references
144 /// to VMap values. Note that if NewFunc already has basic blocks, the ones
145 /// cloned into it will be added to the end of the function. This function
146 /// fills in a list of return instructions, and can optionally remap types
147 /// and/or append the specified suffix to all values cloned.
148 ///
149 /// If \p Changes is \a CloneFunctionChangeType::LocalChangesOnly, VMap is
150 /// required to contain no non-identity GlobalValue mappings. Otherwise,
151 /// referenced metadata will be cloned.
152 ///
153 /// If \p Changes is less than \a CloneFunctionChangeType::DifferentModule
154 /// indicating cloning into the same module (even if it's LocalChangesOnly), if
155 /// debug info metadata transitively references a \a DISubprogram, it will be
156 /// cloned, effectively upgrading \p Changes to GlobalChanges while suppressing
157 /// cloning of types and compile units.
158 ///
159 /// If \p Changes is \a CloneFunctionChangeType::DifferentModule, the new
160 /// module's \c !llvm.dbg.cu will get updated with any newly created compile
161 /// units. (\a CloneFunctionChangeType::ClonedModule leaves that work for the
162 /// caller.)
163 ///
164 /// FIXME: Consider simplifying this function by splitting out \a
165 /// CloneFunctionMetadataInto() and expecting / updating callers to call it
166 /// first when / how it's needed.
167 void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
169  SmallVectorImpl<ReturnInst *> &Returns,
170  const char *NameSuffix = "",
171  ClonedCodeInfo *CodeInfo = nullptr,
172  ValueMapTypeRemapper *TypeMapper = nullptr,
173  ValueMaterializer *Materializer = nullptr);
174 
175 void CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc,
176  const Instruction *StartingInst,
177  ValueToValueMapTy &VMap, bool ModuleLevelChanges,
178  SmallVectorImpl<ReturnInst *> &Returns,
179  const char *NameSuffix = "",
180  ClonedCodeInfo *CodeInfo = nullptr);
181 
182 /// This works exactly like CloneFunctionInto,
183 /// except that it does some simple constant prop and DCE on the fly. The
184 /// effect of this is to copy significantly less code in cases where (for
185 /// example) a function call with constant arguments is inlined, and those
186 /// constant arguments cause a significant amount of code in the callee to be
187 /// dead. Since this doesn't produce an exactly copy of the input, it can't be
188 /// used for things like CloneFunction or CloneModule.
189 ///
190 /// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue
191 /// mappings.
192 ///
193 void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
194  ValueToValueMapTy &VMap, bool ModuleLevelChanges,
195  SmallVectorImpl<ReturnInst*> &Returns,
196  const char *NameSuffix = "",
197  ClonedCodeInfo *CodeInfo = nullptr);
198 
199 /// This class captures the data input to the InlineFunction call, and records
200 /// the auxiliary results produced by it.
202 public:
204  CallGraph *cg = nullptr,
206  ProfileSummaryInfo *PSI = nullptr,
207  BlockFrequencyInfo *CallerBFI = nullptr,
208  BlockFrequencyInfo *CalleeBFI = nullptr, bool UpdateProfile = true)
212 
213  /// If non-null, InlineFunction will update the callgraph to reflect the
214  /// changes it makes.
219 
220  /// InlineFunction fills this in with all static allocas that get copied into
221  /// the caller.
223 
224  /// InlineFunction fills this in with callsites that were inlined from the
225  /// callee. This is only filled in if CG is non-null.
227 
228  /// All of the new call sites inlined into the caller.
229  ///
230  /// 'InlineFunction' fills this in by scanning the inlined instructions, and
231  /// only if CG is null. If CG is non-null, instead the value handle
232  /// `InlinedCalls` above is used.
234 
235  /// Update profile for callee as well as cloned version. We need to do this
236  /// for regular inlining, but not for inlining from sample profile loader.
238 
239  void reset() {
240  StaticAllocas.clear();
241  InlinedCalls.clear();
242  InlinedCallSites.clear();
243  }
244 };
245 
246 /// This function inlines the called function into the basic
247 /// block of the caller. This returns false if it is not possible to inline
248 /// this call. The program is still in a well defined state if this occurs
249 /// though.
250 ///
251 /// Note that this only does one level of inlining. For example, if the
252 /// instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now
253 /// exists in the instruction stream. Similarly this will inline a recursive
254 /// function by one level.
255 ///
256 /// Note that while this routine is allowed to cleanup and optimize the
257 /// *inlined* code to minimize the actual inserted code, it must not delete
258 /// code in the caller as users of this routine may have pointers to
259 /// instructions in the caller that need to remain stable.
260 ///
261 /// If ForwardVarArgsTo is passed, inlining a function with varargs is allowed
262 /// and all varargs at the callsite will be passed to any calls to
263 /// ForwardVarArgsTo. The caller of InlineFunction has to make sure any varargs
264 /// are only used by ForwardVarArgsTo.
265 InlineResult InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
266  AAResults *CalleeAAR = nullptr,
267  bool InsertLifetime = true,
268  Function *ForwardVarArgsTo = nullptr);
269 
270 /// Clones a loop \p OrigLoop. Returns the loop and the blocks in \p
271 /// Blocks.
272 ///
273 /// Updates LoopInfo and DominatorTree assuming the loop is dominated by block
274 /// \p LoopDomBB. Insert the new blocks before block specified in \p Before.
275 /// Note: Only innermost loops are supported.
276 Loop *cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB,
277  Loop *OrigLoop, ValueToValueMapTy &VMap,
278  const Twine &NameSuffix, LoopInfo *LI,
279  DominatorTree *DT,
280  SmallVectorImpl<BasicBlock *> &Blocks);
281 
282 /// Remaps instructions in \p Blocks using the mapping in \p VMap.
283 void remapInstructionsInBlocks(const SmallVectorImpl<BasicBlock *> &Blocks,
284  ValueToValueMapTy &VMap);
285 
286 /// Split edge between BB and PredBB and duplicate all non-Phi instructions
287 /// from BB between its beginning and the StopAt instruction into the split
288 /// block. Phi nodes are not duplicated, but their uses are handled correctly:
289 /// we replace them with the uses of corresponding Phi inputs. ValueMapping
290 /// is used to map the original instructions from BB to their newly-created
291 /// copies. Returns the split block.
293  BasicBlock *PredBB,
294  Instruction *StopAt,
295  ValueToValueMapTy &ValueMapping,
296  DomTreeUpdater &DTU);
297 
298 /// Updates profile information by adjusting the entry count by adding
299 /// entryDelta then scaling callsite information by the new count divided by the
300 /// old count. VMap is used during inlinng to also update the new clone
302  Function *Callee, int64_t entryDelta,
303  const ValueMap<const Value *, WeakTrackingVH> *VMap = nullptr);
304 
305 /// Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified
306 /// basic blocks and extract their scope. These are candidates for duplication
307 /// when cloning.
309  ArrayRef<BasicBlock *> BBs, SmallVectorImpl<MDNode *> &NoAliasDeclScopes);
310 
311 /// Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified
312 /// instruction range and extract their scope. These are candidates for
313 /// duplication when cloning.
316  SmallVectorImpl<MDNode *> &NoAliasDeclScopes);
317 
318 /// Duplicate the specified list of noalias decl scopes.
319 /// The 'Ext' string is added as an extension to the name.
320 /// Afterwards, the ClonedScopes contains the mapping of the original scope
321 /// MDNode onto the cloned scope.
322 /// Be aware that the cloned scopes are still part of the original scope domain.
323 void cloneNoAliasScopes(
324  ArrayRef<MDNode *> NoAliasDeclScopes,
325  DenseMap<MDNode *, MDNode *> &ClonedScopes,
326  StringRef Ext, LLVMContext &Context);
327 
328 /// Adapt the metadata for the specified instruction according to the
329 /// provided mapping. This is normally used after cloning an instruction, when
330 /// some noalias scopes needed to be cloned.
331 void adaptNoAliasScopes(
332  llvm::Instruction *I, const DenseMap<MDNode *, MDNode *> &ClonedScopes,
333  LLVMContext &Context);
334 
335 /// Clone the specified noalias decl scopes. Then adapt all instructions in the
336 /// NewBlocks basicblocks to the cloned versions.
337 /// 'Ext' will be added to the duplicate scope names.
338 void cloneAndAdaptNoAliasScopes(ArrayRef<MDNode *> NoAliasDeclScopes,
339  ArrayRef<BasicBlock *> NewBlocks,
340  LLVMContext &Context, StringRef Ext);
341 
342 /// Clone the specified noalias decl scopes. Then adapt all instructions in the
343 /// [IStart, IEnd] (IEnd included !) range to the cloned versions. 'Ext' will be
344 /// added to the duplicate scope names.
345 void cloneAndAdaptNoAliasScopes(ArrayRef<MDNode *> NoAliasDeclScopes,
346  Instruction *IStart, Instruction *IEnd,
347  LLVMContext &Context, StringRef Ext);
348 } // end namespace llvm
349 
350 #endif // LLVM_TRANSFORMS_UTILS_CLONING_H
AssumptionCache.h
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::ClonedCodeInfo
This struct can be used to capture information about code being cloned, while it is being cloned.
Definition: Cloning.h:64
ValueMapper.h
llvm::BasicBlock::iterator
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:90
llvm::cloneLoopWithPreheader
Loop * cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB, Loop *OrigLoop, ValueToValueMapTy &VMap, const Twine &NameSuffix, LoopInfo *LI, DominatorTree *DT, SmallVectorImpl< BasicBlock * > &Blocks)
Clones a loop OrigLoop.
Definition: CloneFunction.cpp:801
llvm::Function
Definition: Function.h:62
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::CallGraph
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:73
llvm::CloneFunctionChangeType::ClonedModule
@ ClonedModule
llvm::CloneFunctionChangeType::DifferentModule
@ DifferentModule
llvm::updateProfileCallee
void updateProfileCallee(Function *Callee, int64_t entryDelta, const ValueMap< const Value *, WeakTrackingVH > *VMap=nullptr)
Updates profile information by adjusting the entry count by adding entryDelta then scaling callsite i...
Definition: InlineFunction.cpp:1610
llvm::CloneFunctionChangeType::LocalChangesOnly
@ LocalChangesOnly
llvm::InlineFunctionInfo::InlineFunctionInfo
InlineFunctionInfo(CallGraph *cg=nullptr, function_ref< AssumptionCache &(Function &)> GetAssumptionCache=nullptr, ProfileSummaryInfo *PSI=nullptr, BlockFrequencyInfo *CallerBFI=nullptr, BlockFrequencyInfo *CalleeBFI=nullptr, bool UpdateProfile=true)
Definition: Cloning.h:203
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::InlineFunctionInfo::CallerBFI
BlockFrequencyInfo * CallerBFI
Definition: Cloning.h:218
llvm::InlineFunctionInfo::PSI
ProfileSummaryInfo * PSI
Definition: Cloning.h:217
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition: BlockFrequencyInfo.h:37
llvm::InlineFunctionInfo::CG
CallGraph * CG
If non-null, InlineFunction will update the callgraph to reflect the changes it makes.
Definition: Cloning.h:215
Twine.h
llvm::remapInstructionsInBlocks
void remapInstructionsInBlocks(const SmallVectorImpl< BasicBlock * > &Blocks, ValueToValueMapTy &VMap)
Remaps instructions in Blocks using the mapping in VMap.
Definition: CloneFunction.cpp:787
llvm::ClonedCodeInfo::OperandBundleCallSites
std::vector< WeakTrackingVH > OperandBundleCallSites
All cloned call sites that have operand bundles attached are appended to this vector.
Definition: Cloning.h:76
llvm::Instruction
Definition: Instruction.h:45
llvm::ClonedCodeInfo::isSimplified
bool isSimplified(const Value *From, const Value *To) const
Definition: Cloning.h:85
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition: ProfileSummaryInfo.h:39
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:168
llvm::cloneAndAdaptNoAliasScopes
void cloneAndAdaptNoAliasScopes(ArrayRef< MDNode * > NoAliasDeclScopes, ArrayRef< BasicBlock * > NewBlocks, LLVMContext &Context, StringRef Ext)
Clone the specified noalias decl scopes.
Definition: CloneFunction.cpp:991
llvm::ClonedCodeInfo::ClonedCodeInfo
ClonedCodeInfo()=default
llvm::CloneBasicBlock
BasicBlock * CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix="", Function *F=nullptr, ClonedCodeInfo *CodeInfo=nullptr, DebugInfoFinder *DIFinder=nullptr)
Return a copy of the specified basic block, but without embedding the block into a particular functio...
Definition: CloneFunction.cpp:43
llvm::DuplicateInstructionsInSplitBetween
BasicBlock * DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB, Instruction *StopAt, ValueToValueMapTy &ValueMapping, DomTreeUpdater &DTU)
Split edge between BB and PredBB and duplicate all non-Phi instructions from BB between its beginning...
Definition: CloneFunction.cpp:887
llvm::MipsISD::Ext
@ Ext
Definition: MipsISelLowering.h:156
llvm::InlineFunctionInfo::InlinedCalls
SmallVector< WeakTrackingVH, 8 > InlinedCalls
InlineFunction fills this in with callsites that were inlined from the callee.
Definition: Cloning.h:226
llvm::DenseMap
Definition: DenseMap.h:714
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::adaptNoAliasScopes
void adaptNoAliasScopes(llvm::Instruction *I, const DenseMap< MDNode *, MDNode * > &ClonedScopes, LLVMContext &Context)
Adapt the metadata for the specified instruction according to the provided mapping.
Definition: CloneFunction.cpp:957
llvm::ValueToValueMapTy
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
Definition: MemorySSAUpdater.h:52
InlineCost.h
llvm::cloneNoAliasScopes
void cloneNoAliasScopes(ArrayRef< MDNode * > NoAliasDeclScopes, DenseMap< MDNode *, MDNode * > &ClonedScopes, StringRef Ext, LLVMContext &Context)
Duplicate the specified list of noalias decl scopes.
Definition: CloneFunction.cpp:932
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
llvm::ReplayInlineScope::Function
@ Function
llvm::CloneAndPruneFunctionInto
void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr)
This works exactly like CloneFunctionInto, except that it does some simple constant prop and DCE on t...
Definition: CloneFunction.cpp:778
llvm::ClonedCodeInfo::OrigVMap
DenseMap< const Value *, const Value * > OrigVMap
Like VMap, but maps only unsimplified instructions.
Definition: Cloning.h:81
llvm::identifyNoAliasScopesToClone
void identifyNoAliasScopesToClone(ArrayRef< BasicBlock * > BBs, SmallVectorImpl< MDNode * > &NoAliasDeclScopes)
Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified basic blocks and extract ...
Definition: CloneFunction.cpp:1028
llvm::AssumptionCache
A cache of @llvm.assume calls within a function.
Definition: AssumptionCache.h:41
llvm::CloneAndPruneIntoFromInst
void CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc, const Instruction *StartingInst, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr)
This works like CloneAndPruneFunctionInto, except that it does not clone the entire function.
Definition: CloneFunction.cpp:496
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::CloneFunction
Function * CloneFunction(Function *F, ValueToValueMapTy &VMap, ClonedCodeInfo *CodeInfo=nullptr)
Return a copy of the specified function and add it to that function's module.
Definition: CloneFunction.cpp:283
llvm::CloneFunctionChangeType::GlobalChanges
@ GlobalChanges
ValueHandle.h
llvm::ClonedCodeInfo::ContainsCalls
bool ContainsCalls
This is set to true if the cloned code contains a normal call instruction.
Definition: Cloning.h:66
llvm::InlineFunctionInfo::InlinedCallSites
SmallVector< CallBase *, 8 > InlinedCallSites
All of the new call sites inlined into the caller.
Definition: Cloning.h:233
llvm::InlineFunctionInfo::reset
void reset()
Definition: Cloning.h:239
llvm::CloneFunctionChangeType
CloneFunctionChangeType
Definition: Cloning.h:136
llvm::InlineFunctionInfo
This class captures the data input to the InlineFunction call, and records the auxiliary results prod...
Definition: Cloning.h:201
llvm::InlineFunctionInfo::StaticAllocas
SmallVector< AllocaInst *, 4 > StaticAllocas
InlineFunction fills this in with all static allocas that get copied into the caller.
Definition: Cloning.h:222
SmallVector.h
llvm::InlineFunctionInfo::UpdateProfile
bool UpdateProfile
Update profile for callee as well as cloned version.
Definition: Cloning.h:237
llvm::CloneModule
std::unique_ptr< Module > CloneModule(const Module &M)
Return an exact copy of the specified module.
Definition: CloneModule.cpp:34
llvm::InlineFunction
InlineResult InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true, Function *ForwardVarArgsTo=nullptr)
This function inlines the called function into the basic block of the caller.
Definition: InlineFunction.cpp:1754
llvm::CloneFunctionInto
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, CloneFunctionChangeType Changes, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Clone OldFunc into NewFunc, transforming the old arguments into references to VMap values.
Definition: CloneFunction.cpp:83
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::InlineFunctionInfo::GetAssumptionCache
function_ref< AssumptionCache &(Function &)> GetAssumptionCache
Definition: Cloning.h:216
llvm::ClonedCodeInfo::ContainsDynamicAllocas
bool ContainsDynamicAllocas
This is set to true if the cloned code contains a 'dynamic' alloca.
Definition: Cloning.h:71
llvm::InlineFunctionInfo::CalleeBFI
BlockFrequencyInfo * CalleeBFI
Definition: Cloning.h:218
llvm::Value
LLVM Value Representation.
Definition: Value.h:74