LLVM 17.0.0git
Go to the documentation of this file.
1//===- ProvenanceAnalysisEvaluator.cpp - ObjC ARC Optimization ------------===//
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
11#include "llvm/ADT/SetVector.h"
13#include "llvm/IR/Function.h"
17using namespace llvm;
18using namespace llvm::objcarc;
21 StringRef Name = V->getName();
22 if (Name.startswith("\1"))
23 return Name.substr(1);
24 return Name;
27static void insertIfNamed(SetVector<Value *> &Values, Value *V) {
28 if (!V->hasName())
29 return;
30 Values.insert(V);
34 SetVector<Value *> Values;
36 for (auto &Arg : F.args())
37 insertIfNamed(Values, &Arg);
39 for (Instruction &I : instructions(F)) {
40 insertIfNamed(Values, &I);
42 for (auto &Op : I.operands())
43 insertIfNamed(Values, Op);
44 }
47 PA.setAA(&AM.getResult<AAManager>(F));
49 for (Value *V1 : Values) {
50 StringRef NameV1 = getName(V1);
51 for (Value *V2 : Values) {
52 StringRef NameV2 = getName(V2);
53 if (NameV1 >= NameV2)
54 continue;
55 errs() << NameV1 << " and " << NameV2;
56 if (PA.related(V1, V2))
57 errs() << " are related.\n";
58 else
59 errs() << " are not related.\n";
60 }
61 }
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
std::string Name
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
print must be executed print the must be executed context for all instructions
static void insertIfNamed(SetVector< Value * > &Values, Value *V)
static StringRef getName(Value *V)
This file declares a special form of Alias Analysis called Provenance Analysis''.
This file implements a set that has insertion order iteration characteristics.
A manager for alias analyses.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:774
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:158
A vector that has set insertion semantics.
Definition: SetVector.h:40
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition: SetVector.h:141
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
bool hasName() const
Definition: Value.h:261
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:308
This is similar to BasicAliasAnalysis, and it uses many of the same techniques, except it uses specia...
bool related(const Value *A, const Value *B)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)