diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp index 5c5774066b8b..a0211edce099 100644 --- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp @@ -484,7 +484,9 @@ static void FactorNodes(std::unique_ptr &MatcherPtr) { } Matcher *Entries[2] = { PrevMatcher, MatcherWithoutCTM }; - Cases[Entry-1].second = new ScopeMatcher(Entries); + std::unique_ptr Case(new ScopeMatcher(Entries)); + FactorNodes(Case); + Cases[Entry-1].second = Case.release(); continue; }