From b68b8be8e2b930056d134a2632dd7a80ad0c701c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 6 Feb 2020 18:03:15 +0100 Subject: [PATCH] [mlir-tblgen] Stop leaking PredNodes Technically a leak in tblgen is harmless, but this makes asan builds of mlir very noisy. Just use a SpecificBumpPtrAllocator that knows how to clean up after itself. --- mlir/lib/TableGen/Predicate.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mlir/lib/TableGen/Predicate.cpp b/mlir/lib/TableGen/Predicate.cpp index 59bb0c5b191043..2ebec1b3b6eef5 100644 --- a/mlir/lib/TableGen/Predicate.cpp +++ b/mlir/lib/TableGen/Predicate.cpp @@ -136,10 +136,11 @@ using Subst = std::pair; // have children, and perform leaf substitutions inplace. Note that after // substitution, nodes are still pointing to the original TableGen record. // All nodes are created within "allocator". -static PredNode *buildPredicateTree(const tblgen::Pred &root, - llvm::BumpPtrAllocator &allocator, - ArrayRef substitutions) { - auto *rootNode = allocator.Allocate(); +static PredNode * +buildPredicateTree(const tblgen::Pred &root, + llvm::SpecificBumpPtrAllocator &allocator, + ArrayRef substitutions) { + auto *rootNode = allocator.Allocate(); new (rootNode) PredNode; rootNode->kind = getPredCombinerKind(root); rootNode->predicate = &root; @@ -339,7 +340,7 @@ static std::string getCombinedCondition(const PredNode &root) { } std::string tblgen::CombinedPred::getConditionImpl() const { - llvm::BumpPtrAllocator allocator; + llvm::SpecificBumpPtrAllocator allocator; auto predicateTree = buildPredicateTree(*this, allocator, {}); predicateTree = propagateGroundTruth( predicateTree,