forked from OSchip/llvm-project
[TI removal] Switch some newly added code over to use `Instruction`
directly. llvm-svn: 344768
This commit is contained in:
parent
2386657d49
commit
608e6faa06
|
@ -80,7 +80,7 @@ public:
|
|||
void print(raw_ostream &OS, const Module *) const;
|
||||
|
||||
private:
|
||||
bool updateTerminator(const TerminatorInst &Term) const;
|
||||
bool updateTerminator(const Instruction &Term) const;
|
||||
bool updatePHINode(const PHINode &Phi) const;
|
||||
|
||||
/// \brief Computes whether \p Inst is divergent based on the
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
|
||||
/// \brief Propagate induced value divergence due to control divergence in \p
|
||||
/// Term.
|
||||
void propagateBranchDivergence(const TerminatorInst &Term);
|
||||
void propagateBranchDivergence(const Instruction &Term);
|
||||
|
||||
/// \brief Propagate divergent caused by a divergent loop exit.
|
||||
///
|
||||
|
|
|
@ -29,8 +29,6 @@ class BasicBlock;
|
|||
class DominatorTree;
|
||||
class Loop;
|
||||
class PostDominatorTree;
|
||||
class TerminatorInst;
|
||||
class TerminatorInst;
|
||||
|
||||
using ConstBlockSet = SmallPtrSet<const BasicBlock *, 4>;
|
||||
|
||||
|
@ -59,7 +57,7 @@ public:
|
|||
/// header. Those exit blocks are added to the returned set.
|
||||
/// If L is the parent loop of \p Term and an exit of L is in the returned
|
||||
/// set then L is a divergent loop.
|
||||
const ConstBlockSet &join_blocks(const TerminatorInst &Term);
|
||||
const ConstBlockSet &join_blocks(const Instruction &Term);
|
||||
|
||||
/// \brief Computes divergent join points and loop exits (in the surrounding
|
||||
/// loop) caused by the divergent loop exits of\p Loop.
|
||||
|
@ -79,7 +77,7 @@ private:
|
|||
const LoopInfo &LI;
|
||||
|
||||
std::map<const Loop *, std::unique_ptr<ConstBlockSet>> CachedLoopExitJoins;
|
||||
std::map<const TerminatorInst *, std::unique_ptr<ConstBlockSet>>
|
||||
std::map<const Instruction *, std::unique_ptr<ConstBlockSet>>
|
||||
CachedBranchJoins;
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ void DivergenceAnalysis::addUniformOverride(const Value &UniVal) {
|
|||
UniformOverrides.insert(&UniVal);
|
||||
}
|
||||
|
||||
bool DivergenceAnalysis::updateTerminator(const TerminatorInst &Term) const {
|
||||
bool DivergenceAnalysis::updateTerminator(const Instruction &Term) const {
|
||||
if (Term.getNumSuccessors() <= 1)
|
||||
return false;
|
||||
if (auto *BranchTerm = dyn_cast<BranchInst>(&Term)) {
|
||||
|
@ -297,7 +297,7 @@ bool DivergenceAnalysis::propagateJoinDivergence(const BasicBlock &JoinBlock,
|
|||
return false;
|
||||
}
|
||||
|
||||
void DivergenceAnalysis::propagateBranchDivergence(const TerminatorInst &Term) {
|
||||
void DivergenceAnalysis::propagateBranchDivergence(const Instruction &Term) {
|
||||
LLVM_DEBUG(dbgs() << "propBranchDiv " << Term.getParent()->getName() << "\n");
|
||||
|
||||
markDivergent(Term);
|
||||
|
@ -380,11 +380,10 @@ void DivergenceAnalysis::compute() {
|
|||
continue;
|
||||
|
||||
// propagate divergence caused by terminator
|
||||
if (isa<TerminatorInst>(I)) {
|
||||
auto &Term = cast<TerminatorInst>(I);
|
||||
if (updateTerminator(Term)) {
|
||||
if (I.isTerminator()) {
|
||||
if (updateTerminator(I)) {
|
||||
// propagate control divergence to affected instructions
|
||||
propagateBranchDivergence(Term);
|
||||
propagateBranchDivergence(I);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ struct DivergencePropagator {
|
|||
}
|
||||
|
||||
// find all blocks reachable by two disjoint paths from @rootTerm.
|
||||
// This method works for both divergent TerminatorInsts and loops with
|
||||
// This method works for both divergent terminators and loops with
|
||||
// divergent exits.
|
||||
// @rootBlock is either the block containing the branch or the header of the
|
||||
// divergent loop.
|
||||
|
@ -355,7 +355,7 @@ const ConstBlockSet &SyncDependenceAnalysis::join_blocks(const Loop &Loop) {
|
|||
}
|
||||
|
||||
const ConstBlockSet &
|
||||
SyncDependenceAnalysis::join_blocks(const TerminatorInst &Term) {
|
||||
SyncDependenceAnalysis::join_blocks(const Instruction &Term) {
|
||||
// trivial case
|
||||
if (Term.getNumSuccessors() < 1) {
|
||||
return EmptyBlockSet;
|
||||
|
|
Loading…
Reference in New Issue