LLVM  15.0.0git
MemoryBuiltins.h
Go to the documentation of this file.
1 //==- llvm/Analysis/MemoryBuiltins.h - Calls to memory builtins --*- 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 family of functions identifies calls to builtin functions that allocate
10 // or free memory.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_ANALYSIS_MEMORYBUILTINS_H
15 #define LLVM_ANALYSIS_MEMORYBUILTINS_H
16 
17 #include "llvm/ADT/APInt.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/SmallPtrSet.h"
22 #include "llvm/IR/IRBuilder.h"
23 #include "llvm/IR/InstVisitor.h"
24 #include "llvm/IR/ValueHandle.h"
25 #include <cstdint>
26 #include <utility>
27 
28 namespace llvm {
29 
30 class AllocaInst;
31 class AAResults;
32 class Argument;
33 class CallInst;
34 class ConstantPointerNull;
35 class DataLayout;
36 class ExtractElementInst;
37 class ExtractValueInst;
38 class GEPOperator;
39 class GlobalAlias;
40 class GlobalVariable;
41 class Instruction;
42 class IntegerType;
43 class IntrinsicInst;
44 class IntToPtrInst;
45 class LLVMContext;
46 class LoadInst;
47 class PHINode;
48 class SelectInst;
49 class Type;
50 class UndefValue;
51 class Value;
52 
53 /// Tests if a value is a call or invoke to a library function that
54 /// allocates or reallocates memory (either malloc, calloc, realloc, or strdup
55 /// like).
56 bool isAllocationFn(const Value *V, const TargetLibraryInfo *TLI);
57 bool isAllocationFn(const Value *V,
58  function_ref<const TargetLibraryInfo &(Function &)> GetTLI);
59 
60 /// Tests if a value is a call or invoke to a library function that
61 /// allocates memory similar to malloc or calloc.
62 bool isMallocOrCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
63 
64 /// Tests if a value is a call or invoke to a library function that
65 /// allocates memory (either malloc, calloc, or strdup like).
66 bool isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
67 
68 /// Tests if a value is a call or invoke to a library function that
69 /// reallocates memory (e.g., realloc).
70 bool isReallocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
71 
72 /// Tests if a function is a call or invoke to a library function that
73 /// reallocates memory (e.g., realloc).
74 bool isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI);
75 
76 //===----------------------------------------------------------------------===//
77 // free Call Utility Functions.
78 //
79 
80 /// isLibFreeFunction - Returns true if the function is a builtin free()
81 bool isLibFreeFunction(const Function *F, const LibFunc TLIFn);
82 
83 /// isFreeCall - Returns non-null if the value is a call to the builtin free()
84 const CallInst *isFreeCall(const Value *I, const TargetLibraryInfo *TLI);
85 
86 inline CallInst *isFreeCall(Value *I, const TargetLibraryInfo *TLI) {
87  return const_cast<CallInst*>(isFreeCall((const Value*)I, TLI));
88 }
89 
90 //===----------------------------------------------------------------------===//
91 // Properties of allocation functions
92 //
93 
94 /// Return false if the allocation can have side effects on the program state
95 /// we are required to preserve beyond the effect of allocating a new object.
96 /// Ex: If our allocation routine has a counter for the number of objects
97 /// allocated, and the program prints it on exit, can the value change due
98 /// to optimization? Answer is highly language dependent.
99 /// Note: *Removable* really does mean removable; it does not mean observable.
100 /// A language (e.g. C++) can allow removing allocations without allowing
101 /// insertion or speculative execution of allocation routines.
102 bool isAllocRemovable(const CallBase *V, const TargetLibraryInfo *TLI);
103 
104 /// Gets the alignment argument for an aligned_alloc-like function, using either
105 /// built-in knowledge based on fuction names/signatures or allocalign
106 /// attributes. Note: the Value returned may not indicate a valid alignment, per
107 /// the definition of the allocalign attribute.
108 Value *getAllocAlignment(const CallBase *V, const TargetLibraryInfo *TLI);
109 
110 /// Return the size of the requested allocation. With a trivial mapper, this is
111 /// identical to calling getObjectSize(..., Exact). A mapper function can be
112 /// used to replace one Value* (operand to the allocation) with another. This
113 /// is useful when doing abstract interpretation.
114 Optional<APInt> getAllocSize(const CallBase *CB,
115  const TargetLibraryInfo *TLI,
116  std::function<const Value*(const Value*)> Mapper);
117 
118 /// If this is a call to an allocation function that initializes memory to a
119 /// fixed value, return said value in the requested type. Otherwise, return
120 /// nullptr.
122  const TargetLibraryInfo *TLI,
123  Type *Ty);
124 
125 /// If a function is part of an allocation family (e.g.
126 /// malloc/realloc/calloc/free), return the identifier for its family
127 /// of functions.
128 Optional<StringRef> getAllocationFamily(const Value *I,
129  const TargetLibraryInfo *TLI);
130 
131 //===----------------------------------------------------------------------===//
132 // Utility functions to compute size of objects.
133 //
134 
135 /// Various options to control the behavior of getObjectSize.
137  /// Controls how we handle conditional statements with unknown conditions.
138  enum class Mode : uint8_t {
139  /// Fail to evaluate an unknown condition.
140  Exact,
141  /// Evaluate all branches of an unknown condition. If all evaluations
142  /// succeed, pick the minimum size.
143  Min,
144  /// Same as Min, except we pick the maximum size of all of the branches.
145  Max
146  };
147 
148  /// How we want to evaluate this object's size.
150  /// Whether to round the result up to the alignment of allocas, byval
151  /// arguments, and global variables.
152  bool RoundToAlign = false;
153  /// If this is true, null pointers in address space 0 will be treated as
154  /// though they can't be evaluated. Otherwise, null is always considered to
155  /// point to a 0 byte region of memory.
156  bool NullIsUnknownSize = false;
157  /// If set, used for more accurate evaluation
158  AAResults *AA = nullptr;
159 };
160 
161 /// Compute the size of the object pointed by Ptr. Returns true and the
162 /// object size in Size if successful, and false otherwise. In this context, by
163 /// object we mean the region of memory starting at Ptr to the end of the
164 /// underlying object pointed to by Ptr.
165 ///
166 /// WARNING: The object size returned is the allocation size. This does not
167 /// imply dereferenceability at site of use since the object may be freeed in
168 /// between.
169 bool getObjectSize(const Value *Ptr, uint64_t &Size, const DataLayout &DL,
170  const TargetLibraryInfo *TLI, ObjectSizeOpts Opts = {});
171 
172 /// Try to turn a call to \@llvm.objectsize into an integer value of the given
173 /// Type. Returns null on failure. If MustSucceed is true, this function will
174 /// not return null, and may return conservative values governed by the second
175 /// argument of the call to objectsize.
176 Value *lowerObjectSizeCall(IntrinsicInst *ObjectSize, const DataLayout &DL,
177  const TargetLibraryInfo *TLI, bool MustSucceed);
178 Value *lowerObjectSizeCall(IntrinsicInst *ObjectSize, const DataLayout &DL,
179  const TargetLibraryInfo *TLI, AAResults *AA,
180  bool MustSucceed);
181 
182 using SizeOffsetType = std::pair<APInt, APInt>;
183 
184 /// Evaluate the size and offset of an object pointed to by a Value*
185 /// statically. Fails if size or offset are not known at compile time.
187  : public InstVisitor<ObjectSizeOffsetVisitor, SizeOffsetType> {
188  const DataLayout &DL;
189  const TargetLibraryInfo *TLI;
190  ObjectSizeOpts Options;
191  unsigned IntTyBits;
192  APInt Zero;
194 
195  APInt align(APInt Size, MaybeAlign Align);
196 
197  SizeOffsetType unknown() {
198  return std::make_pair(APInt(), APInt());
199  }
200 
201 public:
204 
206 
207  static bool knownSize(const SizeOffsetType &SizeOffset) {
208  return SizeOffset.first.getBitWidth() > 1;
209  }
210 
211  static bool knownOffset(const SizeOffsetType &SizeOffset) {
212  return SizeOffset.second.getBitWidth() > 1;
213  }
214 
215  static bool bothKnown(const SizeOffsetType &SizeOffset) {
216  return knownSize(SizeOffset) && knownOffset(SizeOffset);
217  }
218 
219  // These are "private", except they can't actually be made private. Only
220  // compute() should be used by external users.
235 
236 private:
237  SizeOffsetType findLoadSizeOffset(
240  unsigned &ScannedInstCount);
241  SizeOffsetType combineSizeOffset(SizeOffsetType LHS, SizeOffsetType RHS);
242  SizeOffsetType computeImpl(Value *V);
243  bool CheckedZextOrTrunc(APInt &I);
244 };
245 
246 using SizeOffsetEvalType = std::pair<Value *, Value *>;
247 
248 /// Evaluate the size and offset of an object pointed to by a Value*.
249 /// May create code to compute the result at run-time.
251  : public InstVisitor<ObjectSizeOffsetEvaluator, SizeOffsetEvalType> {
253  using WeakEvalType = std::pair<WeakTrackingVH, WeakTrackingVH>;
256 
257  const DataLayout &DL;
258  const TargetLibraryInfo *TLI;
259  LLVMContext &Context;
260  BuilderTy Builder;
261  IntegerType *IntTy;
262  Value *Zero;
263  CacheMapTy CacheMap;
264  PtrSetTy SeenVals;
265  ObjectSizeOpts EvalOpts;
266  SmallPtrSet<Instruction *, 8> InsertedInstructions;
267 
268  SizeOffsetEvalType compute_(Value *V);
269 
270 public:
272  return std::make_pair(nullptr, nullptr);
273  }
274 
276  LLVMContext &Context, ObjectSizeOpts EvalOpts = {});
277 
279 
280  bool knownSize(SizeOffsetEvalType SizeOffset) {
281  return SizeOffset.first;
282  }
283 
284  bool knownOffset(SizeOffsetEvalType SizeOffset) {
285  return SizeOffset.second;
286  }
287 
288  bool anyKnown(SizeOffsetEvalType SizeOffset) {
289  return knownSize(SizeOffset) || knownOffset(SizeOffset);
290  }
291 
292  bool bothKnown(SizeOffsetEvalType SizeOffset) {
293  return knownSize(SizeOffset) && knownOffset(SizeOffset);
294  }
295 
296  // The individual instruction visitors should be treated as private.
307 };
308 
309 } // end namespace llvm
310 
311 #endif // LLVM_ANALYSIS_MEMORYBUILTINS_H
llvm::ObjectSizeOffsetEvaluator::unknown
static SizeOffsetEvalType unknown()
Definition: MemoryBuiltins.h:271
llvm::SizeOffsetType
std::pair< APInt, APInt > SizeOffsetType
Definition: MemoryBuiltins.h:182
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:28
llvm::ObjectSizeOffsetVisitor::visitGlobalAlias
SizeOffsetType visitGlobalAlias(GlobalAlias &GA)
Definition: MemoryBuiltins.cpp:799
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::BasicBlock::iterator
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:87
llvm::ExtractElementInst
This instruction extracts a single (scalar) element from a VectorType value.
Definition: Instructions.h:1859
TargetFolder.h
llvm::ObjectSizeOffsetEvaluator::compute
SizeOffsetEvalType compute(Value *V)
Definition: MemoryBuiltins.cpp:997
llvm::ObjectSizeOffsetVisitor::visitExtractValueInst
SizeOffsetType visitExtractValueInst(ExtractValueInst &I)
Definition: MemoryBuiltins.cpp:794
llvm::IRBuilder< TargetFolder, IRBuilderCallbackInserter >
llvm::GlobalVariable
Definition: GlobalVariable.h:39
llvm::ObjectSizeOffsetEvaluator::visitSelectInst
SizeOffsetEvalType visitSelectInst(SelectInst &I)
Definition: MemoryBuiltins.cpp:1192
llvm::ObjectSizeOffsetEvaluator::visitGEPOperator
SizeOffsetEvalType visitGEPOperator(GEPOperator &GEP)
Definition: MemoryBuiltins.cpp:1131
llvm::SmallDenseMap
Definition: DenseMap.h:882
llvm::GlobalAlias
Definition: GlobalAlias.h:28
APInt.h
DenseMap.h
llvm::ObjectSizeOpts::NullIsUnknownSize
bool NullIsUnknownSize
If this is true, null pointers in address space 0 will be treated as though they can't be evaluated.
Definition: MemoryBuiltins.h:156
llvm::ObjectSizeOffsetEvaluator::visitCallBase
SizeOffsetEvalType visitCallBase(CallBase &CB)
Definition: MemoryBuiltins.cpp:1098
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:450
llvm::ObjectSizeOpts::RoundToAlign
bool RoundToAlign
Whether to round the result up to the alignment of allocas, byval arguments, and global variables.
Definition: MemoryBuiltins.h:152
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::ObjectSizeOffsetEvaluator::visitLoadInst
SizeOffsetEvalType visitLoadInst(LoadInst &I)
Definition: MemoryBuiltins.cpp:1146
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::ObjectSizeOffsetEvaluator::visitIntToPtrInst
SizeOffsetEvalType visitIntToPtrInst(IntToPtrInst &)
Definition: MemoryBuiltins.cpp:1141
llvm::isAllocationFn
bool isAllocationFn(const Value *V, const TargetLibraryInfo *TLI)
Tests if a value is a call or invoke to a library function that allocates or reallocates memory (eith...
Definition: MemoryBuiltins.cpp:272
llvm::ConstantPointerNull
A constant pointer value that points to null.
Definition: Constants.h:535
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::ObjectSizeOffsetVisitor::bothKnown
static bool bothKnown(const SizeOffsetType &SizeOffset)
Definition: MemoryBuiltins.h:215
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:76
llvm::AAResults
Definition: AliasAnalysis.h:511
llvm::ObjectSizeOffsetEvaluator::knownSize
bool knownSize(SizeOffsetEvalType SizeOffset)
Definition: MemoryBuiltins.h:280
llvm::LibFunc
LibFunc
Definition: TargetLibraryInfo.h:35
llvm::ObjectSizeOffsetVisitor::visitIntToPtrInst
SizeOffsetType visitIntToPtrInst(IntToPtrInst &)
Definition: MemoryBuiltins.cpp:813
llvm::ObjectSizeOffsetEvaluator::ObjectSizeOffsetEvaluator
ObjectSizeOffsetEvaluator(const DataLayout &DL, const TargetLibraryInfo *TLI, LLVMContext &Context, ObjectSizeOpts EvalOpts={})
Definition: MemoryBuiltins.cpp:985
llvm::ObjectSizeOpts::Mode::Exact
@ Exact
Fail to evaluate an unknown condition.
TargetLibraryInfo.h
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
llvm::IntegerType
Class to represent integer types.
Definition: DerivedTypes.h:40
llvm::ObjectSizeOffsetVisitor::visitGlobalVariable
SizeOffsetType visitGlobalVariable(GlobalVariable &GV)
Definition: MemoryBuiltins.cpp:805
llvm::Instruction
Definition: Instruction.h:42
llvm::ObjectSizeOffsetVisitor::visitAllocaInst
SizeOffsetType visitAllocaInst(AllocaInst &I)
Definition: MemoryBuiltins.cpp:730
llvm::ObjectSizeOffsetEvaluator::visitExtractElementInst
SizeOffsetEvalType visitExtractElementInst(ExtractElementInst &I)
Definition: MemoryBuiltins.cpp:1121
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::ObjectSizeOffsetEvaluator
Evaluate the size and offset of an object pointed to by a Value*.
Definition: MemoryBuiltins.h:250
SmallPtrSet.h
llvm::ObjectSizeOffsetEvaluator::visitPHINode
SizeOffsetEvalType visitPHINode(PHINode &PHI)
Definition: MemoryBuiltins.cpp:1150
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::getObjectSize
bool getObjectSize(const Value *Ptr, uint64_t &Size, const DataLayout &DL, const TargetLibraryInfo *TLI, ObjectSizeOpts Opts={})
Compute the size of the object pointed by Ptr.
Definition: MemoryBuiltins.cpp:559
llvm::getInitialValueOfAllocation
Constant * getInitialValueOfAllocation(const Value *V, const TargetLibraryInfo *TLI, Type *Ty)
If this is a call to an allocation function that initializes memory to a fixed value,...
Definition: MemoryBuiltins.cpp:422
uint64_t
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::DenseMap< const Value *, WeakEvalType >
llvm::ObjectSizeOffsetVisitor::visitUndefValue
SizeOffsetType visitUndefValue(UndefValue &)
Definition: MemoryBuiltins.cpp:975
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::UndefValue
'undef' values are things that do not have specified contents.
Definition: Constants.h:1384
llvm::ObjectSizeOffsetVisitor
Evaluate the size and offset of an object pointed to by a Value* statically.
Definition: MemoryBuiltins.h:186
llvm::lowerObjectSizeCall
Value * lowerObjectSizeCall(IntrinsicInst *ObjectSize, const DataLayout &DL, const TargetLibraryInfo *TLI, bool MustSucceed)
Try to turn a call to @llvm.objectsize into an integer value of the given Type.
Definition: MemoryBuiltins.cpp:570
llvm::ObjectSizeOffsetVisitor::visitSelectInst
SizeOffsetType visitSelectInst(SelectInst &I)
Definition: MemoryBuiltins.cpp:970
llvm::isAllocLikeFn
bool isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI)
Tests if a value is a call or invoke to a library function that allocates memory (either malloc,...
Definition: MemoryBuiltins.cpp:306
TemplateParamKind::Type
@ Type
IRBuilder.h
llvm::ObjectSizeOpts::Mode::Min
@ Min
Evaluate all branches of an unknown condition.
llvm::SelectInst
This class represents the LLVM 'select' instruction.
Definition: Instructions.h:1724
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::GEPOperator
Definition: Operator.h:375
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::ObjectSizeOffsetEvaluator::visitAllocaInst
SizeOffsetEvalType visitAllocaInst(AllocaInst &I)
Definition: MemoryBuiltins.cpp:1078
InstVisitor.h
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::InstVisitor
Base class for instruction visitors.
Definition: InstVisitor.h:78
llvm::ObjectSizeOpts
Various options to control the behavior of getObjectSize.
Definition: MemoryBuiltins.h:136
llvm::LoadInst
An instruction for reading from memory.
Definition: Instructions.h:173
ValueHandle.h
llvm::ObjectSizeOpts::Mode::Max
@ Max
Same as Min, except we pick the maximum size of all of the branches.
llvm::ObjectSizeOffsetVisitor::visitLoadInst
SizeOffsetType visitLoadInst(LoadInst &I)
Definition: MemoryBuiltins.cpp:928
llvm::ObjectSizeOffsetEvaluator::knownOffset
bool knownOffset(SizeOffsetEvalType SizeOffset)
Definition: MemoryBuiltins.h:284
llvm::ObjectSizeOffsetVisitor::visitInstruction
SizeOffsetType visitInstruction(Instruction &I)
Definition: MemoryBuiltins.cpp:979
llvm::ObjectSizeOffsetVisitor::visitCallBase
SizeOffsetType visitCallBase(CallBase &CB)
Definition: MemoryBuiltins.cpp:767
llvm::ObjectSizeOffsetVisitor::visitArgument
SizeOffsetType visitArgument(Argument &A)
Definition: MemoryBuiltins.cpp:755
llvm::ObjectSizeOpts::Mode
Mode
Controls how we handle conditional statements with unknown conditions.
Definition: MemoryBuiltins.h:138
llvm::getAllocationFamily
Optional< StringRef > getAllocationFamily(const Value *I, const TargetLibraryInfo *TLI)
If a function is part of an allocation family (e.g.
Definition: MemoryBuiltins.cpp:493
llvm::ObjectSizeOpts::EvalMode
Mode EvalMode
How we want to evaluate this object's size.
Definition: MemoryBuiltins.h:149
llvm::ExtractValueInst
This instruction extracts a struct member or array element value from an aggregate value.
Definition: Instructions.h:2398
llvm::getAllocAlignment
Value * getAllocAlignment(const CallBase *V, const TargetLibraryInfo *TLI)
Gets the alignment argument for an aligned_alloc-like function, using either built-in knowledge based...
Definition: MemoryBuiltins.cpp:334
llvm::SizeOffsetEvalType
std::pair< Value *, Value * > SizeOffsetEvalType
Definition: MemoryBuiltins.h:246
llvm::ObjectSizeOffsetVisitor::knownOffset
static bool knownOffset(const SizeOffsetType &SizeOffset)
Definition: MemoryBuiltins.h:211
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:222
llvm::IntToPtrInst
This class represents a cast from an integer to a pointer.
Definition: Instructions.h:5118
AA
llvm::ObjectSizeOffsetVisitor::compute
SizeOffsetType compute(Value *V)
Definition: MemoryBuiltins.cpp:665
llvm::ObjectSizeOffsetVisitor::visitConstantPointerNull
SizeOffsetType visitConstantPointerNull(ConstantPointerNull &)
Definition: MemoryBuiltins.cpp:775
llvm::getAllocSize
Optional< APInt > getAllocSize(const CallBase *CB, const TargetLibraryInfo *TLI, std::function< const Value *(const Value *)> Mapper)
Return the size of the requested allocation.
Definition: MemoryBuiltins.cpp:360
llvm::ObjectSizeOffsetEvaluator::visitExtractValueInst
SizeOffsetEvalType visitExtractValueInst(ExtractValueInst &I)
Definition: MemoryBuiltins.cpp:1126
llvm::isReallocLikeFn
bool isReallocLikeFn(const Value *V, const TargetLibraryInfo *TLI)
Tests if a value is a call or invoke to a library function that reallocates memory (e....
Definition: MemoryBuiltins.cpp:312
llvm::ObjectSizeOffsetEvaluator::visitInstruction
SizeOffsetEvalType visitInstruction(Instruction &I)
Definition: MemoryBuiltins.cpp:1208
llvm::ObjectSizeOffsetVisitor::knownSize
static bool knownSize(const SizeOffsetType &SizeOffset)
Definition: MemoryBuiltins.h:207
llvm::PHINode
Definition: Instructions.h:2651
llvm::ObjectSizeOffsetEvaluator::bothKnown
bool bothKnown(SizeOffsetEvalType SizeOffset)
Definition: MemoryBuiltins.h:292
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1174
llvm::CallInst
This class represents a function call, abstracting a target machine's calling convention.
Definition: Instructions.h:1461
llvm::ObjectSizeOffsetVisitor::ObjectSizeOffsetVisitor
ObjectSizeOffsetVisitor(const DataLayout &DL, const TargetLibraryInfo *TLI, LLVMContext &Context, ObjectSizeOpts Options={})
Definition: MemoryBuiltins.cpp:656
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
GEP
Hexagon Common GEP
Definition: HexagonCommonGEP.cpp:171
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::isAllocRemovable
bool isAllocRemovable(const CallBase *V, const TargetLibraryInfo *TLI)
Return false if the allocation can have side effects on the program state we are required to preserve...
Definition: MemoryBuiltins.cpp:322
llvm::AllocaInst
an instruction to allocate memory on the stack
Definition: Instructions.h:58
llvm::isLibFreeFunction
bool isLibFreeFunction(const Function *F, const LibFunc TLIFn)
isLibFreeFunction - Returns true if the function is a builtin free()
Definition: MemoryBuiltins.cpp:512
llvm::ObjectSizeOffsetVisitor::visitExtractElementInst
SizeOffsetType visitExtractElementInst(ExtractElementInst &I)
Definition: MemoryBuiltins.cpp:789
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::ObjectSizeOffsetEvaluator::anyKnown
bool anyKnown(SizeOffsetEvalType SizeOffset)
Definition: MemoryBuiltins.h:288
llvm::isMallocOrCallocLikeFn
bool isMallocOrCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI)
Tests if a value is a call or invoke to a library function that allocates memory similar to malloc or...
Definition: MemoryBuiltins.cpp:300
llvm::isFreeCall
const CallInst * isFreeCall(const Value *I, const TargetLibraryInfo *TLI)
isFreeCall - Returns non-null if the value is a call to the builtin free()
Definition: MemoryBuiltins.cpp:532
llvm::ObjectSizeOffsetVisitor::visitPHINode
SizeOffsetType visitPHINode(PHINode &)
Definition: MemoryBuiltins.cpp:961