[llvm] 7ea0ee3 - [DomTree] Avoid creating an empty GD to reduce compile time.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 13:45:51 PDT 2020
Author: Alina Sbirlea
Date: 2020-08-21T13:45:00-07:00
New Revision: 7ea0ee30588ebda7c5cd69e2472d2a8e46f62035
URL: https://github.com/llvm/llvm-project/commit/7ea0ee30588ebda7c5cd69e2472d2a8e46f62035
DIFF: https://github.com/llvm/llvm-project/commit/7ea0ee30588ebda7c5cd69e2472d2a8e46f62035.diff
LOG: [DomTree] Avoid creating an empty GD to reduce compile time.
Added:
Modified:
llvm/include/llvm/Support/GenericDomTreeConstruction.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index 984ddfbf4f4c..ff4b32193715 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -107,8 +107,19 @@ struct SemiNCAInfo {
static SmallVector<NodePtr, 8> getChildren(NodePtr N, BatchUpdatePtr BUI) {
if (BUI)
return BUI->PreViewCFG.template getChildren<Inversed>(N);
- GraphDiffT GD;
- return GD.template getChildren<Inversed>(N);
+ return getChildren<Inversed>(N);
+ }
+
+ template <bool Inversed>
+ static SmallVector<NodePtr, 8> getChildren(NodePtr N) {
+ using DirectedNodeT =
+ std::conditional_t<Inversed, Inverse<NodePtr>, NodePtr>;
+ auto R = children<DirectedNodeT>(N);
+ SmallVector<NodePtr, 8> Res(detail::reverse_if<!Inversed>(R));
+
+ // Remove nullptr children for clang.
+ llvm::erase_value(Res, nullptr);
+ return Res;
}
NodePtr getIDom(NodePtr BB) const {
More information about the llvm-commits
mailing list