[PATCH] D40176: [CodeGen] Collect information about sizes of accesses and access types for TBAA

2017-11-22 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added inline comments. Comment at: lib/CodeGen/CGClass.cpp:2426 llvm::StoreInst *Store = Builder.CreateStore(VTableAddressPoint, VTableField); - CGM.DecorateInstructionWithTBAA(Store, CGM.getTBAAVTablePtrAccessInfo()); + TBAAAccessInfo TBAAInfo =

[PATCH] D39953: [CodeGen] Generate TBAA type descriptors in a more reliable manner

2017-11-21 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL318752: [CodeGen] Generate TBAA type descriptors in a more reliable manner (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D39953?vs=123563=123754#toc Repository: rL LLVM

[PATCH] D39953: [CodeGen] Generate TBAA type descriptors in a more reliable manner

2017-11-20 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. In https://reviews.llvm.org/D39953#929144, @rjmccall wrote: > I think there might be some cases that intentionally don't cache their normal > result, though, so it might be harder than you think. My understanding is that conceptually every canonical type has a single

[PATCH] D39953: [CodeGen] Generate TBAA type descriptors in a more reliable manner

2017-11-20 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 123563. kosarev retitled this revision from "[CodeGen] Do not lookup for cached TBAA metadata nodes twice" to "[CodeGen] Generate TBAA type descriptors in a more reliable manner". kosarev edited the summary of this revision. kosarev added a comment.

[PATCH] D39955: [Driver] Add a cc1 flag for the new TBAA metadata format

2017-11-20 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL318644: [Driver] Add a cc1 flag for the new TBAA metadata format (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D39955?vs=123320=123555#toc Repository: rL LLVM

[PATCH] D40176: [CodeGen] Collect information about sizes of accesses and access types for TBAA

2017-11-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. The information about access and type sizes is necessary for producing TBAA metadata in the new size-aware format. With this patch, https://reviews.llvm.org/D39955 and https://reviews.llvm.org/D39956 in place we should be able to

[PATCH] D39955: [Driver] Add a cc1 flag for the new TBAA metadata format

2017-11-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 123320. kosarev retitled this revision from "[Driver] Add command-line flags for the new TBAA metadata format" to "[Driver] Add a cc1 flag for the new TBAA metadata format". kosarev added a comment. Removed the clang command-line flag for the new format.

[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Indeed, DenseMap invalidates iterators on insertion. But then even the "technically correct" part of these changes make things more fragile while my original concern was reliability and not performance. I particularly don't like the repeating cache assignments. What

[PATCH] D39455: [CodeGen] Add initial support for union members in TBAA

2017-11-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Thanks John. Hal, do you see any problems with this patch? Repository: rL LLVM https://reviews.llvm.org/D39455 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D39955: [Driver] Add command-line flags for the new TBAA metadata format

2017-11-15 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Adding a (temporary) flag for the new format would help with updating tests that depend on the shape of TBAA metadata. There are lots of them and I guess some change frequently so we may want to address this in a few patches. That would also reduce the pressure on

[PATCH] D39955: [Driver] Add command-line flags for the new TBAA metadata format

2017-11-13 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. This patch starts a series of changes to add support for the new TBAA metadata format proposed in this llvm-dev thread: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118748.html Repository: rL LLVM

[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-13 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. Repository: rL LLVM https://reviews.llvm.org/D39953 Files: lib/CodeGen/CodeGenTBAA.cpp Index: lib/CodeGen/CodeGenTBAA.cpp === --- lib/CodeGen/CodeGenTBAA.cpp +++

[PATCH] D39455: [CodeGen] Add initial support for union members in TBAA

2017-10-31 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. The basic idea behind this patch is that since in strict aliasing mode all accesses to union members require their outermost enclosing union objects to be specified explicitly, then for a couple given accesses to union members of

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-31 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL316988: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D39008?vs=120828=120958#toc Repository: rL LLVM

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-30 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 120828. kosarev added a comment. - Fixed comparing and hashing of TBAA access descriptors. - Rebased on top of https://reviews.llvm.org/D39177. Thanks John! https://reviews.llvm.org/D39008 Files: lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjCRuntime.cpp

[PATCH] D39177: [CodeGen] Generate TBAA info for reference loads

2017-10-30 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL316896: [CodeGen] Generate TBAA info for reference loads (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D39177?vs=120654=120800#toc Repository: rL LLVM

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-27 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 120675. kosarev added a comment. Reworked to distinct may-alias accesses from ordinary ones with an explicit 'kind' field. https://reviews.llvm.org/D39008 Files: lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjCRuntime.cpp lib/CodeGen/CGOpenMPRuntime.cpp

[PATCH] D39177: [CodeGen] Generate TBAA info for reference loads

2017-10-27 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 120654. kosarev added a comment. - Fixed the type of the reference lvalue in loadToBegin(). John, can you please review the fix? Thanks. https://reviews.llvm.org/D39177 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGExpr.cpp

[PATCH] D39177: [CodeGen] Generate TBAA info for reference loads

2017-10-27 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:1041 +else + BaseLV = CGF.EmitLoadOfReferenceLValue(BaseLV); BaseTy = BaseTy->getPointeeType(); Oh-oh, it looks I do something not functionally equivalent here. Sorry, will

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-26 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Yes, I don't like it too when it comes to comparing pointers to metadata nodes in an attempt to figure out what kind of access we are dealing with. What concerns me is that there may be other kinds of TBAA descriptors that are neither ordinary nor may-alias ones. For

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-26 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. I suspect this is supposed to be in this diff: In https://reviews.llvm.org/D38796#906887, @rjmccall wrote: > I think probably the best solution is to track may-alias-ness explicitly in > the TBAAAccessInfo instead of relying in the frontend on being able to >

[PATCH] D39138: [CodeGen] Generate TBAA info for 'this' pointers

2017-10-26 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev abandoned this revision. kosarev added a comment. OK, thanks. Repository: rL LLVM https://reviews.llvm.org/D39138 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-25 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Now that https://reviews.llvm.org/D38796 is comitted and added the tbaa-cast.cpp test case to the mainline, we fail on it with this patch applied. The reason is that we have no special TBAA type node for may-alias accesses, so everything that ever been a potential

[PATCH] D39138: [CodeGen] Generate TBAA info for 'this' pointers

2017-10-25 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Hmm, according to our research such loads constitute about 18% of all loads under ##-O -Xclang -disable-llvm-passes## on the LLVM code base. I wonder, do you think it would be nice to not generate them at all? I mean, provided that necessary changes do not add too much

[PATCH] D38126: Make TBAA information to be part of LValueBaseInfo

2017-10-25 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev abandoned this revision. kosarev added a comment. Indeed, if LValueBaseInfo is what we know about the very first value in a sequence, then TBAA info certainly should not be part of it. This also means whatever is specified as a direct base lvalue to the lvalue we are constructing

[PATCH] D39138: [CodeGen] Generate TBAA info for 'this' pointers

2017-10-24 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Correct, they are eliminated. However, this change makes things a bit easier as we are pursuing undecorated instructions produced by clang. Once they have their TBAA tags, we don't need to guess if it's something trivial for the optimizer. It shouldn't be a problem to

[PATCH] D39177: [CodeGen] Generate TBAA info for reference loads

2017-10-23 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added inline comments. Comment at: test/CodeGen/tbaa-reference.cpp:1 // RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s // Changes for this test look somewhat complicated, so here's a short summary: * We

[PATCH] D39177: [CodeGen] Generate TBAA info for reference loads

2017-10-23 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. Repository: rL LLVM https://reviews.llvm.org/D39177 Files: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.h

[PATCH] D39138: [CodeGen] Generate TBAA info for 'this' pointers

2017-10-20 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. Repository: rL LLVM https://reviews.llvm.org/D39138 Files: lib/CodeGen/CGCXXABI.cpp test/CodeGen/tbaa-this.cpp Index: test/CodeGen/tbaa-this.cpp === ---

[PATCH] D39083: [CodeGen] Fix generation of TBAA info for array-to-pointer conversions

2017-10-20 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Thanks Hal. Repository: rL LLVM https://reviews.llvm.org/D39083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D39083: [CodeGen] Fix generation of TBAA info for array-to-pointer conversions

2017-10-20 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL316211: [CodeGen] Fix generation of TBAA info for array-to-pointer conversions (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D39083?vs=119552=119646#toc Repository: rL

[PATCH] D39083: [CodeGen] Fix generation of TBAA info for array-to-pointer conversions

2017-10-19 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. Resolves: Fatal error: Offset not zero at the point of scalar access. http://llvm.org/PR34992 Repository: rL LLVM https://reviews.llvm.org/D39083 Files: lib/CodeGen/CGExpr.cpp test/CodeGen/tbaa-array.cpp Index:

[PATCH] D38126: Make TBAA information to be part of LValueBaseInfo

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 119373. kosarev edited the summary of this revision. kosarev added a comment. Rebased on top of https://reviews.llvm.org/D39008 and ready for review. https://reviews.llvm.org/D38126 Files: CodeGen/CGAtomic.cpp CodeGen/CGClass.cpp CodeGen/CGExpr.cpp

[PATCH] D39008: [CodeGen] Propagate may-alias'ness of lvalues with TBAA info

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. This patch fixes various places in clang to propagate may-alias TBAA access descriptors during construction of lvalues, thus eliminating the need for the LValueBaseInfo::MayAlias flag. This is part of

[PATCH] D38947: [CodeGen] Refine generation of TBAA info for bit-field lvalues

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315989: [CodeGen] Refine generation of TBAA info for bit-field lvalues (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38947?vs=119257=119288#toc Repository: rL LLVM

[PATCH] D38945: [CodeGen] Pass TBAA info along with lvalue base info everywhere

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315986: [CodeGen] Pass TBAA info along with lvalue base info everywhere (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38945?vs=119129=119278#toc Repository: rL LLVM

[PATCH] D38796: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315984: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue… (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38796?vs=119089=119272#toc Repository:

[PATCH] D38947: [CodeGen] Refine generation of TBAA info for bit-field lvalues

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Yes, some preparation code moved past the isBitField() block and generation of TBAA info moved before creating the bit-field lvalue. Thanks for catching the BaseExpr renaming. https://reviews.llvm.org/D38947 ___

[PATCH] D38947: [CodeGen] Refine generation of TBAA info for bit-field lvalues

2017-10-17 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 119257. kosarev added a comment. - Removed renamings that complicate reviewing. https://reviews.llvm.org/D38947 Files: lib/CodeGen/CGExpr.cpp Index: lib/CodeGen/CGExpr.cpp === ---

[PATCH] D38947: [CodeGen] Refine generation of TBAA info for bit-field lvalues

2017-10-16 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. The main change is that now we generate TBAA info before constructing the resulting lvalue instead of constructing lvalue with some default TBAA info and fixing it as necessary afterwards. We also keep the TBAA info close to lvalue

[PATCH] D38945: [CodeGen] Pass TBAA info along with lvalue base info everywhere

2017-10-16 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. This patch addresses the rest of the cases where we pass lvalue base info, but do not provide corresponding TBAA info. This patch should not bring in any functional changes. This is part of https://reviews.llvm.org/D38126 reworked

[PATCH] D38796: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

2017-10-15 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 119089. kosarev edited the summary of this revision. kosarev added a comment. - Fixed handling of explicit casts. - Added a test case. https://reviews.llvm.org/D38796 Files: lib/CodeGen/CGExpr.cpp lib/CodeGen/CodeGenFunction.cpp

[PATCH] D38796: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

2017-10-15 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. With this patch applied we fail on bootstrapping stages of release builds (meaning enabled TBAA). The reason is that for some casts we do not generate TBAA info that corresponds to the target type and leave them with TBAA info for the cast's operand expression. This

[PATCH] D38796: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315731: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue… (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38796?vs=118599=118950#toc Repository:

[PATCH] D38795: [CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315715: [CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue… (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38795?vs=118585=118940#toc Repository:

[PATCH] D38794: [CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added a comment. Right. Switching back to returning just AlignmentSource would make its name more adequate, but I suspect we intentionally want full-size lvalue base info here. Repository: rL LLVM https://reviews.llvm.org/D38794 ___

[PATCH] D38794: [CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315708: [CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue… (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38794?vs=118581=118934#toc Repository:

[PATCH] D38793: [CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315705: [CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base… (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38793?vs=118578=118933#toc Repository:

[PATCH] D38791: [CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315704: [CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38791?vs=118575=118932#toc Repository:

[PATCH] D38788: [CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue base info

2017-10-13 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315702: [CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with… (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38788?vs=118560=118931#toc Repository:

[PATCH] D38733: [CodeGen] Generate TBAA info along with LValue base info

2017-10-12 Thread Ivan Kosarev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315575: [CodeGen] Generate TBAA info along with LValue base info (authored by kosarev). Changed prior to commit: https://reviews.llvm.org/D38733?vs=118551=118771#toc Repository: rL LLVM

[PATCH] D38796: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

2017-10-11 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. Prepared on top of https://reviews.llvm.org/D38795. Repository: rL LLVM https://reviews.llvm.org/D38796 Files: CodeGen/CGExpr.cpp CodeGen/CodeGenFunction.cpp CodeGen/CodeGenFunction.h CodeGen/CodeGenModule.cpp

[PATCH] D38795: [CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info

2017-10-11 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev created this revision. kosarev added a project: clang. Prepared on top of https://reviews.llvm.org/D38733. Repository: rL LLVM https://reviews.llvm.org/D38795 Files: CodeGen/CGExpr.cpp Index: CodeGen/CGExpr.cpp ===

<    1   2