[llvm] r344768 - [TI removal] Switch some newly added code over to use `Instruction`
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 18 17:22:10 PDT 2018
Author: chandlerc
Date: Thu Oct 18 17:22:10 2018
New Revision: 344768
URL: http://llvm.org/viewvc/llvm-project?rev=344768&view=rev
Log:
[TI removal] Switch some newly added code over to use `Instruction`
directly.
Modified:
llvm/trunk/include/llvm/Analysis/DivergenceAnalysis.h
llvm/trunk/include/llvm/Analysis/SyncDependenceAnalysis.h
llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp
llvm/trunk/lib/Analysis/SyncDependenceAnalysis.cpp
Modified: llvm/trunk/include/llvm/Analysis/DivergenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DivergenceAnalysis.h?rev=344768&r1=344767&r2=344768&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DivergenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/DivergenceAnalysis.h Thu Oct 18 17:22:10 2018
@@ -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.
///
Modified: llvm/trunk/include/llvm/Analysis/SyncDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/SyncDependenceAnalysis.h?rev=344768&r1=344767&r2=344768&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/SyncDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/SyncDependenceAnalysis.h Thu Oct 18 17:22:10 2018
@@ -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;
};
Modified: llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp?rev=344768&r1=344767&r2=344768&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp Thu Oct 18 17:22:10 2018
@@ -108,7 +108,7 @@ void DivergenceAnalysis::addUniformOverr
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::propagateJoinDi
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;
}
}
Modified: llvm/trunk/lib/Analysis/SyncDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SyncDependenceAnalysis.cpp?rev=344768&r1=344767&r2=344768&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/SyncDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/SyncDependenceAnalysis.cpp Thu Oct 18 17:22:10 2018
@@ -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 &SyncDependenceAnaly
}
const ConstBlockSet &
-SyncDependenceAnalysis::join_blocks(const TerminatorInst &Term) {
+SyncDependenceAnalysis::join_blocks(const Instruction &Term) {
// trivial case
if (Term.getNumSuccessors() < 1) {
return EmptyBlockSet;
More information about the llvm-commits
mailing list