[PATCH] D53329: Generate DIFile with main program if source is not available

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: vsk, HsiangKai, ABataev. yonghong-song added a project: debug-info. Herald added subscribers: cfe-commits, JDevlieghere, aprantl. A llvm segfault happens when I tried to add "-g -gdwarf-5 -gembed-source" in bcc in order to get sor

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Hi, @vsk @HsiangKai @ABataev I found a bug in clang when trying to use "-g -gdwarf-5 -gembed-source" for bcc MCJIT based clang/llvm compilation. This patch fixed the issue but I am not sure whether this is the correct fix or not. Please help take a look and advise

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. We already have `-main-file-name` in cc1. `clang -cc1 -triple x86_64-unknown-linux-gnu ... -main-file-name main.c ... -o main.bc -x c /virtual/main.c -faddrsig` Is this expected? BTW, we just pass the normal C flags to the driver like vector flags_cstr({"-O0", "

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. In the above `/virtual/main.c` is a memory mapped file. The `invocation0.getPreprocessorOpts().addRemappedFile(...)` adds the mapping for the compilation. Repository: rC Clang https://reviews.llvm.org/D53329 ___ cf

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-10-20 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Sure. Let me provide a little bit more context and what I want to achieve: . I have a tool, called bcc (https://github.com/iovisor/bcc) which uses clang CompilerInvocation interface and MCJIT to generates BPF code and load into kernel . Several files (the m

[PATCH] D53329: Generate DIFile with main program if source is not available

2019-01-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @dblaikie @scott.linder Have you got time to look at this issue? Looks like a trivial test case will be able to reproduce the problem. I have the simple example in the previous comments. Practically, `-gdwarf-5 -gembed-source` is broken now. Repository: rC Cla

[PATCH] D53329: Generate DIFile with main program if source is not available

2019-01-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @scott.linder Thanks! It would be good if you could give at least an initial, even rough, analysis. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53329/new/ https://reviews.llvm.org/D53329 ___

[PATCH] D53329: Generate DIFile with main program if source is not available

2019-01-28 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @dblaikie As I mentioned in one of my earlier comments, after some analysis, I think this patch definitely not the right way to fix the problem. We just cannot default to the main file if the DIFile source is not available. I have a bug filed for the same issue (

[PATCH] D53329: Generate DIFile with main program if source is not available

2019-01-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song abandoned this revision. yonghong-song added a comment. Abandon this patch as the proposed fix is not correct. I have put relative information in the bug https://bugs.llvm.org/show_bug.cgi?id=40170. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D5332

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-06 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @dblaikie This is not blocking me yet since the main BTF support is not in llvm yet. I will be in a conference next week. I will dig into this issue the week after, to have a smaller test case and try to root cause a little further. Will update here as soon as I g

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. F7545597: clang-crash.tar @dblaikie I got a standalone reproducible test now. -bash-4.4$ pwd /home/yhs/work/bcc/clang-crash -bash-4.4$ ls clang-test.cpp compile.sh README ttest.c ttest.h -bash-4.4$ README has detai

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. The above segment looks like #0 0x00a1 in ?? () #1 0x01490d63 in clang::SourceManager::~SourceManager() () #2 0x005ad0ee in clang::CompilerInstance::~CompilerInstance() () #3 0x0056ad1b in main () In my example, I did

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. If I am using regular files instead of remapped files, I did not see the segfault. So is it possible that this is a clang issue? Repository: rC Clang https://reviews.llvm.org/D53329 ___ cfe-commits mailing list cfe

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. You compiled with the assertion on, which triggered the issue. I should have thought about this. Sorry. For error, clang-test: /usr/local/google/home/blaikie/dev/llvm/src/lib/ExecutionEngine/MCJIT/MCJIT.cpp:204: virtual void llvm::MCJIT::generateCodeForModule(l

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. F7549230: clang-crash-x86.tar Just attached a new test case (clang-crash-x86.tar) which works even if the compiler is compiled with assertion on. JIT now generates x86-64 code instead of BPF code. The error message looks like:

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Thanks @scott.linder, actually "all or nothing" is what I wanted here. We really want to get the source for these remapped files. Repository: rC Clang https://reviews.llvm.org/D53329 ___ cfe-commits mailing list cf

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-11-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. F7630900: clang-crash-x86-2.tar @scott.linder Actually clang can get source for remapped files. I just uploaded another test tarball which may help you debug the issue. The test script is changed as well since recent llvm/clang r

[PATCH] D61173: [BPF] do not generate predefined macro bpf

2019-04-25 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added a project: clang. Herald added a subscriber: cfe-commits. "DefineStd(Builder, "bpf", Opts)" generates the following three macros: bpf __bpf __bpf__ and the macro "bpf" is due to the fact that the target

[PATCH] D61173: [BPF] do not generate predefined macro bpf

2019-04-25 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added inline comments. Comment at: lib/Basic/Targets/BPF.cpp:23 MacroBuilder &Builder) const { - DefineStd(Builder, "bpf", Opts); + Builder.defineMacro("__bpf"); + Builder.defin

[PATCH] D61173: [BPF] do not generate predefined macro bpf

2019-04-25 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 196799. yonghong-song edited the summary of this revision. yonghong-song added a comment. remove __bpf. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61173/new/ https://reviews.llvm.org/D61173 Files: lib/Basic/Target

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-06-11 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @rsmith @eli.friedman Ping again. Do you have any comments on my proposed clang/IR intrinsics? Thanks! Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-06-19 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added a comment. @eli.friedman Sorry for replying late. I am outside US and currently in PTO. Will back to US soon to address your comments. > can we really expect the user to know which expressions to apply this to? Yes, this is spe

[PATCH] D64598: fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic

2019-07-11 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: eli.friedman, jdoerfert, ast. Herald added subscribers: kristina, arphaman, aprantl. Herald added a project: clang. This is a followup patch for https://reviews.llvm.org/D61809. Handle unnamed bitfield properly and add more test c

[PATCH] D64598: fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic

2019-07-11 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 209379. yonghong-song added a subscriber: anakryiko. yonghong-song added a comment. change test case so we can test metadata is generated correctly. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64598/new/ https://revie

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-11 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. The followup patch for this change is at https://reviews.llvm.org/D64598. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809 ___ cfe-commits mailing

[PATCH] D64598: fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic

2019-07-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song closed this revision. yonghong-song added a comment. The commit has been merged. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64598/new/ https://reviews.llvm.org/D64598 ___ cfe-commits mailing list cfe

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song abandoned this revision. yonghong-song added a comment. abandon this one. A revised version with most tests has been merged. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809 _

[PATCH] D65615: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added subscribers: kristina, arphaman, aprantl. Herald added a project: clang. Previously, debuginfo types are annotated to IR builtin preserve_struct_access_index() and preserve_union_access_index(), but not preserve

[PATCH] D65615: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. The corresponding IR intrinsic interface change is at https://reviews.llvm.org/D65617 The BPF backend to utilize this information is at https://reviews.llvm.org/D65618 Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65615/new/ https

[PATCH] D65615: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:3402 QualType eltType, bool inbounds, - bool signedIndices, SourceLocation loc, +

[PATCH] D65615: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 212926. yonghong-song added a comment. reorder parameter arrayType to make it with default nullptr and simplifies the code. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65615/new/ https://reviews.llvm.org/D65615 File

[PATCH] D65664: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added subscribers: llvm-commits, cfe-commits, arphaman, aprantl. Herald added projects: clang, LLVM. Previously, debuginfo types are annotated to IR builtin preserve_struct_access_index() and preserve_union_access_ind

[PATCH] D65615: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song abandoned this revision. yonghong-song added a comment. abandon this one. use git monorepo https://reviews.llvm.org/D65664 since we have llvm/clang inter-dependence here. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65615/new/ https://reviews.llvm

[PATCH] D65664: [BPF] annotate DIType metadata for builtin preseve_array_access_index()

2019-08-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 213122. yonghong-song added a comment. set metadata unless metadata is non-NULL. I have not found a case where metadata is NULL. But nevertheless, let us do this to avoid set a potential NULL metadata. Repository: rG LLVM Github Monorepo CHANGES S

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-06-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 206274. yonghong-song added a comment. do not use ctx.getParents() to check whether a GEP candidate inside a preserve_access_index. instead, mark the region upfront. Add the new clang intrinsic into the language doc. Repository: rC Clang CHANGES S

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-06-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as not done. yonghong-song added a comment. @eli.friedman I removed the usage of astcontext getParents() stuff. Instead, I mark the region upfront. I also added the intrinsic __builtin_preserve_access_index() into clang lang extention doc. Could you take a

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-06-27 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @eli.friedman Hi, Just ping. I have removed getParents() for ASTContext and added description of the new intrinsic in language doc. Could you take a look? Thanks! Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://re

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-06-27 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked 2 inline comments as done. yonghong-song added a comment. @rsmith I have proposed one clang intrinsic and three IR intrinsics for CO-RE. Could you take a look and share your opinions as well? Thanks! Comment at: docs/LanguageExtensions.rst:1958 +array subs

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 207475. yonghong-song added a comment. reword the lang doc for builtin_preserve_access_index() to be more user focused treat using builtin_preserve_access_index() without -g or in nested way as compiler errors Repository: rC Clang CHANGES SINCE LAS

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 207644. yonghong-song edited the summary of this revision. yonghong-song added a comment. change `void *__builtin_preserve_access_index(void *)` to `const void * _builtin_preserve_access_index(const void *)`. Repository: rC Clang CHANGES SINCE LAST

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 207704. yonghong-song added a comment. handle unnamed bitfield properly. these struct/union members are not encoded in debuginfo, so skip them during preserve_*_access_index IR intrinsics generation. Repository: rC Clang CHANGES SINCE LAST ACTION

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @rsmith Just ping, could you take a look at the clang change? If possible, could you share your opinion? Thanks! Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809 __

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-05 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @rsmith Ping again, do you have any comments on this patch? Thanks! Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809 ___ cfe-commits mailing list

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-07-10 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @jdoerfert Thanks for comments. I will submit another patch to add adequate tests for clang frontend as you suggested. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809 _

[PATCH] D61809: [BPF] Preserve original struct/union type name/access index and array subscripts

2019-05-10 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: eli.friedman, ast. Herald added subscribers: cfe-commits, arphaman, kosarev. Herald added a project: clang. For background of BPF CO-RE project, please refer to http://vger.kernel.org/bpfconf2019.html In summary, BPF CO-RE int

[PATCH] D61809: [BPF] Preserve original struct/union type name/access index and array subscripts

2019-05-10 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @lebedev.ri Thanks for the comment. This patch is not ready to land yet. Yes, tests are missing and I am going to add tests later. More importantly, I want to get a sense whether what I am implementing here is the right direction or not. The following two other pat

[PATCH] D61809: [BPF] Preserve original struct/union type name/access index and array subscripts

2019-05-13 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @rsmith @eli.friedman Thanks for your comments. I fully agree that it seems awkward that we have both GEP and intrinsic generation. I will try to do some experiments here to only have intrinsic generation. My only concern is possible performance degradation. I wil

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type name/access index

2019-05-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 199843. yonghong-song retitled this revision from "[BPF] Preserve original struct/union type name/access index and array subscripts" to "[BPF] Preserve debuginfo array/union/struct type name/access index". yonghong-song edited the summary of this revisi

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type name/access index

2019-05-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @rsmith @eli.friedman Hi, I just implemented a new version which generates intrinsics only. Three intrinsics are implemented for array/union/structure separately as their handling and parameters are different. Could you take a look? Thanks! Repository: rC Clan

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type name/access index

2019-05-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:3359 +// Remember the original array subscript for bpf target +unsigned idx = cast(indices.back())->getZExtValue(); +eltPtr = CGF.Builder.CreatePres

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type name/access index

2019-05-17 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 200117. yonghong-song edited the summary of this revision. yonghong-song added a comment. array index may not be constant and remove inst_name Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llv

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-05-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 200639. yonghong-song retitled this revision from "[BPF] Preserve debuginfo array/union/struct type name/access index" to "[BPF] Preserve debuginfo array/union/struct type/access index". yonghong-song edited the summary of this revision. yonghong-song a

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-05-23 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added inline comments. Comment at: test/CodeGen/bpf-offsetreloc.c:2-4 +// RUN: grep "llvm.preserve.struct.access.index" %t1 +// RUN: grep "llvm.preserve.array.access.index" %t1 +// RUN: grep "llvm.preserve.union.access

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-05-28 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @rsmith @eli.friedman Do you have any comments on the clang intrinsic interface in this patch and the llvm intrinsics interface at https://reviews.llvm.org/D61810? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://r

[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-05-28 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 201793. yonghong-song added a comment. remove bpf offsetreloc option and use FileCheck in the test. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61809/new/ https://reviews.llvm.org/D61809 Files: include/clang/Basic/

[PATCH] D53329: Generate DIFile with main program if source is not available

2018-12-27 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. I found an easy way to reproduce the issue and also did some preliminary analysis. I have filed a bug https://bugs.llvm.org/show_bug.cgi?id=40170. The reproducible case and my analysis is below: -bash-4.4$ cat ttest2.c #include "ttest.h" BPF_PERF_OUTPUT2(probe);

[PATCH] D67734: [CLANG-BPF] change __builtin_preserve_access_index() signature

2019-09-18 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added subscribers: cfe-commits, arphaman. Herald added a project: clang. The clang intrinsic __builtin_preserve_access_index() currently has signature: const void * __builtin_preserve_access_index(const void * ptr)

[PATCH] D67734: [CLANG-BPF] change __builtin_preserve_access_index() signature

2019-09-18 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 220772. yonghong-song edited the summary of this revision. yonghong-song added a comment. does not change arg type and make result type the same as arg type Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67

[PATCH] D67883: [CLANG][BPF] permit any argument type for __builtin_preserve_access_index()

2019-09-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added subscribers: cfe-commits, arphaman. Herald added a project: clang. Commit c15aa241f821 ("[CLANG][BPF] change __builtin_preserve_access_inde

[PATCH] D67940: [BPF] Preserve and make bitfield access relocatable

2019-09-23 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: ast, eli.friedman. Herald added subscribers: llvm-commits, cfe-commits, jdoerfert, hiraditya. Herald added projects: clang, LLVM. Previous work for BPF CO-RE (compile once, run everywhere) tries to record structure, union and arra

[PATCH] D67940: [BPF] Preserve and make bitfield access relocatable

2019-09-23 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 221466. yonghong-song added a comment. Herald added a subscriber: ormris. fix a bug like `foo(..., bar(&value), value)` where `value` is set in function `bar`. This is not right and depends on compiler optimization as there is not guarantee that argume

[PATCH] D67980: [WIP][CLANG][BPF] implement clang __builtin_bitfield_info() intrinsic

2019-09-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: ast, anakryiko. Herald added a project: clang. Herald added a subscriber: cfe-commits. The patch is still work in progress. The signature: u64 __builtin_bitfield_info(bitfield_member_access) return value: ret >> 16 : bitfi

[PATCH] D67980: [WIP][CLANG][BPF] implement clang __builtin_bitfield_info() intrinsic

2019-09-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 221598. yonghong-song edited the summary of this revision. yonghong-song added a comment. builtin return u32 instead of u64. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67980/new/ https://reviews.llvm.o

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-09-26 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 221962. yonghong-song retitled this revision from "[WIP][CLANG][BPF] implement clang __builtin_bitfield_info() intrinsic" to "[WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields". yonghong-song edited the summary of this revision.

[PATCH] D67940: [BPF] Preserve and make bitfield access relocatable

2019-10-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song abandoned this revision. yonghong-song added a comment. We will take a different approach. So abandon this revision. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67940/new/ https://reviews.llvm.org/D67940 _

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 222910. yonghong-song edited the summary of this revision. yonghong-song added a comment. use a bpf target builtin __builtin_get_field_info(). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67980/new/ http

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-02 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 222920. yonghong-song edited the summary of this revision. yonghong-song added a comment. return byte_size/offset/lshift/rshift based on size alignment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67980/n

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-03 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked 9 inline comments as done. yonghong-song added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9321-9322 + if (IsError) +return IsBitField ? EmitLValue(Arg).getBitFieldPointer() + : EmitLValue(Arg).getPointer(); + --

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-04 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 223233. yonghong-song edited the summary of this revision. yonghong-song added a comment. using 64bit buf always, handling non bitfield members, etc. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67980/new

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-05 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked 4 inline comments as done and an inline comment as not done. yonghong-song added inline comments. Comment at: llvm/lib/Target/BPF/BPFCORE.h:17 + enum OffsetRelocKind : uint32_t { +FIELD_ACCESS_OFFSET = 0, +FIELD_EXISTENCE, ast wrote

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-05 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. > All these names are not added as builtin enum before compilation starts, > right? Do you prefer to have builtin enum? If we do this, we will emit this enum all the time, regardless of whether people uses this builtin or not. Are you worried about API stability?

[PATCH] D67980: [WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-05 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added inline comments. Comment at: llvm/lib/Target/BPF/BPFCORE.h:17 + enum OffsetRelocKind : uint32_t { +FIELD_ACCESS_OFFSET = 0, +FIELD_EXISTENCE, yonghong-song wrote: > ast wrote: > > why AC

[PATCH] D67980: [CLANG][BPF] do compile-once run-everywhere relocation for bitfields

2019-10-05 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 223405. yonghong-song retitled this revision from "[WIP][CLANG][BPF] do compile-once run-everywhere relocation for bitfields" to "[CLANG][BPF] do compile-once run-everywhere relocation for bitfields". yonghong-song edited the summary of this revision. y

[PATCH] D69393: [RFC][DebugInfo] emit user specified address_space in dwarf

2019-10-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: arsenm, aprantl, Anastasia, ast. yonghong-song added a project: debug-info. Herald added subscribers: cfe-commits, wdng. Herald added a project: clang. The RFC intends to kick off the discussion on how to support user defined addr

[PATCH] D69393: [RFC][DebugInfo] emit user specified address_space in dwarf

2019-10-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @probinson Thanks for the input! That is my concern too mixing the user defined and language defined may not be a good idea and may actually cause confusion. This is exactly this RFC for. Let us try a different dwarf encoding and then we can continue to discuss.

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-22 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. In D83242#2167721 , @anakryiko wrote: > After thinking about this a bit more, I think adding a new TYPE_EXISTENCE > (instead of FIELD_EXISTENCE) relocation type is the better way to handle > this. It would allow Clang to be

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for TYPE_EXISTENCE reloc

2020-07-22 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 280027. yonghong-song retitled this revision from "[clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc" to "[clang][BPF] support expr with typedef/record type for TYPE_EXISTENCE reloc". yonghong-song edited the summary of this r

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for TYPE_EXISTENCE reloc

2020-07-22 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @anakryiko Please rebase on top of latest clang. There is a recent core change which touches BPF code which I am also modifying. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83242/new/ https://reviews.llvm.org/D8324

[PATCH] D83242: [clang][BPF] support type existence/size and enum value relocations

2020-07-28 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 281481. yonghong-song retitled this revision from "[clang][BPF] support expr with typedef/record type for TYPE_EXISTENCE reloc" to "[clang][BPF] support type existence/size and enum value relocations". yonghong-song edited the summary of this revision.

[PATCH] D83242: [clang][BPF] support type existence/size and enum value relocations

2020-07-29 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. One potential missing relocation is to test whether a particular enum value (from an enum type) exists or not. One way is to create a new relocation type ENUM_VALUE_EXISTENCE where "access_string" to encode the enum value. This is different from TYPE_EXISTENCE fo

[PATCH] D83242: [clang][BPF] support type exist/size and enum exist/value relocations

2020-07-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 281933. yonghong-song retitled this revision from "[clang][BPF] support type existence/size and enum value relocations" to "[clang][BPF] support type exist/size and enum exist/value relocations". yonghong-song edited the summary of this revision. yongho

[PATCH] D81131: [DebugInfo] Fix assertion for extern void type

2020-06-03 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: dblaikie. yonghong-song added a project: debug-info. Herald added a project: clang. Herald added a subscriber: cfe-commits. Commit d77ae1552fc2 ("[DebugInfo]

[PATCH] D81131: [DebugInfo] Fix assertion for extern void type

2020-06-04 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Thanks, @dblaikie >> I think if we're going to support "const void" we should support "void" too >> & fix the verifier to allow this & make sure LLVM produces the correct debug >> info for it (which is probably a DW_TAG_variable without a DW_AT_type >> attribute

[PATCH] D81131: [DebugInfo] Fix assertion for extern void type

2020-06-05 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 268995. yonghong-song edited the summary of this revision. yonghong-song added a comment. Herald added subscribers: llvm-commits, hiraditya, aprantl. Herald added a project: LLVM. instead of skipping generating debuginfo for "extern void var_name", do g

[PATCH] D81131: [DebugInfo] Fix assertion for extern void type

2020-06-08 Thread Yonghong Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG3eb465a329e2: [DebugInfo] Fix assertion for extern void type (authored by yonghong-song). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81131/new/ https://r

[PATCH] D81479: [BPF] introduce __builtin_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added projects: clang, LLVM. Herald added a subscriber: llvm-commits. In current linux BPF uapi https://github.com/torvalds/linux/blob/master/include/uapi/linux/bpf.h `struct __sk_buff/xdp_md` have fields __u32

[PATCH] D81479: [BPF] introduce __builtin_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. The corresponding llvm change: https://reviews.llvm.org/D81480 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81479/new/ https://reviews.llvm.org/D81479 ___ cfe-commits ma

[PATCH] D81479: [BPF] introduce __builtin_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song marked an inline comment as done. yonghong-song added inline comments. Comment at: clang/test/CodeGen/builtin-bpf-load-u32-to-ptr.c:5 +struct t { int a; int b; }; +void *test(struct t *arg) { return __builtin_load_u32_to_ptr(arg, 4); } + ast wrote:

[PATCH] D81479: [BPF] introduce __builtin_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. In D81479#2083510 , @anakryiko wrote: > IntrinsicsBPF.td uses `__builtin_bpf_load_u32_to_ptr`, while everywhere it is > just `__builtin_load_u32_to_ptr`. I think having bpf prefix there is good, > given this is bpf-specific

[PATCH] D81479: [BPF] introduce __builtin_bpf_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 269721. yonghong-song retitled this revision from "[BPF] introduce __builtin_load_u32_to_ptr() intrinsic" to "[BPF] introduce __builtin_bpf_load_u32_to_ptr() intrinsic". yonghong-song edited the summary of this revision. yonghong-song added a comment.

[PATCH] D81479: [BPF] introduce __builtin_bpf_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. In D81479#2083933 , @ast wrote: > It feels that the same thing can be represented as inline asm. > What advantage builtin has? Yes, this can be represented as an inline asm. I have a tendency not liking inline assembly co

[PATCH] D81479: [BPF] introduce __builtin_bpf_load_u32_to_ptr() intrinsic

2020-06-09 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. I guess I will go with inline asm in kernel for now as llvm seems already doing a pretty good job parsing/understanding inline asm to integrated into optimization passes. A few passes like SimplifyCFG, GVN, etc. may have some impact but probably does not really ma

[PATCH] D83242: [RFC][BPF] support expr with typedef type for FIELD_EXISTENCE reloc

2020-07-06 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: anakryiko, ast. Herald added subscribers: llvm-commits, cfe-commits, hiraditya. Herald added projects: clang, LLVM. [The patch needs more work e.g. to create proper test, to be agreed on interface, etc.] This patch added support

[PATCH] D83242: [RFC][BPF] support expr with typedef type for FIELD_EXISTENCE reloc

2020-07-08 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Sounds good. Will try to add support for union/struct type as well. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83242/new/ https://reviews.llvm.org/D83242 ___ cfe-commi

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-15 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 278190. yonghong-song retitled this revision from "[RFC][BPF] support expr with typedef type for FIELD_EXISTENCE reloc" to "[clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc". yonghong-song edited the summary of this revision.

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-15 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. The llvm change is here: https://reviews.llvm.org/D83878 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83242/new/ https://reviews.llvm.org/D83242 ___ cfe-commits mailing

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-15 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. In D83242#2154145 , @ast wrote: > lgtm. > curious what happens when type is defined within args, like: > __builtin_preserve_field_info(*(struct { int a; } *)0, 2); -bash-4.4$ clang -target bpf -O2 -g -S t1.c t1.c:3:40: er

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-15 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 278305. yonghong-song added a comment. fix clang-format warnings. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83242/new/ https://reviews.llvm.org/D83242 Files: clang/include/clang/Basic/DiagnosticSem

[PATCH] D82112: [RFC][BPF] Implement getUserCost() for BPFTargetTransformInfo

2020-06-18 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added a reviewer: ast. Herald added subscribers: llvm-commits, cfe-commits, hiraditya. Herald added projects: clang, LLVM. This patch tries to partially prevent speculative code motion for BPF. First, some use cases on why we want to prevent spec

[PATCH] D74668: [Clang][BPF] implement __builtin_btf_type_id() builtin function

2020-04-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 261426. yonghong-song added a comment. rebase on top of master Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74668/new/ https://reviews.llvm.org/D74668 Files: clang/include/clang/Basic/BuiltinsBPF.def

  1   2   3   4   5   >