46 for (
auto &Arg :
F.args()) {
47 if (
TTI->getInstructionUniformity(&Arg) ==
54void llvm::GenericUniformityAnalysisImpl<SSAContext>::pushUsers(
58 markDivergent(*UserInstr);
64void llvm::GenericUniformityAnalysisImpl<SSAContext>::pushUsers(
66 assert(!isAlwaysUniform(Instr));
67 if (
Instr.isTerminator())
73bool llvm::GenericUniformityAnalysisImpl<SSAContext>::usesValueFromCycle(
76 for (
const Use &U :
I.operands()) {
88 const Cycle &DefCycle) {
89 for (
auto *
User :
I.users()) {
91 if (DefCycle.
contains(UserInstr->getParent()))
93 markDivergent(*UserInstr);
94 recordTemporalDivergence(&
I, UserInstr, &DefCycle);
100 const Use &U)
const {
101 const auto *V = U.get();
106 return isTemporalDivergent(*UseInstr->getParent(), *DefInstr);
128 if (
TTI.hasBranchDivergence(&
F))
141 OS <<
"UniformityInfo for function '" <<
F.getName() <<
"':\n";
156 "Uniformity Analysis",
false,
true)
164 AU.setPreservesAll();
173 auto &targetTransformInfo =
177 m_uniformityInfo =
UniformityInfo{domTree, cycleInfo, &targetTransformInfo};
180 if (targetTransformInfo.hasBranchDivergence(m_function))
181 m_uniformityInfo.compute();
187 OS <<
"UniformityInfo for function '" << m_function->getName() <<
"':\n";
188 m_uniformityInfo.print(OS);
193 m_function =
nullptr;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Expand Atomic instructions
This file declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
FunctionAnalysisManager FAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
Analysis pass which computes a CycleInfo.
Legacy analysis pass which computes a CycleInfo.
Analysis pass which computes a DominatorTree.
Legacy analysis pass which computes a DominatorTree.
bool contains(const BlockT *Block) const
Return whether Block is contained in the cycle.
A Module instance is used to store all the information related to an LLVM module.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Analysis pass providing the TargetTransformInfo.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
iterator_range< user_iterator > users()
This class implements an extremely fast bulk output stream that can only output to a stream.
NodeAddr< InstrNode * > Instr
This is an optimization pass for GlobalISel generic memory operations.
GenericUniformityInfo< SSAContext > UniformityInfo
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
GenericSSAContext< Function > SSAContext
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
InstructionUniformity
Enum describing how instructions behave with respect to uniformity and divergence,...
@ AlwaysUniform
The result values are always uniform.
@ NeverUniform
The result values can never be assumed to be uniform.
@ Default
The result values are uniform if and only if all operands are uniform.
A special type used by analysis passes to provide an address that identifies that particular analysis...