Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
Guessing this or one of the related patches introduced this build breakage? I haven't looked at it too carefully yet... http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/26570/steps/compile/logs/stdio On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Tue Nov 24 01:13:06 2015 > New Revision: 253958 > > URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev > Log: > Reduce the stack usage per recursive step when RecursiveASTVisitor cannot > perform data recursion. > > Modified: > cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > > Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff > > == > --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) > +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 > 2015 > @@ -471,28 +471,10 @@ private: >/// \brief Process clauses with list of variables. >template bool VisitOMPClauseList(T *Node); > > - bool dataTraverse(Stmt *S); >bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); > }; > > template > -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { > - SmallVectorQueue; > - Queue.push_back(S); > - > - while (!Queue.empty()) { > -Stmt *CurrS = Queue.pop_back_val(); > - > -size_t N = Queue.size(); > -TRY_TO(dataTraverseNode(CurrS, )); > -// Process new children in the order they were added. > -std::reverse(Queue.begin() + N, Queue.end()); > - } > - > - return true; > -} > - > -template > bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, > DataRecursionQueue > *Queue) { > #define DISPATCH_STMT(NAME, CLASS, VAR) > \ > @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >::TraverseStmt>::value) > return dataTraverseNode(S, nullptr); > > - if (!Queue) > -return dataTraverse(S); > + if (Queue) { > +Queue->push_back(S); > +return true; > + } > + > + SmallVector LocalQueue; > + LocalQueue.push_back(S); > + > + while (!LocalQueue.empty()) { > +Stmt *CurrS = LocalQueue.pop_back_val(); > + > +size_t N = LocalQueue.size(); > +TRY_TO(dataTraverseNode(CurrS, )); > +// Process new children in the order they were added. > +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); > + } > > - Queue->push_back(S); >return true; > } > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
On Tue, Nov 24, 2015 at 1:16 PM, Alexey Samsonovwrote: > Looks like Clang::Index/index-many-call-ops.cpp still uses too much stack > in ASan mode: > > http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10177/steps/check-clang%20asan/logs/stdio > > ASan increases the stack usage, so do you think there's more to fix here, > or we should just disable the test under ASan? > I think this should work even under ASan conditions; fixed in r254041. > On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: rsmith >> Date: Tue Nov 24 01:13:06 2015 >> New Revision: 253958 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev >> Log: >> Reduce the stack usage per recursive step when RecursiveASTVisitor cannot >> perform data recursion. >> >> Modified: >> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> >> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff >> >> == >> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) >> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 >> 2015 >> @@ -471,28 +471,10 @@ private: >>/// \brief Process clauses with list of variables. >>template bool VisitOMPClauseList(T *Node); >> >> - bool dataTraverse(Stmt *S); >>bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); >> }; >> >> template >> -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { >> - SmallVector Queue; >> - Queue.push_back(S); >> - >> - while (!Queue.empty()) { >> -Stmt *CurrS = Queue.pop_back_val(); >> - >> -size_t N = Queue.size(); >> -TRY_TO(dataTraverseNode(CurrS, )); >> -// Process new children in the order they were added. >> -std::reverse(Queue.begin() + N, Queue.end()); >> - } >> - >> - return true; >> -} >> - >> -template >> bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, >> DataRecursionQueue >> *Queue) { >> #define DISPATCH_STMT(NAME, CLASS, VAR) >> \ >> @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >>::TraverseStmt>::value) >> return dataTraverseNode(S, nullptr); >> >> - if (!Queue) >> -return dataTraverse(S); >> + if (Queue) { >> +Queue->push_back(S); >> +return true; >> + } >> + >> + SmallVector LocalQueue; >> + LocalQueue.push_back(S); >> + >> + while (!LocalQueue.empty()) { >> +Stmt *CurrS = LocalQueue.pop_back_val(); >> + >> +size_t N = LocalQueue.size(); >> +TRY_TO(dataTraverseNode(CurrS, )); >> +// Process new children in the order they were added. >> +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); >> + } >> >> - Queue->push_back(S); >>return true; >> } >> >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > > > > -- > Alexey Samsonov > vonos...@gmail.com > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
Unfortunately, that change breaks the Clang compilation, see r254041 review thread. On Tue, Nov 24, 2015 at 3:54 PM, Richard Smithwrote: > On Tue, Nov 24, 2015 at 1:16 PM, Alexey Samsonov > wrote: > >> Looks like Clang::Index/index-many-call-ops.cpp still uses too much stack >> in ASan mode: >> >> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10177/steps/check-clang%20asan/logs/stdio >> >> ASan increases the stack usage, so do you think there's more to fix here, >> or we should just disable the test under ASan? >> > > I think this should work even under ASan conditions; fixed in r254041. > > >> On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: rsmith >>> Date: Tue Nov 24 01:13:06 2015 >>> New Revision: 253958 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev >>> Log: >>> Reduce the stack usage per recursive step when RecursiveASTVisitor >>> cannot perform data recursion. >>> >>> Modified: >>> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >>> >>> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff >>> >>> == >>> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) >>> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 >>> 01:13:06 2015 >>> @@ -471,28 +471,10 @@ private: >>>/// \brief Process clauses with list of variables. >>>template bool VisitOMPClauseList(T *Node); >>> >>> - bool dataTraverse(Stmt *S); >>>bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); >>> }; >>> >>> template >>> -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { >>> - SmallVector Queue; >>> - Queue.push_back(S); >>> - >>> - while (!Queue.empty()) { >>> -Stmt *CurrS = Queue.pop_back_val(); >>> - >>> -size_t N = Queue.size(); >>> -TRY_TO(dataTraverseNode(CurrS, )); >>> -// Process new children in the order they were added. >>> -std::reverse(Queue.begin() + N, Queue.end()); >>> - } >>> - >>> - return true; >>> -} >>> - >>> -template >>> bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, >>> DataRecursionQueue >>> *Queue) { >>> #define DISPATCH_STMT(NAME, CLASS, VAR) >>> \ >>> @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >>> >>> ::TraverseStmt>::value) >>> return dataTraverseNode(S, nullptr); >>> >>> - if (!Queue) >>> -return dataTraverse(S); >>> + if (Queue) { >>> +Queue->push_back(S); >>> +return true; >>> + } >>> + >>> + SmallVector LocalQueue; >>> + LocalQueue.push_back(S); >>> + >>> + while (!LocalQueue.empty()) { >>> +Stmt *CurrS = LocalQueue.pop_back_val(); >>> + >>> +size_t N = LocalQueue.size(); >>> +TRY_TO(dataTraverseNode(CurrS, )); >>> +// Process new children in the order they were added. >>> +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); >>> + } >>> >>> - Queue->push_back(S); >>>return true; >>> } >>> >>> >>> >>> ___ >>> cfe-commits mailing list >>> cfe-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> >> >> >> -- >> Alexey Samsonov >> vonos...@gmail.com >> > > -- Alexey Samsonov vonos...@gmail.com ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
Looks like Clang::Index/index-many-call-ops.cpp still uses too much stack in ASan mode: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10177/steps/check-clang%20asan/logs/stdio ASan increases the stack usage, so do you think there's more to fix here, or we should just disable the test under ASan? On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Tue Nov 24 01:13:06 2015 > New Revision: 253958 > > URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev > Log: > Reduce the stack usage per recursive step when RecursiveASTVisitor cannot > perform data recursion. > > Modified: > cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > > Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff > > == > --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) > +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 > 2015 > @@ -471,28 +471,10 @@ private: >/// \brief Process clauses with list of variables. >template bool VisitOMPClauseList(T *Node); > > - bool dataTraverse(Stmt *S); >bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); > }; > > template > -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { > - SmallVectorQueue; > - Queue.push_back(S); > - > - while (!Queue.empty()) { > -Stmt *CurrS = Queue.pop_back_val(); > - > -size_t N = Queue.size(); > -TRY_TO(dataTraverseNode(CurrS, )); > -// Process new children in the order they were added. > -std::reverse(Queue.begin() + N, Queue.end()); > - } > - > - return true; > -} > - > -template > bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, > DataRecursionQueue > *Queue) { > #define DISPATCH_STMT(NAME, CLASS, VAR) > \ > @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave >::TraverseStmt>::value) > return dataTraverseNode(S, nullptr); > > - if (!Queue) > -return dataTraverse(S); > + if (Queue) { > +Queue->push_back(S); > +return true; > + } > + > + SmallVector LocalQueue; > + LocalQueue.push_back(S); > + > + while (!LocalQueue.empty()) { > +Stmt *CurrS = LocalQueue.pop_back_val(); > + > +size_t N = LocalQueue.size(); > +TRY_TO(dataTraverseNode(CurrS, )); > +// Process new children in the order they were added. > +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); > + } > > - Queue->push_back(S); >return true; > } > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- Alexey Samsonov vonos...@gmail.com ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
Author: rsmith Date: Tue Nov 24 01:13:06 2015 New Revision: 253958 URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev Log: Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion. Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 2015 @@ -471,28 +471,10 @@ private: /// \brief Process clauses with list of variables. template bool VisitOMPClauseList(T *Node); - bool dataTraverse(Stmt *S); bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); }; template -bool RecursiveASTVisitor::dataTraverse(Stmt *S) { - SmallVectorQueue; - Queue.push_back(S); - - while (!Queue.empty()) { -Stmt *CurrS = Queue.pop_back_val(); - -size_t N = Queue.size(); -TRY_TO(dataTraverseNode(CurrS, )); -// Process new children in the order they were added. -std::reverse(Queue.begin() + N, Queue.end()); - } - - return true; -} - -template bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, DataRecursionQueue *Queue) { #define DISPATCH_STMT(NAME, CLASS, VAR) \ @@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave ::TraverseStmt>::value) return dataTraverseNode(S, nullptr); - if (!Queue) -return dataTraverse(S); + if (Queue) { +Queue->push_back(S); +return true; + } + + SmallVector LocalQueue; + LocalQueue.push_back(S); + + while (!LocalQueue.empty()) { +Stmt *CurrS = LocalQueue.pop_back_val(); + +size_t N = LocalQueue.size(); +TRY_TO(dataTraverseNode(CurrS, )); +// Process new children in the order they were added. +std::reverse(LocalQueue.begin() + N, LocalQueue.end()); + } - Queue->push_back(S); return true; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits