LLVM  14.0.0git
CalledValuePropagation.cpp
Go to the documentation of this file.
1 //===- CalledValuePropagation.cpp - Propagate called values -----*- 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 implements a transformation that attaches !callees metadata to
10 // indirect call sites. For a given call site, the metadata, if present,
11 // indicates the set of functions the call site could possibly target at
12 // run-time. This metadata is added to indirect call sites when the set of
13 // possible targets can be determined by analysis and is known to be small. The
14 // analysis driving the transformation is similar to constant propagation and
15 // makes uses of the generic sparse propagation solver.
16 //
17 //===----------------------------------------------------------------------===//
18 
22 #include "llvm/IR/MDBuilder.h"
23 #include "llvm/InitializePasses.h"
25 #include "llvm/Transforms/IPO.h"
26 using namespace llvm;
27 
28 #define DEBUG_TYPE "called-value-propagation"
29 
30 /// The maximum number of functions to track per lattice value. Once the number
31 /// of functions a call site can possibly target exceeds this threshold, it's
32 /// lattice value becomes overdefined. The number of possible lattice values is
33 /// bounded by Ch(F, M), where F is the number of functions in the module and M
34 /// is MaxFunctionsPerValue. As such, this value should be kept very small. We
35 /// likely can't do anything useful for call sites with a large number of
36 /// possible targets, anyway.
38  "cvp-max-functions-per-value", cl::Hidden, cl::init(4),
39  cl::desc("The maximum number of functions to track per lattice value"));
40 
41 namespace {
42 /// To enable interprocedural analysis, we assign LLVM values to the following
43 /// groups. The register group represents SSA registers, the return group
44 /// represents the return values of functions, and the memory group represents
45 /// in-memory values. An LLVM Value can technically be in more than one group.
46 /// It's necessary to distinguish these groups so we can, for example, track a
47 /// global variable separately from the value stored at its location.
48 enum class IPOGrouping { Register, Return, Memory };
49 
50 /// Our LatticeKeys are PointerIntPairs composed of LLVM values and groupings.
51 using CVPLatticeKey = PointerIntPair<Value *, 2, IPOGrouping>;
52 
53 /// The lattice value type used by our custom lattice function. It holds the
54 /// lattice state, and a set of functions.
55 class CVPLatticeVal {
56 public:
57  /// The states of the lattice values. Only the FunctionSet state is
58  /// interesting. It indicates the set of functions to which an LLVM value may
59  /// refer.
60  enum CVPLatticeStateTy { Undefined, FunctionSet, Overdefined, Untracked };
61 
62  /// Comparator for sorting the functions set. We want to keep the order
63  /// deterministic for testing, etc.
64  struct Compare {
65  bool operator()(const Function *LHS, const Function *RHS) const {
66  return LHS->getName() < RHS->getName();
67  }
68  };
69 
70  CVPLatticeVal() : LatticeState(Undefined) {}
71  CVPLatticeVal(CVPLatticeStateTy LatticeState) : LatticeState(LatticeState) {}
72  CVPLatticeVal(std::vector<Function *> &&Functions)
73  : LatticeState(FunctionSet), Functions(std::move(Functions)) {
74  assert(llvm::is_sorted(this->Functions, Compare()));
75  }
76 
77  /// Get a reference to the functions held by this lattice value. The number
78  /// of functions will be zero for states other than FunctionSet.
79  const std::vector<Function *> &getFunctions() const {
80  return Functions;
81  }
82 
83  /// Returns true if the lattice value is in the FunctionSet state.
84  bool isFunctionSet() const { return LatticeState == FunctionSet; }
85 
86  bool operator==(const CVPLatticeVal &RHS) const {
87  return LatticeState == RHS.LatticeState && Functions == RHS.Functions;
88  }
89 
90  bool operator!=(const CVPLatticeVal &RHS) const {
91  return LatticeState != RHS.LatticeState || Functions != RHS.Functions;
92  }
93 
94 private:
95  /// Holds the state this lattice value is in.
96  CVPLatticeStateTy LatticeState;
97 
98  /// Holds functions indicating the possible targets of call sites. This set
99  /// is empty for lattice values in the undefined, overdefined, and untracked
100  /// states. The maximum size of the set is controlled by
101  /// MaxFunctionsPerValue. Since most LLVM values are expected to be in
102  /// uninteresting states (i.e., overdefined), CVPLatticeVal objects should be
103  /// small and efficiently copyable.
104  // FIXME: This could be a TinyPtrVector and/or merge with LatticeState.
105  std::vector<Function *> Functions;
106 };
107 
108 /// The custom lattice function used by the generic sparse propagation solver.
109 /// It handles merging lattice values and computing new lattice values for
110 /// constants, arguments, values returned from trackable functions, and values
111 /// located in trackable global variables. It also computes the lattice values
112 /// that change as a result of executing instructions.
113 class CVPLatticeFunc
114  : public AbstractLatticeFunction<CVPLatticeKey, CVPLatticeVal> {
115 public:
116  CVPLatticeFunc()
117  : AbstractLatticeFunction(CVPLatticeVal(CVPLatticeVal::Undefined),
118  CVPLatticeVal(CVPLatticeVal::Overdefined),
119  CVPLatticeVal(CVPLatticeVal::Untracked)) {}
120 
121  /// Compute and return a CVPLatticeVal for the given CVPLatticeKey.
122  CVPLatticeVal ComputeLatticeVal(CVPLatticeKey Key) override {
123  switch (Key.getInt()) {
125  if (isa<Instruction>(Key.getPointer())) {
126  return getUndefVal();
127  } else if (auto *A = dyn_cast<Argument>(Key.getPointer())) {
128  if (canTrackArgumentsInterprocedurally(A->getParent()))
129  return getUndefVal();
130  } else if (auto *C = dyn_cast<Constant>(Key.getPointer())) {
131  return computeConstant(C);
132  }
133  return getOverdefinedVal();
134  case IPOGrouping::Memory:
135  case IPOGrouping::Return:
136  if (auto *GV = dyn_cast<GlobalVariable>(Key.getPointer())) {
138  return computeConstant(GV->getInitializer());
139  } else if (auto *F = cast<Function>(Key.getPointer()))
141  return getUndefVal();
142  }
143  return getOverdefinedVal();
144  }
145 
146  /// Merge the two given lattice values. The interesting cases are merging two
147  /// FunctionSet values and a FunctionSet value with an Undefined value. For
148  /// these cases, we simply union the function sets. If the size of the union
149  /// is greater than the maximum functions we track, the merged value is
150  /// overdefined.
151  CVPLatticeVal MergeValues(CVPLatticeVal X, CVPLatticeVal Y) override {
152  if (X == getOverdefinedVal() || Y == getOverdefinedVal())
153  return getOverdefinedVal();
154  if (X == getUndefVal() && Y == getUndefVal())
155  return getUndefVal();
156  std::vector<Function *> Union;
157  std::set_union(X.getFunctions().begin(), X.getFunctions().end(),
158  Y.getFunctions().begin(), Y.getFunctions().end(),
159  std::back_inserter(Union), CVPLatticeVal::Compare{});
160  if (Union.size() > MaxFunctionsPerValue)
161  return getOverdefinedVal();
162  return CVPLatticeVal(std::move(Union));
163  }
164 
165  /// Compute the lattice values that change as a result of executing the given
166  /// instruction. The changed values are stored in \p ChangedValues. We handle
167  /// just a few kinds of instructions since we're only propagating values that
168  /// can be called.
169  void ComputeInstructionState(
172  switch (I.getOpcode()) {
173  case Instruction::Call:
174  case Instruction::Invoke:
175  return visitCallBase(cast<CallBase>(I), ChangedValues, SS);
176  case Instruction::Load:
177  return visitLoad(*cast<LoadInst>(&I), ChangedValues, SS);
178  case Instruction::Ret:
179  return visitReturn(*cast<ReturnInst>(&I), ChangedValues, SS);
180  case Instruction::Select:
181  return visitSelect(*cast<SelectInst>(&I), ChangedValues, SS);
182  case Instruction::Store:
183  return visitStore(*cast<StoreInst>(&I), ChangedValues, SS);
184  default:
185  return visitInst(I, ChangedValues, SS);
186  }
187  }
188 
189  /// Print the given CVPLatticeVal to the specified stream.
190  void PrintLatticeVal(CVPLatticeVal LV, raw_ostream &OS) override {
191  if (LV == getUndefVal())
192  OS << "Undefined ";
193  else if (LV == getOverdefinedVal())
194  OS << "Overdefined";
195  else if (LV == getUntrackedVal())
196  OS << "Untracked ";
197  else
198  OS << "FunctionSet";
199  }
200 
201  /// Print the given CVPLatticeKey to the specified stream.
202  void PrintLatticeKey(CVPLatticeKey Key, raw_ostream &OS) override {
203  if (Key.getInt() == IPOGrouping::Register)
204  OS << "<reg> ";
205  else if (Key.getInt() == IPOGrouping::Memory)
206  OS << "<mem> ";
207  else if (Key.getInt() == IPOGrouping::Return)
208  OS << "<ret> ";
209  if (isa<Function>(Key.getPointer()))
210  OS << Key.getPointer()->getName();
211  else
212  OS << *Key.getPointer();
213  }
214 
215  /// We collect a set of indirect calls when visiting call sites. This method
216  /// returns a reference to that set.
217  SmallPtrSetImpl<CallBase *> &getIndirectCalls() { return IndirectCalls; }
218 
219 private:
220  /// Holds the indirect calls we encounter during the analysis. We will attach
221  /// metadata to these calls after the analysis indicating the functions the
222  /// calls can possibly target.
223  SmallPtrSet<CallBase *, 32> IndirectCalls;
224 
225  /// Compute a new lattice value for the given constant. The constant, after
226  /// stripping any pointer casts, should be a Function. We ignore null
227  /// pointers as an optimization, since calling these values is undefined
228  /// behavior.
229  CVPLatticeVal computeConstant(Constant *C) {
230  if (isa<ConstantPointerNull>(C))
231  return CVPLatticeVal(CVPLatticeVal::FunctionSet);
232  if (auto *F = dyn_cast<Function>(C->stripPointerCasts()))
233  return CVPLatticeVal({F});
234  return getOverdefinedVal();
235  }
236 
237  /// Handle return instructions. The function's return state is the merge of
238  /// the returned value state and the function's return state.
239  void visitReturn(ReturnInst &I,
242  Function *F = I.getParent()->getParent();
243  if (F->getReturnType()->isVoidTy())
244  return;
245  auto RegI = CVPLatticeKey(I.getReturnValue(), IPOGrouping::Register);
246  auto RetF = CVPLatticeKey(F, IPOGrouping::Return);
247  ChangedValues[RetF] =
248  MergeValues(SS.getValueState(RegI), SS.getValueState(RetF));
249  }
250 
251  /// Handle call sites. The state of a called function's formal arguments is
252  /// the merge of the argument state with the call sites corresponding actual
253  /// argument state. The call site state is the merge of the call site state
254  /// with the returned value state of the called function.
255  void visitCallBase(CallBase &CB,
258  Function *F = CB.getCalledFunction();
259  auto RegI = CVPLatticeKey(&CB, IPOGrouping::Register);
260 
261  // If this is an indirect call, save it so we can quickly revisit it when
262  // attaching metadata.
263  if (!F)
264  IndirectCalls.insert(&CB);
265 
266  // If we can't track the function's return values, there's nothing to do.
268  // Void return, No need to create and update CVPLattice state as no one
269  // can use it.
270  if (CB.getType()->isVoidTy())
271  return;
272  ChangedValues[RegI] = getOverdefinedVal();
273  return;
274  }
275 
276  // Inform the solver that the called function is executable, and perform
277  // the merges for the arguments and return value.
278  SS.MarkBlockExecutable(&F->front());
279  auto RetF = CVPLatticeKey(F, IPOGrouping::Return);
280  for (Argument &A : F->args()) {
281  auto RegFormal = CVPLatticeKey(&A, IPOGrouping::Register);
282  auto RegActual =
283  CVPLatticeKey(CB.getArgOperand(A.getArgNo()), IPOGrouping::Register);
284  ChangedValues[RegFormal] =
285  MergeValues(SS.getValueState(RegFormal), SS.getValueState(RegActual));
286  }
287 
288  // Void return, No need to create and update CVPLattice state as no one can
289  // use it.
290  if (CB.getType()->isVoidTy())
291  return;
292 
293  ChangedValues[RegI] =
294  MergeValues(SS.getValueState(RegI), SS.getValueState(RetF));
295  }
296 
297  /// Handle select instructions. The select instruction state is the merge the
298  /// true and false value states.
299  void visitSelect(SelectInst &I,
302  auto RegI = CVPLatticeKey(&I, IPOGrouping::Register);
303  auto RegT = CVPLatticeKey(I.getTrueValue(), IPOGrouping::Register);
304  auto RegF = CVPLatticeKey(I.getFalseValue(), IPOGrouping::Register);
305  ChangedValues[RegI] =
306  MergeValues(SS.getValueState(RegT), SS.getValueState(RegF));
307  }
308 
309  /// Handle load instructions. If the pointer operand of the load is a global
310  /// variable, we attempt to track the value. The loaded value state is the
311  /// merge of the loaded value state with the global variable state.
312  void visitLoad(LoadInst &I,
315  auto RegI = CVPLatticeKey(&I, IPOGrouping::Register);
316  if (auto *GV = dyn_cast<GlobalVariable>(I.getPointerOperand())) {
317  auto MemGV = CVPLatticeKey(GV, IPOGrouping::Memory);
318  ChangedValues[RegI] =
319  MergeValues(SS.getValueState(RegI), SS.getValueState(MemGV));
320  } else {
321  ChangedValues[RegI] = getOverdefinedVal();
322  }
323  }
324 
325  /// Handle store instructions. If the pointer operand of the store is a
326  /// global variable, we attempt to track the value. The global variable state
327  /// is the merge of the stored value state with the global variable state.
328  void visitStore(StoreInst &I,
331  auto *GV = dyn_cast<GlobalVariable>(I.getPointerOperand());
332  if (!GV)
333  return;
334  auto RegI = CVPLatticeKey(I.getValueOperand(), IPOGrouping::Register);
335  auto MemGV = CVPLatticeKey(GV, IPOGrouping::Memory);
336  ChangedValues[MemGV] =
337  MergeValues(SS.getValueState(RegI), SS.getValueState(MemGV));
338  }
339 
340  /// Handle all other instructions. All other instructions are marked
341  /// overdefined.
342  void visitInst(Instruction &I,
345  // Simply bail if this instruction has no user.
346  if (I.use_empty())
347  return;
348  auto RegI = CVPLatticeKey(&I, IPOGrouping::Register);
349  ChangedValues[RegI] = getOverdefinedVal();
350  }
351 };
352 } // namespace
353 
354 namespace llvm {
355 /// A specialization of LatticeKeyInfo for CVPLatticeKeys. The generic solver
356 /// must translate between LatticeKeys and LLVM Values when adding Values to
357 /// its work list and inspecting the state of control-flow related values.
358 template <> struct LatticeKeyInfo<CVPLatticeKey> {
359  static inline Value *getValueFromLatticeKey(CVPLatticeKey Key) {
360  return Key.getPointer();
361  }
362  static inline CVPLatticeKey getLatticeKeyFromValue(Value *V) {
363  return CVPLatticeKey(V, IPOGrouping::Register);
364  }
365 };
366 } // namespace llvm
367 
368 static bool runCVP(Module &M) {
369  // Our custom lattice function and generic sparse propagation solver.
370  CVPLatticeFunc Lattice;
372 
373  // For each function in the module, if we can't track its arguments, let the
374  // generic solver assume it is executable.
375  for (Function &F : M)
376  if (!F.isDeclaration() && !canTrackArgumentsInterprocedurally(&F))
377  Solver.MarkBlockExecutable(&F.front());
378 
379  // Solver our custom lattice. In doing so, we will also build a set of
380  // indirect call sites.
381  Solver.Solve();
382 
383  // Attach metadata to the indirect call sites that were collected indicating
384  // the set of functions they can possibly target.
385  bool Changed = false;
386  MDBuilder MDB(M.getContext());
387  for (CallBase *C : Lattice.getIndirectCalls()) {
388  auto RegI = CVPLatticeKey(C->getCalledOperand(), IPOGrouping::Register);
389  CVPLatticeVal LV = Solver.getExistingValueState(RegI);
390  if (!LV.isFunctionSet() || LV.getFunctions().empty())
391  continue;
392  MDNode *Callees = MDB.createCallees(LV.getFunctions());
393  C->setMetadata(LLVMContext::MD_callees, Callees);
394  Changed = true;
395  }
396 
397  return Changed;
398 }
399 
402  runCVP(M);
403  return PreservedAnalyses::all();
404 }
405 
406 namespace {
407 class CalledValuePropagationLegacyPass : public ModulePass {
408 public:
409  static char ID;
410 
411  void getAnalysisUsage(AnalysisUsage &AU) const override {
412  AU.setPreservesAll();
413  }
414 
415  CalledValuePropagationLegacyPass() : ModulePass(ID) {
418  }
419 
420  bool runOnModule(Module &M) override {
421  if (skipModule(M))
422  return false;
423  return runCVP(M);
424  }
425 };
426 } // namespace
427 
429 INITIALIZE_PASS(CalledValuePropagationLegacyPass, "called-value-propagation",
430  "Called Value Propagation", false, false)
431 
433  return new CalledValuePropagationLegacyPass();
434 }
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
MaxFunctionsPerValue
static cl::opt< unsigned > MaxFunctionsPerValue("cvp-max-functions-per-value", cl::Hidden, cl::init(4), cl::desc("The maximum number of functions to track per lattice value"))
The maximum number of functions to track per lattice value.
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::CalledValuePropagationPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
Definition: CalledValuePropagation.cpp:400
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::ReturnInst
Return a value (possibly void), from a function.
Definition: Instructions.h:2978
CalledValuePropagation.h
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:238
llvm::Function
Definition: Function.h:61
llvm::set_union
bool set_union(S1Ty &S1, const S2Ty &S2)
set_union(A, B) - Compute A := A u B, return whether A changed.
Definition: SetOperations.h:22
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::LatticeKeyInfo< CVPLatticeKey >::getValueFromLatticeKey
static Value * getValueFromLatticeKey(CVPLatticeKey Key)
Definition: CalledValuePropagation.cpp:359
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition: APInt.h:1976
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
runCVP
static bool runCVP(Module &M)
Definition: CalledValuePropagation.cpp:368
llvm::AbstractLatticeFunction
AbstractLatticeFunction - This class is implemented by the dataflow instance to specify what the latt...
Definition: SparsePropagation.h:45
F
#define F(x, y, z)
Definition: MD5.cpp:56
CommandLine.h
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
INITIALIZE_PASS
INITIALIZE_PASS(CalledValuePropagationLegacyPass, "called-value-propagation", "Called Value Propagation", false, false) ModulePass *llvm
Definition: CalledValuePropagation.cpp:429
llvm::SparseSolver::Solve
void Solve()
Solve - Solve for constants and executable blocks.
Definition: SparsePropagation.h:468
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::ARM_PROC::A
@ A
Definition: ARMBaseInfo.h:34
llvm::CallBase::getCalledFunction
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
Definition: InstrTypes.h:1393
llvm::MachO::SymbolFlags::Undefined
@ Undefined
Undefined.
Y
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
llvm::MCID::Return
@ Return
Definition: MCInstrDesc.h:151
llvm::Instruction
Definition: Instruction.h:45
MDBuilder.h
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::LatticeKeyInfo
A template for translating between LLVM Values and LatticeKeys.
Definition: SparsePropagation.h:27
llvm::MCID::Call
@ Call
Definition: MCInstrDesc.h:153
llvm::canTrackGlobalVariableInterprocedurally
bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV)
Determine if the value maintained in the given global variable can be tracked interprocedurally.
Definition: ValueLatticeUtils.cpp:27
Register
Promote Memory to Register
Definition: Mem2Reg.cpp:110
llvm::SPII::Load
@ Load
Definition: SparcInstrInfo.h:32
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::cl::opt
Definition: CommandLine.h:1434
llvm::StoreInst
An instruction for storing to memory.
Definition: Instructions.h:304
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
IPO.h
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap
Definition: DenseMap.h:714
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
llvm::LatticeKeyInfo< CVPLatticeKey >::getLatticeKeyFromValue
static CVPLatticeKey getLatticeKeyFromValue(Value *V)
Definition: CalledValuePropagation.cpp:362
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1605
llvm::SPII::Store
@ Store
Definition: SparcInstrInfo.h:33
llvm::operator==
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1974
llvm::SelectInst
This class represents the LLVM 'select' instruction.
Definition: Instructions.h:1738
llvm::Type::isVoidTy
bool isVoidTy() const
Return true if this is 'void'.
Definition: Type.h:138
llvm::pdb::PDB_UdtType::Union
@ Union
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MDNode
Metadata node.
Definition: Metadata.h:901
Compare
QP Compare Ordered outs ins xscmpudp No builtin are required Or llvm fcmp order unorder compare DP QP Compare builtin are required DP Compare
Definition: README_P9.txt:309
llvm::sys::Memory
This class provides various memory handling functions that manipulate MemoryBlock instances.
Definition: Memory.h:52
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
llvm::X86AS::SS
@ SS
Definition: X86.h:189
llvm::initializeCalledValuePropagationLegacyPassPass
void initializeCalledValuePropagationLegacyPassPass(PassRegistry &)
llvm::createCalledValuePropagationPass
ModulePass * createCalledValuePropagationPass()
createCalledValuePropagationPass - Attach metadata to indirct call sites indicating the set of functi...
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:297
ValueLatticeUtils.h
llvm::LoadInst
An instruction for reading from memory.
Definition: Instructions.h:175
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:162
SparsePropagation.h
std
Definition: BitVector.h:838
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:161
llvm::SparseSolver::MarkBlockExecutable
void MarkBlockExecutable(BasicBlock *BB)
MarkBlockExecutable - This method can be used by clients to mark all of the blocks that are known to ...
Definition: SparsePropagation.h:258
llvm::is_sorted
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
Definition: STLExtras.h:1618
llvm::MDBuilder
Definition: MDBuilder.h:35
llvm::PointerIntPair
PointerIntPair - This class implements a pair of a pointer and small integer.
Definition: PointerIntPair.h:45
llvm::MDBuilder::createCallees
MDNode * createCallees(ArrayRef< Function * > Callees)
Return metadata indicating the possible callees of indirect calls.
Definition: MDBuilder.cpp:100
llvm::canTrackArgumentsInterprocedurally
bool canTrackArgumentsInterprocedurally(Function *F)
Determine if the values of the given function's arguments can be tracked interprocedurally.
Definition: ValueLatticeUtils.cpp:19
llvm::CallBase::getArgOperand
Value * getArgOperand(unsigned i) const
Definition: InstrTypes.h:1338
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1161
llvm::SmallPtrSetImpl< CallBase * >
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::cl::desc
Definition: CommandLine.h:414
llvm::SparseSolver::getExistingValueState
LatticeVal getExistingValueState(LatticeKey Key) const
getExistingValueState - Return the LatticeVal object corresponding to the given value from the ValueS...
Definition: SparsePropagation.h:150
InitializePasses.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::SparseSolver
SparseSolver - This class is a general purpose solver for Sparse Conditional Propagation with a progr...
Definition: SparsePropagation.h:34
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:364
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37
llvm::canTrackReturnsInterprocedurally
bool canTrackReturnsInterprocedurally(Function *F)
Determine if the values of the given function's returns can be tracked interprocedurally.
Definition: ValueLatticeUtils.cpp:23