[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1643 +if (Ctx.getBlockVarCopyInits(VD)) + return true; + return false; rjmccall wrote: > Can you just ask Sema to check `canThrow` for the expression and pass it down? Since this chang

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159388. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.h lib/CodeGen/CGDecl.cpp lib/CodeGen/

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1643 +if (Ctx.getBlockVarCopyInits(VD)) + return true; + return false; ahatanak wrote: > rjmccall wrote: > > Can you just ask Sema to check `canThrow` for the expression and pass it >

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159546. ahatanak marked an inline comment as done. ahatanak added a reviewer: rsmith. ahatanak added a comment. Herald added a subscriber: jfb. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: include/clang/AST/Comp

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1643 +if (Ctx.getBlockVarCopyInits(VD)) + return true; + return false; rjmccall wrote: > ahatanak wrote: > > ahatanak wrote: > > > rjmccall wrote: > > > > Can you just ask Sema to chec

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159553. ahatanak added a comment. Remove a stale comment and add an assertion to check the destructor's exception specification has been resolved. Repository: rC Clang https://reviews.llvm.org/D50152 Files: include/clang/AST/ComputeExceptionSpec.h

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. I thought it was okay to skip the work done by `ResolveExceptionSpec` in IRGen as long as the exception specifications that are needed have already been resolved in Sema. But calling Sema::canThrow in Sema::CheckCompleteVariableDeclaration and storing the result in Bl

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Since BlockVarCopyInits is a map with key `VarDecl *`, I think we want to add a flag to VarDecl (NonParmVarDeclBits) that indicates whether the copy expression can throw or not. Or is there a reason to store the bit in `BlockDecl::Capture` instead? Repository: rC C

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-08 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159762. ahatanak added a comment. Change the value type of BlockVarCopyInits to PointerIntPair. The boolean flag indicates whether the copy expression can throw. Serialize/deserialize the copy expression and the boolean flag and add a regression test to te

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-08 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159800. ahatanak marked 2 inline comments as done. ahatanak added a comment. Modify getBlockVarCopyInits and setBlockVarCopyInits to get and set both the copy expression and the boolean flag that indicates whether the expression can throw or not. Reposito

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-08 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/AST/ASTContext.h:158 +Expr *CopyExpr; +bool CanThrow; + }; rjmccall wrote: > Using a PointerIntPair in the implementation of this is still a reasonable > choice. Just make it a proper abstractio

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-08 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159850. ahatanak marked 5 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/CodeGen/CGBlocks.cpp lib/

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159926. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/CodeGen/CGBlocks.cpp lib/

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1682 + if (IsCopyHelper && Ctx.getBlockVarCopyInits(Var).CanThrow) +Name += "c"; +} rjmccall wrote: > ahatanak wrote: > > rjmccall wrote: > > > I don't think you nee

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 160040. ahatanak marked an inline comment as done. ahatanak added a comment. Define functions inline in the header file. Repository: rC Clang https://reviews.llvm.org/D50152 Files: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/CodeGen/

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1725 BlockFieldFlags Flags, bool EHOnly, + bool DisposeCannotThrow, VarDecl *Var, CodeGenFunction &CGF) { ---

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 160046. ahatanak marked 2 inline comments as done. ahatanak added a comment. Call MarkFunctionReferenced to mark the function `__builtin_operator_new` or `__builtin_operator_delete` will call as referenced. Repository: rC Clang https://reviews.llvm.org/

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 160053. ahatanak marked an inline comment as done. ahatanak added a comment. Replace the two flags, EHOnly and DisposeCannotThrow, passed to pushCaptureCleanup with a single flag ForCopyHelper. Repository: rC Clang https://reviews.llvm.org/D50152 Files

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-10 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC339438: [CodeGen] Merge equivalent block copy/helper functions. (authored by ahatanak, committed by ). Changed prior to commit: https://reviews.llvm.org/D50152?vs=160053&id=160110#toc Repository: rC

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, arphaman. Herald added a subscriber: dexonsmith. Currently, clang generates a new block descriptor global variable for each block literal. This patch merges block descriptors that are identical inside and across translation unit

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. A few points I forgot to mention: - This optimization kicks in only in NonGC mode. I don't think we need to care much about GC anymore, so I think that's OK. - There is a lot of redundancy among the copy/dispose helper function strings and the block layout string in t

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 161137. ahatanak added a comment. Try harder to shorten the names of block descriptor global variables. The strings extracted from the names of the copy and dispose helpers are merged whenever it is possible to do so. The block layout string doesn't include

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:271-276 llvm::GlobalVariable *global = -elements.finishAndCreateGlobal("__block_descriptor_tmp", - CGM.getPointerAlign(), - /*constant*/

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 161155. ahatanak marked an inline comment as done. ahatanak added a comment. Mark the block descriptor global variable as `unnamed_addr`. Repository: rC Clang https://reviews.llvm.org/D50783 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.h l

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-17 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL340041: [CodeGen] Merge identical block descriptor global variables. (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-17 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC340041: [CodeGen] Merge identical block descriptor global variables. (authored by ahatanak, committed by ). Repository: rC Clang https://reviews.llvm.org/D50783 Files: lib/CodeGen/CGBlocks.cpp lib

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-08-17 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. @tra and @rsmith: Can we move forward and fix the incorrect cuda diagnostics in a separate patch? Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-08-17 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In https://reviews.llvm.org/D47757#1204561, @tra wrote: > It's a regression. There's a decent chance it breaks someone and this patch, > if committed by itself, will end up being rolled back. Is the regression you are referring to about the static function case? I don

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-08-17 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. The code you showed does compile with or without `-fcuda-is-device` after applying my patch. Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm

[PATCH] D51025: [CodeGen] Fix handling of variables captured by a block that is nested inside a lambda

2018-08-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. Herald added a subscriber: dexonsmith. Currently IRGen doesn't handle variables captured by a block correctly when the variable is captured by reference by a lambda that encloses the block. For example, in the following code, t

[PATCH] D51043: [clang][NFC] Fix typo in the name of a note

2018-08-21 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak accepted this revision. ahatanak added a comment. This revision is now accepted and ready to land. Thanks. Yes, it's a typo. Repository: rCXX libc++ https://reviews.llvm.org/D51043 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D51025: [CodeGen] Fix handling of variables captured by a block that is nested inside a lambda

2018-08-22 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL340408: [CodeGen] Look at the type of a block capture field rather than the type (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-05-17 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Richard and Doug, do you have any thoughts on John's suggestion? Comment at: test/CodeGenObjCXX/arc-list-init-destruct.mm:1 +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -std=c++1z -fobjc-arc -fobjc-exceptions -fcxx-exceptions -fexceptions -e

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-05-22 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In https://reviews.llvm.org/D45898#1104025, @rsmith wrote: > As it happens, the C++ committee fixed the language wording hole here very > recently. The new rule can be found here: http://wg21.link/p0968r0#2227 > In summary: we should to consider the destructor for all

[PATCH] D45015: [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.

2018-05-22 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In https://reviews.llvm.org/D45015#1105314, @rsmith wrote: > Hmm, perhaps our strategy for handling aligned allocation on Darwin should be > revisited. We shouldn't be defining `__cpp_aligned_allocation` if we believe > it doesn't work -- that will break code that uses

[PATCH] D38708: [AST] Flag the typo-corrected nodes for better tooling

2018-05-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Herald added a subscriber: llvm-commits. Could you rebase this patch against ToT? Also, it's not clear to me why only four Exprs (DeclRefExpr, MemberExpr, ObjCIvarRefExpr, and ObjCPropertyRefExpr) should have the IsTypoCorrected flag. Can you elaborate on how you chose

[PATCH] D36918: [Sema] Take into account the current context when checking the accessibility of a member function pointer

2018-05-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 148334. ahatanak added a comment. Add a test case for the Chromium failure. Also, simplify a bit by capturing the calling context in Sema::DeduceTemplateArguments. Repository: rC Clang https://reviews.llvm.org/D36918 Files: lib/Sema/SemaTemplateDeduc

[PATCH] D47290: [Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin

2018-05-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/SemaObjC/format-size-spec-nsinteger.m:18 + NSUInteger j = 0; + NSLog(@"max NSInteger = %zi", i); // CHECK: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead + NSLog(@"max

[PATCH] D47354: [CodeGen][Darwin] Set the calling-convention of a thread-local variable initialization function to fix calling-convention mismatch

2018-05-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, t.p.northover. There is a bug in IRGen where the calling convention of initialization functions for thread-local static members of c++ template classes isn't set. This caused InstCombine to remove a call to an initialization fun

[PATCH] D47354: [CodeGen][Darwin] Set the calling-convention of a thread-local variable initialization function to fix calling-convention mismatch

2018-05-29 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL333447: [CodeGen][Darwin] Set the calling-convention of thread-local variable (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llv

[PATCH] D36915: [Sema] Diagnose local variables and parameters captured by lambda and block expressions in a default argument

2017-09-29 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping. Any comments on this patch or alternate approaches? https://reviews.llvm.org/D36915 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36918: [Sema] Take into account the current context when checking the accessibility of a member function pointer

2017-09-29 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping https://reviews.llvm.org/D36918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D38606: [CodeGen] Emit a helper function for __builtin_os_log_format to reduce code size

2017-10-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. We found that the IR IRGen emits when expanding __builtin_os_log_format is quite big and has a lot of redundancy. For example, when clang compiles the following code: void foo1(void *buf) { __builtin_os_log_format(buf, "%d %d", 11, 22); } The IR looks li

[PATCH] D38606: [CodeGen] Emit a helper function for __builtin_os_log_format to reduce code size

2017-10-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 117955. ahatanak added a comment. Always mark the helper function as linkonce_odr and hidden. https://reviews.llvm.org/D38606 Files: lib/CodeGen/CGBuiltin.cpp lib/CodeGen/CodeGenFunction.h test/CodeGen/builtins.c test/CodeGenObjC/os_log.m Index: t

[PATCH] D38606: [CodeGen] Emit a helper function for __builtin_os_log_format to reduce code size

2017-10-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. I think you are right. The linkage should be linkonce_odr even when not compiling with -Oz. I've fixed it in the latest patch. https://reviews.llvm.org/D38606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://

[PATCH] D38606: [CodeGen] Emit a helper function for __builtin_os_log_format to reduce code size

2017-10-06 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315045: [CodeGen] Emit a helper function for __builtin_os_log_format to reduce (authored by ahatanak). Changed prior to commit: https://reviews.llvm.org/D38606?vs=117955&id=117957#toc Repository: rL

[PATCH] D36918: [Sema] Take into account the current context when checking the accessibility of a member function pointer

2017-10-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping https://reviews.llvm.org/D36918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36918: [Sema] Take into account the current context when checking the accessibility of a member function pointer

2017-10-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 118119. ahatanak added a comment. Address review comments. https://reviews.llvm.org/D36918 Files: lib/Sema/SemaAccess.cpp test/SemaCXX/access.cpp Index: test/SemaCXX/access.cpp === --- t

[PATCH] D36918: [Sema] Take into account the current context when checking the accessibility of a member function pointer

2017-10-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/Sema/SemaAccess.cpp:1798 + EffectiveContext EC(CurScope->getEntity()); + if (IsAccessible(*this, EC, Entity) == ::AR_accessible) +return AR_accessible; Rakete wrote: > You don't need that scope resolution

[PATCH] D38659: [Sema][ObjC] Preserve syntactic sugar when removing ARCReclaimReturnedObject cast

2017-10-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. This is a follow-up patch to r314370. Rather than throwing away the enclosing parentheses in maybeUndoReclaimObject, this patch walks down the expression until an ARCReclaimReturnedObject cast is found and removes just the cast, preserving the syntactic sugar exp

[PATCH] D38659: [Sema][ObjC] Preserve syntactic sugar when removing ARCReclaimReturnedObject cast

2017-10-09 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315261: [Sema][ObjC] Preserve syntactic sugar when removing (authored by ahatanak). Changed prior to commit: https://reviews.llvm.org/D38659?vs=118121&id=118302#toc Repository: rL LLVM https://revie

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-08-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In https://reviews.llvm.org/D47757#1211276, @tra wrote: > I've confirmed that the patch does not break anything in our CUDA code, so > it's good to go as far as CUDA is concerned. Thanks. @rsmith, do you have any other comments about the patch? Repository: rC Clan

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-08-30 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang https://reviews.llvm.org/D45898 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-31 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. The GNUstep documentation I found replaces '@' with '\1'. Would that fix the problem? https://github.com/gnustep/libobjc2/blob/master/ABIDoc/abi.tex Repository: rC Clang https://reviews.llvm.org/D50783 ___ cfe-commits

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-08-31 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 163612. ahatanak marked 3 inline comments as done. ahatanak added a comment. Move the call that checks the element's destructor into InitListChecker::CheckStructUnionTypes. Repository: rC Clang https://reviews.llvm.org/D45898 Files: lib/Sema/SemaInit

[PATCH] D51564: Distinguish `__block` variables that are captured by escaping blocks from those that aren't

2018-08-31 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. Herald added a subscriber: dexonsmith. This patch changes the way `__block` variables that aren't captured by escaping blocks are handled: - Since non-escaping blocks on the stack never get copied to the heap (see https://revi

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-09-04 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/Sema/SemaInit.cpp:1827-1829 + if (SemaRef.DiagnoseUseOfDecl(Destructor, Loc)) +return false; + return true; rsmith wrote: > Usual Clang convention is to return `true` on error. I also renamed the function to h

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-09-04 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 163871. ahatanak marked 2 inline comments as done. ahatanak added a comment. Point the diagnostic at either the relevant init list element or at the close brace. Repository: rC Clang https://reviews.llvm.org/D45898 Files: lib/Sema/SemaInit.cpp test

[PATCH] D51564: Distinguish `__block` variables that are captured by escaping blocks from those that aren't

2018-09-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/AST/Decl.h:977 + +unsigned EscapingByref : 1; }; rjmccall wrote: > This doesn't actually seem to be initialized anywhere. VarDecl's constructor in Decl.cpp initializes it to false. ``` AllBits =

[PATCH] D51564: Distinguish `__block` variables that are captured by escaping blocks from those that aren't

2018-09-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 164069. ahatanak marked 11 inline comments as done. ahatanak added a comment. Address review comments. Fix bugs in the handling of `__block` variables that have reference types. Repository: rC Clang https://reviews.llvm.org/D51564 Files: include/clan

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-09-06 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC341629: [Sema] Check that the destructor for each element of class type is (authored by ahatanak, committed by ). Repository: rC Clang https://reviews.llvm.org/D45898 Files: lib/Sema/SemaInit.cpp

[PATCH] D51564: Distinguish `__block` variables that are captured by escaping blocks from those that aren't

2018-09-08 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL341754: Distinguish `__block` variables that are captured by escaping blocks (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm

[PATCH] D49303: [CodeGen][ObjC] Treat non-escaping blocks as global blocks to make copy/dispose a no-op

2018-07-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 156332. ahatanak added a comment. Fix a bug where the capture cleanups weren't pushed when BlockDecl::doesNotEscape() returns true. Test that, when ARC is enabled, captures are retained and copied into the stack block object and destroyed when the stack bl

[PATCH] D49303: [CodeGen][ObjC] Treat non-escaping blocks as global blocks to make copy/dispose a no-op

2018-07-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 156404. ahatanak marked 2 inline comments as done. ahatanak added a comment. Add a comment that explains the meaning of BLOCK_IS_NOESCAPE to the docs. Rename function needsCopyDispose to needsCopyDisposeHelpers. Repository: rC Clang https://reviews.llvm

[PATCH] D49303: [CodeGen][ObjC] Treat non-escaping blocks as global blocks to make copy/dispose a no-op

2018-07-20 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. ahatanak marked an inline comment as done. Closed by commit rL337580: [CodeGen][ObjC] Make copying and disposing of a non-escaping block (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Change

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. Herald added a subscriber: dexonsmith. Block copy/dispose helper functions currently aren’t exception-safe. When an exception is thrown in a copy function, the function exits without destroying or releasing C++ objects, ObjC ob

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Note that in order to destruct C++ objects, I'm using pushDestroy which pushes a NormalCleanup when exception handling isn't enabled. This is different from PushDestructorCleanup which always pushes a NormalAndEHCleanup, but I think using pushDestroy is more correct si

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157095. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. I think I should be able to merge pushBlockObjectRelease and enterByrefCleanup, but the BlockFieldFlags that are passed are different. We set BLOCK_FIELD_

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1905 +case BlockCaptureEntityKind::None: + llvm_unreachable("unexpected BlockCaptureEntityKind"); } rjmccall wrote: > These two switches differ only in (1) what kind of cleanup the

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157149. ahatanak added a comment. Merge pushBlockObjectRelease and enterByrefCleanup. In https://reviews.llvm.org/D49718#1174113, @rjmccall wrote: > Heh, okay. It looks like the runtime doesn't do anything different, but I > think it's probably more corre

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-07-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157373. ahatanak added a comment. Check if destructors are accessible from InitListChecker's constructor. Add test cases for designated initializer and brace elision. Repository: rC Clang https://reviews.llvm.org/D45898 Files: lib/Sema/SemaInit.cpp

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157380. ahatanak added a comment. Set the BLOCK_FIELD_IS_WEAK bit of the flag passed to the call to enterByrefCleanup in EmitAutoVarCleanups and fix test case test/CodeGenObjC/blocks.m. Repository: rC Clang https://reviews.llvm.org/D49718 Files: lib

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-07-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157395. ahatanak marked an inline comment as done. ahatanak added a comment. Document the meaning of enterByrefCleanup's parameters. Repository: rC Clang https://reviews.llvm.org/D49718 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGDecl.cpp lib/Co

[PATCH] D49119: [Sema][ObjC] Issue a warning when a method declared in a protocol is non-escaping but the corresponding method in the implementation is escaping.

2018-07-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157398. ahatanak added a comment. Add a test case for an interface conforming to a non-escaping protocol. In https://reviews.llvm.org/D49119#1164285, @vsapsai wrote: > Also I had a few ideas for tests when the warning isn't required and it is > absent. But

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:2582 /// yet; if a cleanup is required for the variable itself, that needs /// to be done externally. +void CodeGenFunction::enterByrefCleanup(CleanupKind Kind, Address Addr, rjmccall wrote: >

[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

2018-07-26 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC338041: [CodeGen][ObjC] Make block copy/dispose helper functions exception-safe. (authored by ahatanak, committed by ). Changed prior to commit: https://reviews.llvm.org/D49718?vs=157395&id=157514#toc

[PATCH] D49119: [Sema][ObjC] Issue a warning when a method declared in a protocol is non-escaping but the corresponding method in the implementation is escaping.

2018-07-27 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Thanks, I'll update the patch and commit it today. In https://reviews.llvm.org/D49119#1176139, @vsapsai wrote: > In https://reviews.llvm.org/D49119#1176047, @ahatanak wrote: > > > In https://reviews.llvm.org/D49119#1164285, @vsapsai wrote: > > > > > Also I had a few ide

[PATCH] D49119: [Sema][ObjC] Issue a warning when a method declared in a protocol is non-escaping but the corresponding method in the implementation is escaping.

2018-07-27 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 157815. ahatanak added a comment. - Produce a note that tells users where the class extension conforming to the protocol containing the non-escaping method is declared. - Add a class method that has the same name as the instance method and check that no spu

[PATCH] D49119: [Sema][ObjC] Issue a warning when a method declared in a protocol is non-escaping but the corresponding method in the implementation is escaping.

2018-07-27 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC338189: [Sema][ObjC] Warn when a method declared in a protocol takes a (authored by ahatanak, committed by ). Repository: rC Clang https://reviews.llvm.org/D49119 Files: include/clang/Basic/Diagnost

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-01 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, arphaman. Herald added subscribers: dexonsmith, mgrang. Currently, clang generates different copy or dispose helper functions for each block literal on the stack if the block has the possibility of being copied to the heap. This

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-01 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/CodeGenCXX/block-byref-cxx-objc.cpp:36 +// CHECK: call void @_Block_object_dispose( + +int testB() { Should the second call to @_Block_object_dispose be an invoke if the destructor can throw? The FIXME in CodeGenF

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-01 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/CodeGenCXX/block-byref-cxx-objc.cpp:36 +// CHECK: call void @_Block_object_dispose( + +int testB() { ahatanak wrote: > Should the second call to @_Block_object_dispose be an invoke if the > destructor can throw? T

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-01 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 158640. ahatanak marked an inline comment as done. ahatanak added a comment. Use llvm::sort. Repository: rC Clang https://reviews.llvm.org/D50152 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGNonTrivialStruct.cpp lib/CodeGen/CodeGenFunction.cpp

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 158774. ahatanak marked 3 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.h lib/CodeGen/CGNonTrivialStruct.cpp

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1638 +switch (E.Kind) { +case BlockCaptureEntityKind::CXXRecord: { + Name += "c"; rjmccall wrote: > I forget whether this case has already filtered out trivial > copy-constructors,

[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. I just wanted to make sure that this doesn't have the same problem as https://reviews.llvm.org/D34556. Is that correct? The patch was reverted in r306859. https://reviews.llvm.org/D34574#791158 explains why the approach taken in the patch was wrong. Repository: rCX

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 158892. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.h lib/CodeGen/CGNonTrivialStruct.cpp

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:492 +if (!RD->isExternallyVisible()) + info.CapturesNonExternalType = true; + rjmccall wrote: > You only need to do this if you're going to mangle the type name, i.e. if > it's

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 159250. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D50152 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.h lib/CodeGen/CGDecl.cpp lib/CodeGen/

[PATCH] D50152: [CodeGen] Merge equivalent block copy/helper functions

2018-08-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:1691 + +Name += "_" + llvm::to_string(E.Capture->getOffset().getQuantity()); + } rjmccall wrote: > I feel like this reads a little better if you write the quantity first. Also > I think y

[PATCH] D41039: Add support for attribute "trivial_abi"

2018-02-05 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. ahatanak marked 2 inline comments as done. Closed by commit rC324269: Add support for attribute 'trivial_abi'. (authored by ahatanak, committed by ). Changed prior to commit: https://reviews.llvm.org/D41039?vs=129397&id=1

[PATCH] D41039: Add support for attribute "trivial_abi"

2018-02-05 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL324269: Add support for attribute 'trivial_abi'. (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41039?vs=129397&id=132

[PATCH] D42776: [Sema] Fix an assertion failure in constant expression evaluation of calls to functions with default arguments

2018-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/AST/ExprConstant.cpp:1165-1173 + auto LB = Temporaries.lower_bound(Key); + + // If an element with key Key is found, reset the value and return it. This + // can happen if Key is part of a default argument expression. + if (LB !

[PATCH] D42776: [Sema] Fix an assertion failure in constant expression evaluation of calls to functions with default arguments

2018-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 133947. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address Erik's and Roman's review comments. https://reviews.llvm.org/D42776 Files: include/clang/AST/APValue.h lib/AST/APValue.cpp lib/AST/ExprConstant.cpp test/SemaCXX/co

[PATCH] D42776: [Sema] Fix an assertion failure in constant expression evaluation of calls to functions with default arguments

2018-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/AST/ExprConstant.cpp:597 +} +void clearDefaultArgNum() { CurDefaultArgNum = 0; } +unsigned CurDefaultArgNum = 0, NextDefaultArgNum = 0; rsmith wrote: > This is wrong: these scopes can nest, so you can't

[PATCH] D42776: [Sema] Fix an assertion failure in constant expression evaluation of calls to functions with default arguments

2018-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. OK, I see. It's pretty easy to come up with an example. constexpr int foo1(int a = 12) { return a * a; } constexpr int foo2(int a = foo1()) { return a - 12; } https://reviews.llvm.org/D42776 ___ cfe-comm

[PATCH] D41228: [ObjC] Enable __strong pointers in structs under ARC

2018-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 133994. ahatanak marked 8 inline comments as done. ahatanak added a comment. Address review comments and feedback I got from John offline. The main changes are in CGNonTrivialStruct.cpp. I cleaned up the class hierarchy and used variadic template functions

[PATCH] D10831: Attach attribute "trap-func-name" to IR function

2018-02-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. AMDGPUAnnotateKernelFeatures::addFeatureAttributes looks for an llvm.trap instruction and adds attribute "amdgpu-queue-ptr" to the function if it finds one. Other than that, it looks like your idea would work too. Repository: rL LLVM https://reviews.llvm.org/D1083

  1   2   3   4   5   6   7   8   9   10   >