LLVM 19.0.0git
SCCP.cpp
Go to the documentation of this file.
1//===-- SCCP.cpp ----------------------------------------------------------===//
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 Interprocedural Sparse Conditional Constant Propagation.
10//
11//===----------------------------------------------------------------------===//
12
14#include "llvm/ADT/SetVector.h"
24#include "llvm/IR/Constants.h"
25#include "llvm/IR/DIBuilder.h"
28#include "llvm/Support/ModRef.h"
29#include "llvm/Transforms/IPO.h"
34
35using namespace llvm;
36
37#define DEBUG_TYPE "sccp"
38
39STATISTIC(NumInstRemoved, "Number of instructions removed");
40STATISTIC(NumArgsElimed ,"Number of arguments constant propagated");
41STATISTIC(NumGlobalConst, "Number of globals found to be constant");
42STATISTIC(NumDeadBlocks , "Number of basic blocks unreachable");
43STATISTIC(NumInstReplaced,
44 "Number of instructions replaced with (simpler) instruction");
45
47 "funcspec-max-iters", cl::init(10), cl::Hidden, cl::desc(
48 "The maximum number of iterations function specialization is run"));
49
51 SmallVector<ReturnInst *, 8> &ReturnsToZap,
52 SCCPSolver &Solver) {
53 // We can only do this if we know that nothing else can call the function.
54 if (!Solver.isArgumentTrackedFunction(&F))
55 return;
56
57 if (Solver.mustPreserveReturn(&F)) {
59 dbgs()
60 << "Can't zap returns of the function : " << F.getName()
61 << " due to present musttail or \"clang.arc.attachedcall\" call of "
62 "it\n");
63 return;
64 }
65
66 assert(
67 all_of(F.users(),
68 [&Solver](User *U) {
69 if (isa<Instruction>(U) &&
70 !Solver.isBlockExecutable(cast<Instruction>(U)->getParent()))
71 return true;
72 // Non-callsite uses are not impacted by zapping. Also, constant
73 // uses (like blockaddresses) could stuck around, without being
74 // used in the underlying IR, meaning we do not have lattice
75 // values for them.
76 if (!isa<CallBase>(U))
77 return true;
78 if (U->getType()->isStructTy()) {
79 return all_of(Solver.getStructLatticeValueFor(U),
80 [](const ValueLatticeElement &LV) {
81 return !SCCPSolver::isOverdefined(LV);
82 });
83 }
84
85 // We don't consider assume-like intrinsics to be actual address
86 // captures.
87 if (auto *II = dyn_cast<IntrinsicInst>(U)) {
88 if (II->isAssumeLikeIntrinsic())
89 return true;
90 }
91
93 }) &&
94 "We can only zap functions where all live users have a concrete value");
95
96 for (BasicBlock &BB : F) {
97 if (CallInst *CI = BB.getTerminatingMustTailCall()) {
98 LLVM_DEBUG(dbgs() << "Can't zap return of the block due to present "
99 << "musttail call : " << *CI << "\n");
100 (void)CI;
101 return;
102 }
103
104 if (auto *RI = dyn_cast<ReturnInst>(BB.getTerminator()))
105 if (!isa<UndefValue>(RI->getOperand(0)))
106 ReturnsToZap.push_back(RI);
107 }
108}
109
110static bool runIPSCCP(
112 std::function<const TargetLibraryInfo &(Function &)> GetTLI,
113 std::function<TargetTransformInfo &(Function &)> GetTTI,
114 std::function<AssumptionCache &(Function &)> GetAC,
115 std::function<DominatorTree &(Function &)> GetDT,
116 std::function<BlockFrequencyInfo &(Function &)> GetBFI,
117 bool IsFuncSpecEnabled) {
118 SCCPSolver Solver(DL, GetTLI, M.getContext());
119 FunctionSpecializer Specializer(Solver, M, FAM, GetBFI, GetTLI, GetTTI,
120 GetAC);
121
122 // Loop over all functions, marking arguments to those with their addresses
123 // taken or that are external as overdefined.
124 for (Function &F : M) {
125 if (F.isDeclaration())
126 continue;
127
128 DominatorTree &DT = GetDT(F);
129 AssumptionCache &AC = GetAC(F);
130 Solver.addPredicateInfo(F, DT, AC);
131
132 // Determine if we can track the function's return values. If so, add the
133 // function to the solver's set of return-tracked functions.
135 Solver.addTrackedFunction(&F);
136
137 // Determine if we can track the function's arguments. If so, add the
138 // function to the solver's set of argument-tracked functions.
141 continue;
142 }
143
144 // Assume the function is called.
145 Solver.markBlockExecutable(&F.front());
146
147 // Assume nothing about the incoming arguments.
148 for (Argument &AI : F.args())
149 Solver.markOverdefined(&AI);
150 }
151
152 // Determine if we can track any of the module's global variables. If so, add
153 // the global variables we can track to the solver's set of tracked global
154 // variables.
155 for (GlobalVariable &G : M.globals()) {
156 G.removeDeadConstantUsers();
159 }
160
161 // Solve for constants.
163
164 if (IsFuncSpecEnabled) {
165 unsigned Iters = 0;
166 while (Iters++ < FuncSpecMaxIters && Specializer.run());
167 }
168
169 // Iterate over all of the instructions in the module, replacing them with
170 // constants if we have found them to be of constant values.
171 bool MadeChanges = false;
172 for (Function &F : M) {
173 if (F.isDeclaration())
174 continue;
175
176 SmallVector<BasicBlock *, 512> BlocksToErase;
177
178 if (Solver.isBlockExecutable(&F.front())) {
179 bool ReplacedPointerArg = false;
180 for (Argument &Arg : F.args()) {
181 if (!Arg.use_empty() && Solver.tryToReplaceWithConstant(&Arg)) {
182 ReplacedPointerArg |= Arg.getType()->isPointerTy();
183 ++NumArgsElimed;
184 }
185 }
186
187 // If we replaced an argument, we may now also access a global (currently
188 // classified as "other" memory). Update memory attribute to reflect this.
189 if (ReplacedPointerArg) {
190 auto UpdateAttrs = [&](AttributeList AL) {
191 MemoryEffects ME = AL.getMemoryEffects();
192 if (ME == MemoryEffects::unknown())
193 return AL;
194
195 ME |= MemoryEffects(IRMemLocation::Other,
196 ME.getModRef(IRMemLocation::ArgMem));
197 return AL.addFnAttribute(
198 F.getContext(),
199 Attribute::getWithMemoryEffects(F.getContext(), ME));
200 };
201
202 F.setAttributes(UpdateAttrs(F.getAttributes()));
203 for (User *U : F.users()) {
204 auto *CB = dyn_cast<CallBase>(U);
205 if (!CB || CB->getCalledFunction() != &F)
206 continue;
207
208 CB->setAttributes(UpdateAttrs(CB->getAttributes()));
209 }
210 }
211 MadeChanges |= ReplacedPointerArg;
212 }
213
214 SmallPtrSet<Value *, 32> InsertedValues;
215 for (BasicBlock &BB : F) {
216 if (!Solver.isBlockExecutable(&BB)) {
217 LLVM_DEBUG(dbgs() << " BasicBlock Dead:" << BB);
218 ++NumDeadBlocks;
219
220 MadeChanges = true;
221
222 if (&BB != &F.front())
223 BlocksToErase.push_back(&BB);
224 continue;
225 }
226
227 MadeChanges |= Solver.simplifyInstsInBlock(
228 BB, InsertedValues, NumInstRemoved, NumInstReplaced);
229 }
230
233 DomTreeUpdater DTU(DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy);
234 // Change dead blocks to unreachable. We do it after replacing constants
235 // in all executable blocks, because changeToUnreachable may remove PHI
236 // nodes in executable blocks we found values for. The function's entry
237 // block is not part of BlocksToErase, so we have to handle it separately.
238 for (BasicBlock *BB : BlocksToErase) {
239 NumInstRemoved += changeToUnreachable(BB->getFirstNonPHIOrDbg(),
240 /*PreserveLCSSA=*/false, &DTU);
241 }
242 if (!Solver.isBlockExecutable(&F.front()))
243 NumInstRemoved += changeToUnreachable(F.front().getFirstNonPHIOrDbg(),
244 /*PreserveLCSSA=*/false, &DTU);
245
246 BasicBlock *NewUnreachableBB = nullptr;
247 for (BasicBlock &BB : F)
248 MadeChanges |= Solver.removeNonFeasibleEdges(&BB, DTU, NewUnreachableBB);
249
250 for (BasicBlock *DeadBB : BlocksToErase)
251 if (!DeadBB->hasAddressTaken())
252 DTU.deleteBB(DeadBB);
253
254 for (BasicBlock &BB : F) {
255 for (Instruction &Inst : llvm::make_early_inc_range(BB)) {
256 if (Solver.getPredicateInfoFor(&Inst)) {
257 if (auto *II = dyn_cast<IntrinsicInst>(&Inst)) {
258 if (II->getIntrinsicID() == Intrinsic::ssa_copy) {
259 Value *Op = II->getOperand(0);
260 Inst.replaceAllUsesWith(Op);
261 Inst.eraseFromParent();
262 }
263 }
264 }
265 }
266 }
267 }
268
269 // If we inferred constant or undef return values for a function, we replaced
270 // all call uses with the inferred value. This means we don't need to bother
271 // actually returning anything from the function. Replace all return
272 // instructions with return undef.
273 //
274 // Do this in two stages: first identify the functions we should process, then
275 // actually zap their returns. This is important because we can only do this
276 // if the address of the function isn't taken. In cases where a return is the
277 // last use of a function, the order of processing functions would affect
278 // whether other functions are optimizable.
279 SmallVector<ReturnInst*, 8> ReturnsToZap;
280
281 for (const auto &I : Solver.getTrackedRetVals()) {
282 Function *F = I.first;
283 const ValueLatticeElement &ReturnValue = I.second;
284
285 // If there is a known constant range for the return value, add !range
286 // metadata to the function's call sites.
287 if (ReturnValue.isConstantRange() &&
288 !ReturnValue.getConstantRange().isSingleElement()) {
289 // Do not add range metadata if the return value may include undef.
290 if (ReturnValue.isConstantRangeIncludingUndef())
291 continue;
292
293 auto &CR = ReturnValue.getConstantRange();
294 for (User *User : F->users()) {
295 auto *CB = dyn_cast<CallBase>(User);
296 if (!CB || CB->getCalledFunction() != F)
297 continue;
298
299 // Do not touch existing metadata for now.
300 // TODO: We should be able to take the intersection of the existing
301 // metadata and the inferred range.
302 if (CB->getMetadata(LLVMContext::MD_range))
303 continue;
304
305 LLVMContext &Context = CB->getParent()->getContext();
306 Metadata *RangeMD[] = {
307 ConstantAsMetadata::get(ConstantInt::get(Context, CR.getLower())),
308 ConstantAsMetadata::get(ConstantInt::get(Context, CR.getUpper()))};
309 CB->setMetadata(LLVMContext::MD_range, MDNode::get(Context, RangeMD));
310 }
311 continue;
312 }
313 if (F->getReturnType()->isVoidTy())
314 continue;
315 if (SCCPSolver::isConstant(ReturnValue) || ReturnValue.isUnknownOrUndef())
316 findReturnsToZap(*F, ReturnsToZap, Solver);
317 }
318
319 for (auto *F : Solver.getMRVFunctionsTracked()) {
320 assert(F->getReturnType()->isStructTy() &&
321 "The return type should be a struct");
322 StructType *STy = cast<StructType>(F->getReturnType());
323 if (Solver.isStructLatticeConstant(F, STy))
324 findReturnsToZap(*F, ReturnsToZap, Solver);
325 }
326
327 // Zap all returns which we've identified as zap to change.
328 SmallSetVector<Function *, 8> FuncZappedReturn;
329 for (ReturnInst *RI : ReturnsToZap) {
330 Function *F = RI->getParent()->getParent();
331 RI->setOperand(0, UndefValue::get(F->getReturnType()));
332 // Record all functions that are zapped.
333 FuncZappedReturn.insert(F);
334 }
335
336 // Remove the returned attribute for zapped functions and the
337 // corresponding call sites.
338 // Also remove any attributes that convert an undef return value into
339 // immediate undefined behavior
340 AttributeMask UBImplyingAttributes =
342 for (Function *F : FuncZappedReturn) {
343 for (Argument &A : F->args())
344 F->removeParamAttr(A.getArgNo(), Attribute::Returned);
345 F->removeRetAttrs(UBImplyingAttributes);
346 for (Use &U : F->uses()) {
347 CallBase *CB = dyn_cast<CallBase>(U.getUser());
348 if (!CB) {
349 assert(isa<BlockAddress>(U.getUser()) ||
350 (isa<Constant>(U.getUser()) &&
351 all_of(U.getUser()->users(), [](const User *UserUser) {
352 return cast<IntrinsicInst>(UserUser)->isAssumeLikeIntrinsic();
353 })));
354 continue;
355 }
356
357 for (Use &Arg : CB->args())
358 CB->removeParamAttr(CB->getArgOperandNo(&Arg), Attribute::Returned);
359 CB->removeRetAttrs(UBImplyingAttributes);
360 }
361 }
362
363 // If we inferred constant or undef values for globals variables, we can
364 // delete the global and any stores that remain to it.
365 for (const auto &I : make_early_inc_range(Solver.getTrackedGlobals())) {
366 GlobalVariable *GV = I.first;
367 if (SCCPSolver::isOverdefined(I.second))
368 continue;
369 LLVM_DEBUG(dbgs() << "Found that GV '" << GV->getName()
370 << "' is constant!\n");
371 while (!GV->use_empty()) {
372 StoreInst *SI = cast<StoreInst>(GV->user_back());
373 SI->eraseFromParent();
374 }
375
376 // Try to create a debug constant expression for the global variable
377 // initializer value.
379 GV->getDebugInfo(GVEs);
380 if (GVEs.size() == 1) {
381 DIBuilder DIB(M);
383 DIB, *GV->getInitializer(), *GV->getValueType()))
384 GVEs[0]->replaceOperandWith(1, InitExpr);
385 }
386
387 MadeChanges = true;
388 M.eraseGlobalVariable(GV);
389 ++NumGlobalConst;
390 }
391
392 return MadeChanges;
393}
394
396 const DataLayout &DL = M.getDataLayout();
397 auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
398 auto GetTLI = [&FAM](Function &F) -> const TargetLibraryInfo & {
400 };
401 auto GetTTI = [&FAM](Function &F) -> TargetTransformInfo & {
403 };
404 auto GetAC = [&FAM](Function &F) -> AssumptionCache & {
406 };
407 auto GetDT = [&FAM](Function &F) -> DominatorTree & {
409 };
410 auto GetBFI = [&FAM](Function &F) -> BlockFrequencyInfo & {
412 };
413
414
415 if (!runIPSCCP(M, DL, &FAM, GetTLI, GetTTI, GetAC, GetDT, GetBFI,
417 return PreservedAnalyses::all();
418
423 return PA;
424}
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
#define LLVM_DEBUG(X)
Definition: Debug.h:101
static void findReturnsToZap(Function &F, SmallVector< ReturnInst *, 8 > &ReturnsToZap, SCCPSolver &Solver)
Definition: SCCP.cpp:50
static cl::opt< unsigned > FuncSpecMaxIters("funcspec-max-iters", cl::init(10), cl::Hidden, cl::desc("The maximum number of iterations function specialization is run"))
static bool runIPSCCP(Module &M, const DataLayout &DL, FunctionAnalysisManager *FAM, std::function< const TargetLibraryInfo &(Function &)> GetTLI, std::function< TargetTransformInfo &(Function &)> GetTTI, std::function< AssumptionCache &(Function &)> GetAC, std::function< DominatorTree &(Function &)> GetDT, std::function< BlockFrequencyInfo &(Function &)> GetBFI, bool IsFuncSpecEnabled)
Definition: SCCP.cpp:110
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define G(x, y, z)
Definition: MD5.cpp:56
LLVMContext & Context
if(VerifyEach)
FunctionAnalysisManager FAM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
#define STATISTIC(VARNAME, DESC)
Definition: Statistic.h:167
This pass exposes codegen information to IR-level passes.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:348
PassT::Result * getCachedResult(IRUnitT &IR) const
Get the cached result of an analysis pass for a given IR unit.
Definition: PassManager.h:519
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:500
This class represents an incoming formal argument to a Function.
Definition: Argument.h:28
A function analysis which provides an AssumptionCache.
A cache of @llvm.assume calls within a function.
static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)
Definition: Attributes.cpp:215
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
Analysis pass which computes BlockFrequencyInfo.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1259
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
Definition: InstrTypes.h:1657
void removeRetAttrs(const AttributeMask &AttrsToRemove)
Removes the attributes from the return value.
Definition: InstrTypes.h:1652
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
Definition: InstrTypes.h:1417
unsigned getArgOperandNo(const Use *U) const
Given a use for a arg operand, get the arg operand number that corresponds to it.
Definition: InstrTypes.h:1457
This class represents a function call, abstracting a target machine's calling convention.
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:528
bool isSingleElement() const
Return true if this set contains exactly one member.
DWARF expression.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
Analysis pass which computes a DominatorTree.
Definition: Dominators.h:275
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:162
bool run()
Attempt to specialize functions in the module to enable constant propagation across function boundari...
Type * getValueType() const
Definition: GlobalValue.h:296
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression * > &GVs) const
Fill the vector with all debug info attachements.
Definition: Metadata.cpp:1845
bool isFuncSpecEnabled() const
Definition: SCCP.h:58
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: SCCP.cpp:395
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
Definition: PassManager.h:658
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1541
ModRefInfo getModRef(Location Loc) const
Get ModRefInfo for the given Location.
Definition: ModRef.h:165
static MemoryEffectsBase unknown()
Create MemoryEffectsBase that can read and write any memory.
Definition: ModRef.h:112
Root of the metadata hierarchy.
Definition: Metadata.h:62
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Analysis pass which computes a PostDominatorTree.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: Analysis.h:115
void preserve()
Mark an analysis as preserved.
Definition: Analysis.h:129
Return a value (possibly void), from a function.
SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propaga...
Definition: SCCPSolver.h:65
const DenseMap< GlobalVariable *, ValueLatticeElement > & getTrackedGlobals()
getTrackedGlobals - Get and return the set of inferred initializers for global variables.
void trackValueOfGlobalVariable(GlobalVariable *GV)
trackValueOfGlobalVariable - Clients can use this method to inform the SCCPSolver that it should trac...
bool tryToReplaceWithConstant(Value *V)
Definition: SCCPSolver.cpp:76
bool isStructLatticeConstant(Function *F, StructType *STy)
void addPredicateInfo(Function &F, DominatorTree &DT, AssumptionCache &AC)
void addTrackedFunction(Function *F)
addTrackedFunction - If the SCCP solver is supposed to track calls into and out of the specified func...
const MapVector< Function *, ValueLatticeElement > & getTrackedRetVals()
getTrackedRetVals - Get the inferred return value map.
void solveWhileResolvedUndefsIn(Module &M)
const PredicateBase * getPredicateInfoFor(Instruction *I)
void addArgumentTrackedFunction(Function *F)
const SmallPtrSet< Function *, 16 > getMRVFunctionsTracked()
getMRVFunctionsTracked - Get the set of functions which return multiple values tracked by the pass.
bool simplifyInstsInBlock(BasicBlock &BB, SmallPtrSetImpl< Value * > &InsertedValues, Statistic &InstRemovedStat, Statistic &InstReplacedStat)
Definition: SCCPSolver.cpp:221
const ValueLatticeElement & getLatticeValueFor(Value *V) const
bool removeNonFeasibleEdges(BasicBlock *BB, DomTreeUpdater &DTU, BasicBlock *&NewUnreachableBB) const
Definition: SCCPSolver.cpp:245
bool isBlockExecutable(BasicBlock *BB) const
bool markBlockExecutable(BasicBlock *BB)
markBlockExecutable - This method can be used by clients to mark all of the blocks that are known to ...
static bool isConstant(const ValueLatticeElement &LV)
Definition: SCCPSolver.cpp:55
bool mustPreserveReturn(Function *F)
Returns true if the return of the given function cannot be modified.
static bool isOverdefined(const ValueLatticeElement &LV)
Definition: SCCPSolver.cpp:60
bool isArgumentTrackedFunction(Function *F)
Returns true if the given function is in the solver's set of argument-tracked functions.
void markOverdefined(Value *V)
markOverdefined - Mark the specified value overdefined.
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition: SetVector.h:162
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:427
A SetVector that performs no allocations if smaller than a certain size.
Definition: SetVector.h:370
size_t size() const
Definition: SmallVector.h:91
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
An instruction for storing to memory.
Definition: Instructions.h:302
Class to represent struct types.
Definition: DerivedTypes.h:216
Analysis pass providing the TargetTransformInfo.
Analysis pass providing the TargetLibraryInfo.
Provides information about what library functions are available for the current target.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1808
A Use represents the edge between a Value definition and its users.
Definition: Use.h:43
This class represents lattice values for constants.
Definition: ValueLattice.h:29
bool isConstantRangeIncludingUndef() const
Definition: ValueLattice.h:242
const ConstantRange & getConstantRange(bool UndefAllowed=true) const
Returns the constant range for this value.
Definition: ValueLattice.h:269
bool isConstantRange(bool UndefAllowed=true) const
Returns true if this value is a constant range.
Definition: ValueLattice.h:249
bool isUnknownOrUndef() const
Definition: ValueLattice.h:239
LLVM Value Representation.
Definition: Value.h:74
User * user_back()
Definition: Value.h:407
bool use_empty() const
Definition: Value.h:344
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
AttributeMask getUBImplyingAttributes()
Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:450
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1731
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Definition: STLExtras.h:665
bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV)
Determine if the value maintained in the given global variable can be tracked interprocedurally.
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
Definition: ModRef.h:268
DIExpression * getExpressionForConstant(DIBuilder &DIB, const Constant &C, Type &Ty)
Given a constant, create a debug information expression.
Definition: Local.cpp:3574
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
unsigned changeToUnreachable(Instruction *I, bool PreserveLCSSA=false, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)
Insert an unreachable instruction before the specified instruction, making it and the rest of the cod...
Definition: Local.cpp:2797
bool canTrackReturnsInterprocedurally(Function *F)
Determine if the values of the given function's returns can be tracked interprocedurally.
bool canTrackArgumentsInterprocedurally(Function *F)
Determine if the values of the given function's arguments can be tracked interprocedurally.