34void llvm::GenericUniformityAnalysisImpl<SSAContext>::pushUsers(
38 markDivergent(*UserInstr);
44void llvm::GenericUniformityAnalysisImpl<SSAContext>::pushUsers(
46 assert(!isAlwaysUniform(Instr));
47 if (
Instr.isTerminator())
55 bool haveDivergentArgs =
false;
56 for (
const auto &Arg :
F.args()) {
58 if (!haveDivergentArgs) {
59 OS <<
"DIVERGENT ARGUMENTS:\n";
60 haveDivergentArgs =
true;
62 OS <<
" DIVERGENT: " <<
Context.print(&Arg) <<
'\n';
65 return haveDivergentArgs;
73 for (
auto &Arg :
F.args()) {
74 if (
TTI->getInstructionUniformity(&Arg) ==
107 for (
const Value *Arg : DivergentArgs)
112bool llvm::GenericUniformityAnalysisImpl<SSAContext>::usesValueFromCycle(
115 for (
const Use &U :
I.operands()) {
127 const Cycle &DefCycle) {
128 for (
auto *
User :
I.users()) {
130 if (DefCycle.
contains(UserInstr->getParent()))
132 markDivergent(*UserInstr);
133 recordTemporalDivergence(&
I, UserInstr, &DefCycle);
139 const Use &U)
const {
140 const auto *V = U.get();
145 return isTemporalDivergent(*UseInstr->getParent(), *DefInstr);
155 UniformArgs[Idx] = !isDivergentUse(
Use);
156 return TTI->isUniform(&
I, UniformArgs);
176 if (
TTI.hasBranchDivergence(&
F))
189 OS <<
"UniformityInfo for function '" <<
F.getName() <<
"':\n";
204 "Uniformity Analysis",
false,
true)
212 AU.setPreservesAll();
221 auto &targetTransformInfo =
225 m_uniformityInfo =
UniformityInfo{domTree, cycleInfo, &targetTransformInfo};
228 if (targetTransformInfo.hasBranchDivergence(m_function))
229 m_uniformityInfo.compute();
235 OS <<
"UniformityInfo for function '" << m_function->getName() <<
"':\n";
236 m_uniformityInfo.print(OS);
241 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)
This file implements the SmallBitVector class.
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.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
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
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
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.
@ Custom
The result values require a custom uniformity check.
A special type used by analysis passes to provide an address that identifies that particular analysis...