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

2018-09-04 Thread David Chisnall via Phabricator via cfe-commits
theraven added a comment. In https://reviews.llvm.org/D50783#1221147, @ahatanak wrote: > The GNUstep documentation I found replaces '@' with '\1'. Would that fix the > problem? > > https://github.com/gnustep/libobjc2/blob/master/ABIDoc/abi.tex Yup. If this mangling is needed outside of CGObjC

[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] D50783: [CodeGen] Merge identical block descriptor global variables

2018-08-31 Thread David Chisnall via Phabricator via cfe-commits
theraven added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:163 + std::string TypeAtEncoding = + CGM.getContext().getObjCEncodingForBlock(BlockInfo.getBlockExpr()); + Name += "e" + llvm::to_string(TypeAtEncoding.size()) + "_" + TypeAtEncoding; Spe

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

2018-08-31 Thread David Chisnall via Phabricator via cfe-commits
theraven added a comment. This revision broke blocks on all ELF targets. The block descriptors' symbol names can now include the @ character, which is reserved on ELF platforms as a separator between symbol name and symbol version. As a result, nothing containing a block that has an Objective

[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] 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-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-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 Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:271-276 llvm::GlobalVariable *global = -elements.finishAndCreateGlobal("__block_descriptor_tmp", - CGM.getPointerAlign(), - /*constant*/ t

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

2018-08-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. Okay. Repository: rC Clang https://reviews.llvm.org/D50783 ___ 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-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-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D50783#1200868, @ahatanak wrote: > 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. Yes, that's fine. > - There is a lot of

[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-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