Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/Analysis/SyncDependenceAnalysis.h b/linux-x64/clang/include/llvm/Analysis/SyncDependenceAnalysis.h
index 099403b..9838d62 100644
--- a/linux-x64/clang/include/llvm/Analysis/SyncDependenceAnalysis.h
+++ b/linux-x64/clang/include/llvm/Analysis/SyncDependenceAnalysis.h
@@ -21,6 +21,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/LoopInfo.h"
#include <memory>
+#include <unordered_map>
namespace llvm {
@@ -30,6 +31,26 @@
class PostDominatorTree;
using ConstBlockSet = SmallPtrSet<const BasicBlock *, 4>;
+struct ControlDivergenceDesc {
+ // Join points of divergent disjoint paths.
+ ConstBlockSet JoinDivBlocks;
+ // Divergent loop exits
+ ConstBlockSet LoopDivBlocks;
+};
+
+struct ModifiedPO {
+ std::vector<const BasicBlock *> LoopPO;
+ std::unordered_map<const BasicBlock *, unsigned> POIndex;
+ void appendBlock(const BasicBlock &BB) {
+ POIndex[&BB] = LoopPO.size();
+ LoopPO.push_back(&BB);
+ }
+ unsigned getIndexOf(const BasicBlock &BB) const {
+ return POIndex.find(&BB)->second;
+ }
+ unsigned size() const { return LoopPO.size(); }
+ const BasicBlock *getBlockAt(unsigned Idx) const { return LoopPO[Idx]; }
+};
/// \brief Relates points of divergent control to join points in
/// reducible CFGs.
@@ -37,12 +58,7 @@
/// This analysis relates points of divergent control to points of converging
/// divergent control. The analysis requires all loops to be reducible.
class SyncDependenceAnalysis {
- void visitSuccessor(const BasicBlock &succBlock, const Loop *termLoop,
- const BasicBlock *defBlock);
-
public:
- bool inRegion(const BasicBlock &BB) const;
-
~SyncDependenceAnalysis();
SyncDependenceAnalysis(const DominatorTree &DT, const PostDominatorTree &PDT,
const LoopInfo &LI);
@@ -56,28 +72,19 @@
/// 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 Instruction &Term);
-
- /// \brief Computes divergent join points and loop exits (in the surrounding
- /// loop) caused by the divergent loop exits of\p Loop.
- ///
- /// The set of blocks which are reachable by disjoint paths from the
- /// loop exits of \p Loop.
- /// This treats the loop as a single node in \p Loop's parent loop.
- /// The returned set has the same properties as for join_blocks(TermInst&).
- const ConstBlockSet &join_blocks(const Loop &Loop);
+ const ControlDivergenceDesc &getJoinBlocks(const Instruction &Term);
private:
- static ConstBlockSet EmptyBlockSet;
+ static ControlDivergenceDesc EmptyDivergenceDesc;
- ReversePostOrderTraversal<const Function *> FuncRPOT;
+ ModifiedPO LoopPO;
+
const DominatorTree &DT;
const PostDominatorTree &PDT;
const LoopInfo &LI;
- std::map<const Loop *, std::unique_ptr<ConstBlockSet>> CachedLoopExitJoins;
- std::map<const Instruction *, std::unique_ptr<ConstBlockSet>>
- CachedBranchJoins;
+ std::map<const Instruction *, std::unique_ptr<ControlDivergenceDesc>>
+ CachedControlDivDescs;
};
} // namespace llvm