[PATCH] D39768: [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame

2017-11-07 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: EricWF. We don't want to store cleanup dest slot saved into the coroutine frame (as some of the cleanup code may access them after coroutine frame destroyed). This is an alternative to https://reviews.llvm.org/D37093 It is possible t

[PATCH] D39768: [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame

2017-11-11 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL317981: [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it… (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D39768?vs=122004&id=122585#toc Repo

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-14 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 91790. GorNishanov added a comment. - reworked EmitAwait/Yield to has the signature similar to EmitAnyExpr - await expresions now support _Complex types. - s/Suffix/Prefix in buildCoroutineSuffix, since it was actually building a prefix - buildCoroutineSu

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-14 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov marked 4 inline comments as done. GorNishanov added inline comments. Comment at: lib/CodeGen/CGCoroutine.cpp:26 +enum class AwaitKind { Init, Normal, Yield, Final }; +char const *AwaitKindStr[] = {"init", "await", "yield", "final"}; +} majnemer wrote:

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-20 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov marked 2 inline comments as done. GorNishanov added a comment. Looks good now? https://reviews.llvm.org/D30809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-25 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 93061. GorNishanov added a comment. Thank you very much for the review! Merged with the top of the trunk and preparing to land https://reviews.llvm.org/D30809 Files: lib/CodeGen/CGCoroutine.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-26 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov closed this revision. GorNishanov added a comment. Commit: r298784 https://reviews.llvm.org/D30809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31399: [coroutines] Handle get_return_object_on_allocation_failure

2017-03-27 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: mehdi_amini. If promise_type has get_return_object_on_allocation_failure defined, check if an allocation function returns nullptr, and if so, return the result of get_return_object_on_allocation_failure(). https://reviews.llvm.org/D3

[PATCH] D31399: [coroutines] Handle get_return_object_on_allocation_failure

2017-03-27 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 93177. GorNishanov added a comment. Added diagnostic test to SemaCXX/coroutines.cpp Preparing to Land https://reviews.llvm.org/D31399 Files: include/clang/AST/StmtCXX.h include/clang/Basic/DiagnosticSemaKinds.td lib/AST/StmtCXX.cpp lib/CodeGen/C

[PATCH] D31399: [coroutines] Handle get_return_object_on_allocation_failure

2017-03-27 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. GorNishanov marked an inline comment as done. Closed by commit rL298891: [coroutines] Handle get_return_object_on_allocation_failure (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D31399?vs=9

[PATCH] D31460: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

2017-03-29 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. - Use pushCleanup to emit freeing coroutine memory on normal and EH exits. - Surround emitted code with CodeGenFunction::RunCleanupsScope. https://reviews.llvm.org/D31460 Files: lib/CodeGen/CGCoroutine.cpp test/CodeGenCoroutines/coro-cleanup.cpp test/Cod

[PATCH] D31460: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

2017-03-29 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/CodeGen/CGCoroutine.cpp:225 + void Emit(CodeGenFunction &CGF, Flags) override { +CGF.EmitStmt(Deallocate); + } rnk wrote: > This will be called twice: once for a normal exit and once for exceptional > exit

[PATCH] D31460: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

2017-03-29 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/CodeGen/CGCoroutine.cpp:225 + void Emit(CodeGenFunction &CGF, Flags) override { +CGF.EmitStmt(Deallocate); + } rnk wrote: > GorNishanov wrote: > > rnk wrote: > > > This will be called twice: once for a norm

[PATCH] D31487: [coroutines] Fix rebuilding of implicit and dependent coroutine statements.

2017-03-30 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/Sema/CoroutineBuilder.h:53 +assert(this->IsValid && "coroutine already invalid"); +this->IsValid = makeReturnObject() && makeParamMoves(); +if (this->IsValid && !IsPromiseDependentType) makeReturnObje

[PATCH] D31460: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

2017-03-31 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL299281: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine… (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D31460?vs=93370&id=93728#toc Reposi

[PATCH] D31487: [coroutines] Fix rebuilding of implicit and dependent coroutine statements.

2017-04-01 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/Sema/CoroutineBuilder.h:1 +//===- CoroutineBuilder.h - Coroutine Semantic checking -*- C++ -*-===// +// I would name the file to match the class it declares, i.e CoroutineStmtBuilder.h, since it is the

[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-04-01 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D31562 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/list

[PATCH] D31584: [coroutines] Add support for allocation elision

2017-04-02 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. We wrap allocation code so that backend can elide it if necessary. llvm.coro.alloc intrinsic returns true, when allocation is needed and false otherwise. %NeedAlloc = call i1 @llvm.coro.alloc(token %2) br i1 %NeedAlloc, label %AllocBB, label %InitBB

[PATCH] D31586: [coroutines] Replace all coro.frame builtins with an SSA value of coro.begin

2017-04-02 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. SemaCoroutine forms expressions referring to the coroutine frame of the enclosing coroutine using coro.frame builtin. During codegen, we emit llvm.coro.begin intrinsic that returns the address of the coroutine frame. When coro.frame is emitted, we replace it wi

[PATCH] D31590: [coroutines] Add support for deallocation elision

2017-04-02 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Wrap deallocation code with: if (auto *mem = coro.free()) Deallocate When backend decides to elide allocations it will replace coro.free with nullptr to suppress deallocation code. https://reviews.llvm.org/D31590 Files: lib/CodeGen/CGCoroutine.cpp tes

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-04-03 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. https://reviews.llvm.org/D31608 Files: lib/CodeGen/CGCoroutine.cpp test/CodeGenCoroutines/coro-await.cpp test/CodeGenCoroutines/coro-cleanup.cpp Index: test/CodeGenCoroutines/coro-cleanup.cpp ===

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-04-03 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 93889. GorNishanov added a comment. Added a CHECK that for a final suspend we correctly set "IsFinalSuspend" argument of @llvm.coro.suspend https://reviews.llvm.org/D31608 Files: lib/CodeGen/CGCoroutine.cpp test/CodeGenCoroutines/coro-await.cpp t

[PATCH] D31487: [coroutines] Fix rebuilding of implicit and dependent coroutine statements.

2017-04-03 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM with nits addressed https://reviews.llvm.org/D31487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/

[PATCH] D31627: [coroutines] Skip over passthrough operator co_await

2017-04-03 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. https://reviews.llvm.org/D31627 Files: lib/CodeGen/CGCoroutine.cpp test/CodeGenCoroutines/coro-await.cpp Index: test/CodeGenCoroutines/coro-await.cpp === --- test/CodeGenCoroutines/coro-await.

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-04-03 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. 1. build declaration of the gro local variable that keeps the result of get_return_object. 2. build return statement returning the gro variable 3. emit them during CodeGen 4. sema and CodeGen tests updated https://reviews.llvm.org/D31646 Files: include/clan

[PATCH] D31670: [coroutines] Implement correct GRO lifetime

2017-04-04 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: EricWF. Sema creates a declaration for gro variable as: auto $gro = $promise.get_return_object(); However, gro variable has to outlive coroutine frame and coroutine promise, but, it can only be initialized after the coroutine promis

[PATCH] D31692: [coroutines] Wrap the body of the coroutine in try-catch

2017-04-04 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. If unhandled_exception member function is present in the coroutine promise, wrap the body of the coroutine in: try { body } catch(...) { promise.unhandled_exception(); } https://reviews.llvm.org/D31692 Files: include/clang/AST/StmtCXX.h include/

[PATCH] D25444: [coroutines] Add coro.end handling

2017-04-04 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 94161. GorNishanov retitled this revision from "[coroutines] Hybrid (bundle + bool returning coro.end approach)" to "[coroutines] Add coro.end handling". GorNishanov edited the summary of this revision. GorNishanov added a subscriber: cfe-commits. GorNisha

[PATCH] D25444: [coroutines] Add coro.end handling

2017-04-04 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL299510: [coroutines] Add coro.end handling (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D25444?vs=94161&id=94162#toc Repository: rL LLVM https://reviews.llvm.org/D254

[PATCH] D31584: [coroutines] Add support for allocation elision

2017-04-10 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Gentle ping https://reviews.llvm.org/D31584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-04-10 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Pretty please. Gentle ping. https://reviews.llvm.org/D31608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31590: [coroutines] Add support for deallocation elision

2017-04-10 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Gentle ping https://reviews.llvm.org/D31590 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31586: [coroutines] Replace all coro.frame builtins with an SSA value of coro.begin

2017-04-10 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. gentle ping https://reviews.llvm.org/D31586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31627: [coroutines] Skip over passthrough operator co_await

2017-04-10 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. gentle ping https://reviews.llvm.org/D31627 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-04-11 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Gentle ping. When all outstanding CRs are committed we will get 90% of working corouitnes in Clang https://reviews.llvm.org/D31646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bi

[PATCH] D31692: [coroutines] Wrap the body of the coroutine in try-catch

2017-04-11 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/Sema/SemaCoroutine.cpp:977 + // Since the body of the coroutine will be wrapped in try-catch, it will + // be incompativle with SEH __try if present in a function. + if (!S.getLangOpts().Borland && Fn.FirstSEHTryLoc.isValid()

[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-04-13 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/Sema/CoroutineBuilder.h:1 +//===- CoroutineBuilder.h - Coroutine Semantic checking -*- C++ -*-===// +// This file is called: CoroutineStmtBuilder.h in trunk Comment at: lib/Sema/Co

[PATCH] D31584: [coroutines] Add support for allocation elision

2017-04-16 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. It is a simple change. If there is no objections, I'll commit it tomorrow. https://reviews.llvm.org/D31584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-04-17 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Melodic ping https://reviews.llvm.org/D31646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-01-17 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: mehdi_amini. Sema::CheckCompletedCoroutineBody was growing unwieldy with building all of the substatements. Also, constructors for CoroutineBodyStmt had way too many parameters. Instead, CoroutineBodyStmt now defines CtorArgs struct

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-01-20 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. @rsmith, Looking good? https://reviews.llvm.org/D28835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-01-23 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 85489. GorNishanov added a comment. No changes. Merge with top of the tree (to simplify comparing with the updated version that is coming up in a second). https://reviews.llvm.org/D28835 Files: include/clang/AST/StmtCXX.h include/clang/Sema/ScopeIn

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-01-23 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 85490. GorNishanov added a comment. Feedback implemented! https://reviews.llvm.org/D28835 Files: include/clang/AST/StmtCXX.h include/clang/Sema/ScopeInfo.h lib/AST/StmtCXX.cpp lib/Sema/SemaCoroutine.cpp test/SemaCXX/coroutines.cpp Index: test

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-01-23 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov marked 2 inline comments as done. GorNishanov added a comment. Looks even better now! https://reviews.llvm.org/D28835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-01-30 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. LGTM? Pretty please :) https://reviews.llvm.org/D28835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-02-06 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Gentle and melodic ping. https://reviews.llvm.org/D28835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D35383: [coroutines] Add serialization/deserialization of coroutines

2017-07-13 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: EricWF. https://reviews.llvm.org/D35383 Files: include/clang/AST/StmtCXX.h include/clang/Serialization/ASTBitCodes.h lib/AST/StmtCXX.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/PCH/corou

[PATCH] D35383: [coroutines] Add serialization/deserialization of coroutines

2017-07-24 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. @rsmith, ping. Would be good to get this in for clang 5.0 https://reviews.llvm.org/D35383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D35383: [coroutines] Add serialization/deserialization of coroutines

2017-07-25 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 108111. GorNishanov added a comment. Thank you for the review. Feedback implemented. Preparing to land https://reviews.llvm.org/D35383 Files: include/clang/AST/StmtCXX.h include/clang/Serialization/ASTBitCodes.h lib/AST/StmtCXX.cpp lib/Serializa

[PATCH] D35383: [coroutines] Add serialization/deserialization of coroutines

2017-07-25 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. GorNishanov marked an inline comment as done. Closed by commit rL308996: [coroutines] Add serialization/deserialization of coroutines (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D35383?vs=

[PATCH] D41820: [coroutines] Pass coro func args to promise ctor

2018-01-12 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. In https://reviews.llvm.org/D41820#974116, @EricWF wrote: > Is this behavior specified somewhere? Or are we simply adding an extension to > Clang? If so I would really prefer to add my `co_promise` solution (but I > need to write a paper in favor of it first). Bef

[PATCH] D41820: [coroutines] Pass coro func args to promise ctor

2018-01-23 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM! Repository: rC Clang https://reviews.llvm.org/D41820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm

[PATCH] D42343: [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.

2018-01-29 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D42343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/list

[PATCH] D42606: [Coroutines] Use allocator overload when available

2018-02-01 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov requested changes to this revision. GorNishanov added inline comments. This revision now requires changes to proceed. Comment at: lib/CodeGen/CGCoroutine.cpp:526 EmitBlock(AllocBB); - auto *AllocateCall = EmitScalarExpr(S.getAllocate()); + // Emit the call to the

[PATCH] D42606: [Coroutines] Use allocator overload when available

2018-02-01 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments. Comment at: lib/CodeGen/CGCoroutine.cpp:526 EmitBlock(AllocBB); - auto *AllocateCall = EmitScalarExpr(S.getAllocate()); + // Emit the call to the coroutine frame allocation function. + auto *AllocateCall = cast(EmitScalarExpr(S.getAllocate

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-02-12 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 88151. GorNishanov added a comment. Initialized member variable to zero. https://reviews.llvm.org/D28835 Files: include/clang/AST/StmtCXX.h include/clang/Sema/ScopeInfo.h lib/AST/StmtCXX.cpp lib/Sema/SemaCoroutine.cpp test/SemaCXX/coroutines.c

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-02-12 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 88152. GorNishanov added a comment. Initialized PromiseRecordDecl to nullptr https://reviews.llvm.org/D28835 Files: include/clang/AST/StmtCXX.h include/clang/Sema/ScopeInfo.h lib/AST/StmtCXX.cpp lib/Sema/SemaCoroutine.cpp test/SemaCXX/coroutin

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-02-12 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov marked an inline comment as done. GorNishanov added a comment. Preparing to land. Thank you very much for review! Comment at: lib/Sema/SemaCoroutine.cpp:719 + + if (!PromiseRecordDecl) +return true; EricWF wrote: > I figured out what's going on

[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

2017-02-12 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. GorNishanov marked an inline comment as done. Closed by commit rL294933: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction. (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D28835

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-06 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov commandeered this revision. GorNishanov edited reviewers, added: EricWF; removed: GorNishanov. GorNishanov added a comment. Comandeering this patch. Last week Richard gave me some feedback in person on this code (in the full coroutine implementation not this patch in particular). I am

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-07 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 90861. GorNishanov added a comment. Per's @rsmith feedback in Kona - Added diagnostic if from_address is missing from coroutine_handle - Switch to using BuildDeclarationNameExpr in buildCoroutineHandle https://reviews.llvm.org/D26316 Files: include/c

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-07 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 90862. GorNishanov added a comment. - removed '&' that snicked near Location parameter - reordered a few lines to minimize the diff from Eric's version https://reviews.llvm.org/D26316 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaCo

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-07 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. @EricWF, LGTM? https://reviews.llvm.org/D26316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30711: [coroutines] update coro_end builtin to match llvm

2017-03-07 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added subscribers: EricWF, mehdi_amini. llvm.coro.end intrinsic now returns bool. Updating clang to match it. https://reviews.llvm.org/D30711 Files: include/clang/Basic/Builtins.def test/CodeGenCoroutines/coro-builtins.c Index: test/CodeGenCorouti

[PATCH] D30711: [coroutines] update coro_end builtin to match llvm

2017-03-07 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297224: [coroutines] update coro_end builtin to match llvm (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D30711?vs=90897&id=90928#toc Repository: rL LLVM https://revie

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 91117. GorNishanov added a comment. - Addressed nits - Improved error messages even further - Merge on top of the trunk Preparing to land https://reviews.llvm.org/D26316 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaCoroutine.cpp

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 91119. GorNishanov added a comment. preparing to land https://reviews.llvm.org/D26316 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaCoroutine.cpp lib/Sema/SemaExprMember.cpp test/CodeGenCoroutines/coro-alloc.cpp test/CodeGenCo

[PATCH] D30769: [coroutines] Build and pass coroutine_handle to await_suspend

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added subscribers: EricWF, mehdi_amini. This patch adds passing a coroutine_handle object to await_suspend calls. It builds the coroutine_handle using coroutine_handle::from_address(__builtin_coro_frame()). (a revision of https://reviews.llvm.org/D26316

[PATCH] D30769: [coroutines] Build and pass coroutine_handle to await_suspend

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 91121. GorNishanov added a comment. tweak SemaCXX/coreturn.cpp test to actually pass https://reviews.llvm.org/D30769 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaCoroutine.cpp lib/Sema/SemaExprMember.cpp test/CodeGenCoroutines/

[PATCH] D30769: [coroutines] Build and pass coroutine_handle to await_suspend

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297356: [coroutines] Build and pass coroutine_handle to await_suspend (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D30769?vs=91121&id=91122#toc Repository: rL LLVM ht

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov closed this revision. GorNishanov added a comment. Commited as: https://reviews.llvm.org/rL297356 https://reviews.llvm.org/D26316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[PATCH] D30772: [coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM! https://reviews.llvm.org/D30772 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/lis

[PATCH] D30775: [coroutines] Refactor SuspendExpr to create just one OpaqueValue (almost NFC)

2017-03-08 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: mehdi_amini. Create only one OpaqueValue for await_ready/await_suspend/await_resume. Store OpaqueValue used in the CoroutineSuspendExpr node, so that CodeGen does not have to hunt looking for it. https://reviews.llvm.org/D30775 File

[PATCH] D30776: [coroutines] Fix diagnostics depending on the first coroutine statement.

2017-03-09 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D30776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/list

[PATCH] D30776: [coroutines] Fix diagnostics depending on the first coroutine statement.

2017-03-09 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov requested changes to this revision. GorNishanov added a comment. This revision now requires changes to proceed. One thought I had with respect to removing array of statements: We need to check during Sema that await_ready returns a type contextually convertible to bool and await_susp

[PATCH] D30776: [coroutines] Fix diagnostics depending on the first coroutine statement.

2017-03-09 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. In https://reviews.llvm.org/D30776#697233, @EricWF wrote: > Good to know. I'll update this tomorrow. Well, that is just the thought. Possibly we can check for the types of await_ready and await_suspend in BuildResolvedCoawaitExpr. Then, we don't have to keep the v

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-09 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov created this revision. Herald added a subscriber: mehdi_amini. Emit suspend expression which roughly looks like: auto && x = CommonExpr(); if (!x.await_ready()) { llvm_coro_save(); x.await_suspend(...); (*) llvm_coro_suspend(); (**) } x.await_resume(); wher

[PATCH] D30776: [coroutines] Fix diagnostics depending on the first coroutine statement.

2017-03-10 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. Alright, then. LGTM once more! https://reviews.llvm.org/D30776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llv

[PATCH] D30775: [coroutines] Refactor SuspendExpr to create just one OpaqueValue (almost NFC)

2017-03-10 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297541: [coroutines] Refactor SuspendExpr to create just one OpaqueValue (almost NFC) (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D30775?vs=91134&id=91442#toc Repositor

[PATCH] D30859: [coroutines] Implement unhandled_exception changes.

2017-03-11 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision. GorNishanov added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D30859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/lis

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-11 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. + @majnemer who is most familiar with LLVM Coroutines representation. https://reviews.llvm.org/D30809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-11 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 91486. GorNishanov added a comment. Addressed review feedback - clang-format three functions in CGExprScalar.cpp - got rid of AwaitKindStr array and select appropriate string in the switch statement in buildAwaitKindPrefix https://reviews.llvm.org/D308

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-11 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov marked 4 inline comments as done. GorNishanov added inline comments. Comment at: lib/CodeGen/CGCoroutine.cpp:32 struct CGCoroData { + AwaitKind CurrentAwaitKind = AwaitKind::Init; majnemer wrote: > Shouldn't this struct be in an anonymous namespac

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-12 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 91497. GorNishanov added a comment. Implemented review feedback: const char * => StringRef in buildSuspendSuffixStr https://reviews.llvm.org/D30809 Files: lib/CodeGen/CGCoroutine.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprScalar.cpp lib/Cod

[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-12 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov marked an inline comment as done. GorNishanov added inline comments. Comment at: lib/CodeGen/CGCoroutine.cpp:85 + unsigned No = 0; + const char* AwaitKindStr = 0; + switch (Kind) { majnemer wrote: > I'd use a StringRef here. StringRef it is. htt

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-04-24 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. barely audible ping for coroutines https://reviews.llvm.org/D31646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-04-24 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Tiny ping https://reviews.llvm.org/D31608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-05-01 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Traditional weekly ping https://reviews.llvm.org/D31646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-05-01 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Weakly (sp) ping https://reviews.llvm.org/D31608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-05-15 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. Half-monthly ping https://reviews.llvm.org/D31646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-05-15 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. soft ping https://reviews.llvm.org/D31608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31608: [coroutines] Add emission of initial and final suspends

2017-05-20 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. @EricWF: Can you take a quick look? Just a sanity check. The change is rather trivial. https://reviews.llvm.org/D31608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listin

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. @rsmith barely audible ping https://reviews.llvm.org/D31646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 99796. GorNishanov added a comment. Thank you very much for the review! Merged with top of the trunk, implemented suggested changes, preparing to land https://reviews.llvm.org/D31646 Files: include/clang/AST/StmtCXX.h include/clang/Basic/Diagnostic

[PATCH] D31627: [coroutines] Skip over passthrough operator co_await

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment. In https://reviews.llvm.org/D31627#761320, @rsmith wrote: > Does it still make sense for us to have a `UO_Coawait` at all? As I recall, > the only purpose it ever had was to represent a dependent `co_await` > expression that couldn't yet be resolved to a `CoawaitExp

[PATCH] D31646: [coroutines] Build GRO declaration and return GRO statement

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. GorNishanov marked an inline comment as done. Closed by commit rL303573: [coroutines] Build GRO declaration and return GRO statement (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D31646?vs=9

[PATCH] D31692: [coroutines] Wrap the body of the coroutine in try-catch

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 99814. GorNishanov added a comment. 1. Heap allocate CxxTryStmt in CGCoroutine. 2. Merge with trunk https://reviews.llvm.org/D31692 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGCoroutine.cpp lib/Sema/SemaCoroutine.cpp test/Cod

[PATCH] D31692: [coroutines] Wrap the body of the coroutine in try-catch

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 99815. GorNishanov added a comment. Fix misspelling in a comment. @rsmith, Looks good now? https://reviews.llvm.org/D31692 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGCoroutine.cpp lib/Sema/SemaCoroutine.cpp test/CodeGenCorou

[PATCH] D31692: [coroutines] Wrap the body of the coroutine in try-catch

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL303583: [coroutines] Wrap the body of the coroutine in try-catch (authored by GorNishanov). Changed prior to commit: https://reviews.llvm.org/D31692?vs=99815&id=99827#toc Repository: rL LLVM https:/

[PATCH] D31670: [coroutines] Implement correct GRO lifetime

2017-05-22 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 99837. GorNishanov added a comment. Remember old_top before emitting the cleanup and walk set Active on all emitted cleanups. I tried to add Active flag to Emission, but it ended up being very hairy, so I went with the first option suggested. https://r

<    1   2   3   >