[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. Maybe for device compilation we also should define `__NO_MATH_INLINES` and `__NO_STRING_INLINES` macros to disable inline assembly in glibc? Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. In https://reviews.llvm.org/D50845#1202550, @Hahnfeld wrote: > In https://reviews.llvm.org/D50845#1202540, @ABataev wrote: > > > Maybe for device compilation we also should define `__NO_MATH_INLINES` and > > `__NO_STRING_INLINES` macros to disable inline assembly in glibc? > > > The problem is that `__NO_MATH_INLINES` doesn't even avoid all inline > assembly from `bits/mathinline.h` :-( incidentally Clang already defines > `__NO_MATH_INLINES` for x86 (due to an old bug which has been fixed long ago) > - and on CentOS we still have problems as described in PR38464. > > As a second thought: This might be valid for NVPTX, but I don't think it's a > good idea for x86-like offloading targets - they might well profit from > inline assembly code. I'm not saying that we should define those macros for all targets, only for NVPTX. But still, it may disable some inline assembly for other architectures. Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. >> If I understand it correctly, the root cause of this exercise is that we >> want to compile for GPU using plain C. CUDA avoids this issue by separating >> device and host code via target attributes and clang has few special cases >> to ignore inline assembly errors in the host code if we're compiling for >> device. For OpenMP there's no such separation, not in the system headers, at >> least. > > Yes, that's one of the nice properties of CUDA (for the compiler). There used > to be the same restriction for OpenMP where all functions used in `target` > regions needed to be put in `declare target`. However that was relaxed in > favor of implicitly marking all **called** functions in that TU to be > `declare target`. > So ideally I think Clang should determine which functions are really > `declare target` (either explicit or implicit) and only run semantical > analysis on them. If a function is then found to be "broken" it's perfectly > desirable to error back to the user. It is not possible for OpenMP because we support implicit declare target functions. Clang cannot identify whether the function is going to be used on the device or not during sema analysis. Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. In https://reviews.llvm.org/D50845#1203961, @Hahnfeld wrote: > In https://reviews.llvm.org/D50845#1202973, @ABataev wrote: > > > > So ideally I think Clang should determine which functions are really > > > `declare target` (either explicit or implicit) and only run semantical > > > analysis on them. If a function is then found to be "broken" it's > > > perfectly desirable to error back to the user. > > > > It is not possible for OpenMP because we support implicit declare target > > functions. Clang cannot identify whether the function is going to be used > > on the device or not during sema analysis. > > > You are right, we can't do this during device compilation because we don't > have an AST before Sema. > > However I'm currently thinking about the following: > > 1. Identify explicit and implicit `declare target` functions during host Sema > and CodeGen. > 2. Attach meta-data for all of them to LLVM IR `.bc` which is passed via > `-fopenmp-host-ir-file-path`. I think we already do something similar for > outlined `target` regions? > 3. During device Sema query that meta-data so Clang knows when a function > will be called from within a `target` region. Skip analysis of functions that > are not needed for the device, just as CUDA does. > 4. Check that we don't need functions that weren't marked in 2. That's to > catch users doing something like: ```lang=c #pragma omp target { #ifdef > __NVPTX__ target_func() #endif } ``` > > For now that's just an idea, I didn't start implementing any of this yet. > Do you think that could work? I thought about this approach already. But it won't work in general. The main problem here is that host and device compilation phases may end up with the different set of implicit declare target functions. The main problem here not the user code, but the system libraries, which may use the different set of functions. Another one problem here is that the user may use the function that has some host assembler inside. In this case we still need to emit error message, otherwise, we may end up with the compiler crash. The best solution is to use only device specific header files. Device compilation phase should use system header files for the host at all. Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. In https://reviews.llvm.org/D50845#1203973, @Hahnfeld wrote: > In https://reviews.llvm.org/D50845#1203967, @ABataev wrote: > > > In https://reviews.llvm.org/D50845#1203961, @Hahnfeld wrote: > > > > > In https://reviews.llvm.org/D50845#1202973, @ABataev wrote: > > > > > > > > So ideally I think Clang should determine which functions are really > > > > > `declare target` (either explicit or implicit) and only run > > > > > semantical analysis on them. If a function is then found to be > > > > > "broken" it's perfectly desirable to error back to the user. > > > > > > > > It is not possible for OpenMP because we support implicit declare > > > > target functions. Clang cannot identify whether the function is going > > > > to be used on the device or not during sema analysis. > > > > > > > > > You are right, we can't do this during device compilation because we > > > don't have an AST before Sema. > > > > > > However I'm currently thinking about the following: > > > > > > 1. Identify explicit and implicit `declare target` functions during host > > > Sema and CodeGen. > > > 2. Attach meta-data for all of them to LLVM IR `.bc` which is passed via > > > `-fopenmp-host-ir-file-path`. I think we already do something similar for > > > outlined `target` regions? > > > 3. During device Sema query that meta-data so Clang knows when a function > > > will be called from within a `target` region. Skip analysis of functions > > > that are not needed for the device, just as CUDA does. > > > 4. Check that we don't need functions that weren't marked in 2. That's to > > > catch users doing something like: ```lang=c #pragma omp target { #ifdef > > > __NVPTX__ target_func() #endif } ``` > > > > > > For now that's just an idea, I didn't start implementing any of this > > > yet. Do you think that could work? > > > > > > I thought about this approach already. But it won't work in general. The > > main problem here is that host and device compilation phases may end up > > with the different set of implicit declare target functions. The main > > problem here not the user code, but the system libraries, which may use the > > different set of functions. > > > How common is that for functions that are used in `target` regions? In the > worst case we can make my fourth point a warning and lose Sema checking for > those functions. It does not matter how common is it or not. If the bad situation can happen, it will happen. Warning won't work here, because, again, you may end up with the code that may cause compiler crash for the device. For example, if the system function uses throw/catch stmts, we may emit the warning for this function, but will have troubles during the codegen. > > >> Another one problem here is that the user may use the function that has some >> host assembler inside. In this case we still need to emit error message, >> otherwise, we may end up with the compiler crash. > > Once we know which functions are used, they can be checked as usual. > >> The best solution is to use only device specific header files. Device >> compilation phase should use system header files for the host at all. > > You mean "shouldn't use system header files for the host"? I think that may > be hard to achieve, especially if we want to Sema check all of the source > code during device compilation. Yes, I mean should not. Yes, this is hard to achieve but that's the only complete and correct solution. Everything else looks like a non-stable hack. Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. > Right, warning wasn't a good thought. We really want strict checking and > would have to error out when we find a function that wasn't implicitly > `declare target` on the host. > I meant to ask how common that would be? If that's only some known functions > we could handle them separately. Again, it does not matter how common is this situation. We cannot rely on the probability here, we need to make the compiler to work correctly in all possible situation, no matter how often they can occur. The best solution is to use only device specific header files. Device compilation phase should use system header files for the host at all. >>> >>> You mean "shouldn't use system header files for the host"? I think that may >>> be hard to achieve, especially if we want to Sema check all of the source >>> code during device compilation. >> >> Yes, I mean should not. Yes, this is hard to achieve but that's the only >> complete and correct solution. Everything else looks like a non-stable hack. > > How do you propose to handle inline assembly in non-system header files? Just like as usual - if the assembler is supported by the device - it is ok, otherwise - error message. Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. In https://reviews.llvm.org/D50845#1204216, @Hahnfeld wrote: > In https://reviews.llvm.org/D50845#1204210, @ABataev wrote: > > > > Right, warning wasn't a good thought. We really want strict checking and > > > would have to error out when we find a function that wasn't implicitly > > > `declare target` on the host. > > > I meant to ask how common that would be? If that's only some known > > > functions we could handle them separately. > > > > Again, it does not matter how common is this situation. We cannot rely on > > the probability here, we need to make the compiler to work correctly in all > > possible situation, no matter how often they can occur. > > > Got that, I agree on the conservative approach: If we find a function to be > called that wasn't checked (because it wasn't implicitly `declare target` on > the host) the compiler can error out. That should be correct in all cases, > shouldn't it? > > There's a trade-off here: > > - How many TUs pass full analysis and how many don't? (today's situation; we > know that some headers don't work) > - How many TUs pass when we only check called functions (and error if we call > non-checked ones) and how many regress compared to today's situation? If the > number of regressions is zero for all practical situations but we can compile > some important cases, that should be a win. I need to think about it. We need to estimate all pros and cons here. It might work. >> The best solution is to use only device specific header files. Device >> compilation phase should use system header files for the host at all. > > You mean "shouldn't use system header files for the host"? I think that > may be hard to achieve, especially if we want to Sema check all of the > source code during device compilation. Yes, I mean should not. Yes, this is hard to achieve but that's the only complete and correct solution. Everything else looks like a non-stable hack. >>> >>> How do you propose to handle inline assembly in non-system header files? >> >> Just like as usual - if the assembler is supported by the device - it is ok, >> otherwise - error message. > > Even if the function is never called? That would mean you can't include any > `Eigen` header... Yes, that's the problem. Repository: rC Clang https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
ABataev added a comment. 1. Is this allowed to use OpenMP for OpenCL programs at all? 2. If it is allowed, I think it would be better to set the TypeSourceInfo for the artificial variable Repository: rC Clang https://reviews.llvm.org/D46667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
ABataev added a comment. BTW, the test itself does not check anything. Repository: rC Clang https://reviews.llvm.org/D46667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
ABataev added a comment. In https://reviews.llvm.org/D46667#1094340, @Anastasia wrote: > OpenCL C is based on C99, so OpenMP isn't enabled by default. But in your > tests you use `-fopenmp` to activate it. > > OpenCL general philosophy is that vectors are written explicitly, but it's > not always very easy. In OpenCL C++ we have added an attribute hint for auto > vectorization `cl::vec_type_hint`. It's given to a kernel rather than for a > loop though. So I think this `simd` pragma is useful. My only worry is that > other OpenMP features might not work well in OpenCL and we have no way to > reject them at the moment. We have special flag '-fopenmp-simd' to support only simd-based constructs. We can allow to use only this subset of OpenMP in OpenCL programs and disable support for '-fopenmp'. Repository: rC Clang https://reviews.llvm.org/D46667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
ABataev added inline comments. Comment at: lib/Sema/SemaDecl.cpp:11348 // initialiser -if (var->getTypeSourceInfo()->getType()->isBlockPointerType() && -!var->hasInit()) { +if (var->getType()->isBlockPointerType() && !var->hasInit()) { Diag(var->getLocation(), diag::err_opencl_invalid_block_declaration) Anastasia wrote: > Does `simd` result in block creation? My original understanding of it was > that it will result in vector operations, not extra threads. Currently all of the OpenMP constructs (even simd) create special lambda-like construct CapturedStmt that are kind of a block. It is required for unified processing of the OpenMP constructs. Comment at: test/SemaOpenCL/omp_simd.cl:1 +// RUN: %clang_cc1 -verify -fopenmp -fsyntax-only -x cl %s +// expected-no-diagnostics It would be good to check that at least -ast-print or -ast-dump works correctly. Repository: rC Clang https://reviews.llvm.org/D46667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
ABataev added inline comments. Comment at: test/SemaOpenCL/with_openmp.cl:1 +// RUN: %clang_cc1 -verify -fopenmp -ast-dump -x cl %s 2>&1 | FileCheck %s +// expected-no-diagnostics Still the same question, do we really want to support full OpenMP for OpenCL or only simd? https://reviews.llvm.org/D46667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45783: [DEBUGINFO, NVPTX] Render `-no-cuda-debug` LLVM option when required.
ABataev added a comment. In https://reviews.llvm.org/D45783#1106019, @echristo wrote: > So, I'd really prefer not to set options via the backend option path. From > here I think we should aim to take all of the options we added and having the > asm printer in the backend know how to set them depending on the target. We > could also add things to the IR metadata if necessary, but I'd like to avoid > that if possible. > > Thoughts? This patch is outdated a bit, I have a patch https://reviews.llvm.org/D46061 that does it in a different way, via `MCOption` Repository: rC Clang https://reviews.llvm.org/D45783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38371: [OpenMP] Initial implementation of teams distribute code generation
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rL LLVM https://reviews.llvm.org/D38371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38968: [OpenMP] Implement omp_is_initial_device() as builtin
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D38968 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39136: [OpenMP] Avoid VLAs for some reductions on array sections
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D39136 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
ABataev created this revision. ABataev added a reviewer: echristo. Herald added subscribers: JDevlieghere, fedor.sergeev, aprantl. Added option -glineinfo-only to support emission of the debug directives only. It behaves very similar to -gline-tables-only, except that it sets llvm debug info emission kind to llvm::DICompileUnit::DebugDirectivesOnly. Repository: rC Clang https://reviews.llvm.org/D51177 Files: include/clang/Basic/DebugInfoOptions.h include/clang/Driver/Options.td lib/CodeGen/CGDebugInfo.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/debug-info-gline-tables-only.c test/CodeGen/debug-info-gline-tables-only2.c test/CodeGen/debug-info-line.c test/CodeGen/debug-info-macro.c test/CodeGen/debug-info-scope.c test/CodeGen/lifetime-debuginfo-1.c test/CodeGen/lifetime-debuginfo-2.c test/CodeGenCXX/crash.cpp test/CodeGenCXX/debug-info-blocks.cpp test/CodeGenCXX/debug-info-gline-tables-only.cpp test/CodeGenCXX/debug-info-line.cpp test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp test/CodeGenCXX/debug-info-namespace.cpp test/CodeGenCXX/debug-info-template-explicit-specialization.cpp test/CodeGenCXX/debug-info-windows-dtor.cpp test/CodeGenCXX/linetable-virtual-variadic.cpp test/CodeGenObjCXX/debug-info-line.mm test/CodeGenObjCXX/pr14474-gline-tables-only.mm test/Driver/debug-options.c Index: test/Driver/debug-options.c === --- test/Driver/debug-options.c +++ test/Driver/debug-options.c @@ -119,6 +119,25 @@ // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_NO %s // +// RUN: %clang -### -c -glineinfo-only %s -target x86_64-apple-darwin 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY %s +// RUN: %clang -### -c -glineinfo-only %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target x86_64-linux-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY %s +// RUN: %clang -### -c -glineinfo-only -g %s -target x86_64-apple-darwin16 2>&1 \ +// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target i386-pc-solaris 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g0 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_NO %s +// // RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \ // | FileCheck -check-prefix=GRECORD %s // RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \ @@ -178,6 +197,9 @@ // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ // RUN:| FileCheck -check-prefix=GLTO_ONLY %s // +// RUN: %clang -### -gmodules -glineinfo-only %s 2>&1 \ +// RUN:| FileCheck -check-prefix=GLIO_ONLY %s +// // G: "-cc1" // G: "-debug-info-kind=limited" // @@ -204,6 +226,15 @@ // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" // GLTO_ONLY_DWARF2: "-dwarf-version=2" // +// GLIO_ONLY: "-cc1" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// GLIO_ONLY: "-debug-info-kind=lineinfo-directives-only" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// +// GLIO_ONLY_DWARF2: "-cc1" +// GLIO_ONLY_DWARF2: "-debug-info-kind=lineinfo-directives-only" +// GLIO_ONLY_DWARF2: "-dwarf-version=2" +// // G_ONLY: "-cc1" // G_ONLY: "-debug-info-kind=limited" // @@ -225,6 +256,10 @@ // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= // +// This tests asserts that "-glineinfo-only" "-g0" disables debug info. +// GLIO_NO: "-cc1" +// GLIO_NO-NOT: -debug-info-kind= +// // GRECORD: "-dwarf-debug-flags" // GRECORD: -### -c -grecord-gcc-switches // Index: test/CodeGenObjCXX/pr14474-gline-tables-only.mm === --- test/CodeGenObjCXX/pr14474-gline-tables-only.mm +++ test/CodeGenObjCXX/pr14474-gline-tables-only.mm @@ -1,6 +1,8 @@ // PR 14474 // RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ // RUN: -debug-info-kind=line-tables-only -x objective-c++ -o /dev/null %s +// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ +// RUN: -debug-info-kind=lineinfo-directives-only -x objective-c++ -o /dev/null %s typedef signed char BOOL; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; Index: test/CodeGenObjCXX/debug-info-line.mm === --
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
ABataev added a comment. In https://reviews.llvm.org/D51177#1213079, @echristo wrote: > Should we just have them mean the same thing and change it based on target? I reused the same debug info level support in clang, but in LLVM they have different processing and I'm not sure that they are absolutely compatible. Repository: rC Clang https://reviews.llvm.org/D51177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51378: [OPENMP] Add support for nested 'declare target' directives
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D51378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
ABataev added a comment. When is ITT Notify used? Does it have some preconditions like debug info, some optimizations level etc.? https://reviews.llvm.org/D51331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D51331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
ABataev updated this revision to Diff 163353. ABataev added a comment. Address comment from David. Repository: rC Clang https://reviews.llvm.org/D51177 Files: include/clang/Basic/DebugInfoOptions.h include/clang/Driver/Options.td lib/CodeGen/CGDebugInfo.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/debug-info-gline-tables-only.c test/CodeGen/debug-info-gline-tables-only2.c test/CodeGen/debug-info-line.c test/CodeGen/debug-info-macro.c test/CodeGen/debug-info-scope.c test/CodeGen/lifetime-debuginfo-1.c test/CodeGen/lifetime-debuginfo-2.c test/CodeGenCXX/crash.cpp test/CodeGenCXX/debug-info-blocks.cpp test/CodeGenCXX/debug-info-gline-tables-only.cpp test/CodeGenCXX/debug-info-line.cpp test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp test/CodeGenCXX/debug-info-namespace.cpp test/CodeGenCXX/debug-info-template-explicit-specialization.cpp test/CodeGenCXX/debug-info-windows-dtor.cpp test/CodeGenCXX/linetable-virtual-variadic.cpp test/CodeGenObjCXX/debug-info-line.mm test/CodeGenObjCXX/pr14474-gline-tables-only.mm test/Driver/debug-options.c Index: test/Driver/debug-options.c === --- test/Driver/debug-options.c +++ test/Driver/debug-options.c @@ -119,6 +119,25 @@ // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_NO %s // +// RUN: %clang -### -c -gline-directives-only %s -target x86_64-apple-darwin 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY %s +// RUN: %clang -### -c -gline-directives-only %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-linux-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY %s +// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-apple-darwin16 2>&1 \ +// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target i386-pc-solaris 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g0 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_NO %s +// // RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \ // | FileCheck -check-prefix=GRECORD %s // RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \ @@ -178,6 +197,9 @@ // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ // RUN:| FileCheck -check-prefix=GLTO_ONLY %s // +// RUN: %clang -### -gmodules -gline-directives-only %s 2>&1 \ +// RUN:| FileCheck -check-prefix=GLIO_ONLY %s +// // G: "-cc1" // G: "-debug-info-kind=limited" // @@ -204,6 +226,15 @@ // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" // GLTO_ONLY_DWARF2: "-dwarf-version=2" // +// GLIO_ONLY: "-cc1" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// GLIO_ONLY: "-debug-info-kind=line-directives-only" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// +// GLIO_ONLY_DWARF2: "-cc1" +// GLIO_ONLY_DWARF2: "-debug-info-kind=line-directives-only" +// GLIO_ONLY_DWARF2: "-dwarf-version=2" +// // G_ONLY: "-cc1" // G_ONLY: "-debug-info-kind=limited" // @@ -225,6 +256,10 @@ // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= // +// This tests asserts that "-gline-directives-only" "-g0" disables debug info. +// GLIO_NO: "-cc1" +// GLIO_NO-NOT: -debug-info-kind= +// // GRECORD: "-dwarf-debug-flags" // GRECORD: -### -c -grecord-gcc-switches // Index: test/CodeGenObjCXX/pr14474-gline-tables-only.mm === --- test/CodeGenObjCXX/pr14474-gline-tables-only.mm +++ test/CodeGenObjCXX/pr14474-gline-tables-only.mm @@ -1,6 +1,8 @@ // PR 14474 // RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ // RUN: -debug-info-kind=line-tables-only -x objective-c++ -o /dev/null %s +// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ +// RUN: -debug-info-kind=line-directives-only -x objective-c++ -o /dev/null %s typedef signed char BOOL; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; Index: test/CodeGenObjCXX/debug-info-line.mm === --- test/CodeGenObjCXX/debug-info-line.mm +++ test/CodeGenObjCXX/debug-info-line.mm @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debu
[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
ABataev added a comment. In https://reviews.llvm.org/D50845#1219709, @tra wrote: > FYI. This breaks our CUDA compilation. I haven't figured out what exactly is > wrong yet. I may need to unroll the patch if the fix is not obvious. +1. I think this patch must be reverted, it breaks compilation on many platforms and requires manual fine-tuning. Repository: rL LLVM https://reviews.llvm.org/D50845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
This revision was automatically updated to reflect the committed changes. Closed by commit rL341212: [DEBUGINFO] Add support for emission of the debug directives only. (authored by ABataev, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D51177 Files: cfe/trunk/include/clang/Basic/DebugInfoOptions.h cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c cfe/trunk/test/CodeGen/debug-info-gline-tables-only2.c cfe/trunk/test/CodeGen/debug-info-line.c cfe/trunk/test/CodeGen/debug-info-macro.c cfe/trunk/test/CodeGen/debug-info-scope.c cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c cfe/trunk/test/CodeGenCXX/crash.cpp cfe/trunk/test/CodeGenCXX/debug-info-blocks.cpp cfe/trunk/test/CodeGenCXX/debug-info-gline-tables-only.cpp cfe/trunk/test/CodeGenCXX/debug-info-line.cpp cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp cfe/trunk/test/CodeGenCXX/debug-info-windows-dtor.cpp cfe/trunk/test/CodeGenCXX/linetable-virtual-variadic.cpp cfe/trunk/test/CodeGenObjCXX/debug-info-line.mm cfe/trunk/test/CodeGenObjCXX/pr14474-gline-tables-only.mm cfe/trunk/test/Driver/debug-options.c Index: cfe/trunk/include/clang/Basic/DebugInfoOptions.h === --- cfe/trunk/include/clang/Basic/DebugInfoOptions.h +++ cfe/trunk/include/clang/Basic/DebugInfoOptions.h @@ -21,6 +21,7 @@ /// locations for instructions without actually /// emitting debug info for them (e.g., when -Rpass /// is used). + DebugDirectivesOnly, /// Emit only debug directives with the line numbers data DebugLineTablesOnly, /// Emit only debug info necessary for generating /// line number tables (-gline-tables-only). LimitedDebugInfo,/// Limit generated debug info to reduce size Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1777,6 +1777,8 @@ HelpText<"Generate source-level debug information">; def gline_tables_only : Flag<["-"], "gline-tables-only">, Group, Flags<[CoreOption]>, HelpText<"Emit debug line number tables only">; +def gline_directives_only : Flag<["-"], "gline-directives-only">, Group, + Flags<[CoreOption]>, HelpText<"Emit debug line info directives only">; def gmlt : Flag<["-"], "gmlt">, Alias; def g0 : Flag<["-"], "g0">, Group; def g1 : Flag<["-"], "g1">, Group, Alias; Index: cfe/trunk/test/CodeGen/debug-info-line.c === --- cfe/trunk/test/CodeGen/debug-info-line.c +++ cfe/trunk/test/CodeGen/debug-info-line.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -w -debug-info-kind=line-directives-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s int f1(int a, int b) { // CHECK: icmp {{.*}}, !dbg [[DBG_F1:!.*]] Index: cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c === --- cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c +++ cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -debug-info-kind=line-tables-only -S -emit-llvm -o - | FileCheck %s -// Checks that clang with "-gline-tables-only" doesn't emit debug info +// RUN: %clang_cc1 %s -debug-info-kind=line-directives-only -S -emit-llvm -o - | FileCheck %s +// Checks that clang with "-gline-tables-only" or "-gline-directives-only" doesn't emit debug info // for variables and types. // CHECK-NOT: DW_TAG_variable Index: cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c === --- cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c +++ cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s +// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-directives-only %s -o - | FileCheck %s // Inserting lifetime markers should not affect debuginfo: lifetime.end is not // a destructor, but instrumentation for the compiler. Ensure the debug info for Index: cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c === --- cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c ++
[PATCH] D51554: [CUDA][OPENMP][NVPTX]Improve logic of the debug info support.
ABataev created this revision. ABataev added reviewers: tra, echristo. Herald added subscribers: JDevlieghere, guansong, aprantl. Added support for the -gline-directives-only option + fixed logic of the debug info for CUDA devices. If optimization level is O0, then options --[no-]cuda-noopt-device-debug do not affect the debug info level. If the optimization level is >O0, debug info options are used + --no-cuda-noopt-device-debug is used or no --cuda-noopt-device-debug is used, the optimization level for the device code is kept and the emission of the debug directives is used. If the opt level is > O0, debug info is requested + --cuda-noopt-device-debug option is used, the optimization is disabled for the device code + required debug info is emitted. Repository: rC Clang https://reviews.llvm.org/D51554 Files: include/clang/Driver/ToolChain.h lib/Driver/ToolChains/Clang.cpp lib/Driver/ToolChains/Cuda.cpp lib/Driver/ToolChains/Cuda.h test/Driver/cuda-dwarf-2.cu test/Driver/openmp-offload-gpu.c Index: test/Driver/openmp-offload-gpu.c === --- test/Driver/openmp-offload-gpu.c +++ test/Driver/openmp-offload-gpu.c @@ -167,29 +167,39 @@ // CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices. /// Check that debug info is emitted in dwarf-2 -// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG %s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \ +// RUN: | FileCheck -check-prefix=LINE_TABLE %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG %s +// RUN: | FileCheck -check-prefix=LINE_TABLE %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG %s +// RUN: | FileCheck -check-prefix=LINE_TABLE %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g0 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s +// RUN: | FileCheck -check-prefix=LINE_TABLE %s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-directives-only 2>&1 \ +// RUN: | FileCheck -check-prefix=LINE_TABLE %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s +// RUN: | FileCheck -check-prefix=LINE_TABLE %s // LINE_TABLE-NOT: warning: debug // NO_DEBUG-NOT: warning: debug +// NO_DEBUG: "-fopenmp-is-device" +// NO_DEBUG-NOT: "-debug-info-kind= // NO_DEBUG: ptxas +// LINE_TABLE: "-triple" "nvptx64-nvidia-cuda" +// LINE_TABLE-SAME: "-debug-info-kind=line-directives-only" +// LINE_TABLE-SAME: "-fopenmp-is-device" +// LINE_TABLE: ptxas // LINE_TABLE: "-lineinfo" // NO_DEBUG-NOT: "-g" // NO_DEBUG: nvlink // NO_DEBUG-NOT: "-g" +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \ +// RUN: | FileCheck -check-prefix=HAS_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g 2>&1 \ // RUN: | FileCheck -check-prefix=HAS_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --cuda-noopt-device-debug 2>&1 \ @@ -207,6 +217,7 @@ // HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda" +// HAS_DEBUG-SAME: "-debug-info-kind=limited" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-fopenmp-is-device" // HAS_DEBUG: ptxas Index: test/Driver/cuda-dwarf-2.cu
[PATCH] D51378: [OPENMP] Add support for nested 'declare target' directives
ABataev accepted this revision. ABataev added a comment. LG https://reviews.llvm.org/D51378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51554: [CUDA][OPENMP][NVPTX]Improve logic of the debug info support.
ABataev added a comment. In https://reviews.llvm.org/D51554#1224049, @echristo wrote: > The change in name here from "line tables" to "directives only" feels a bit > confusing. "Limited" seems to be a bit more clear, or even remaining line > tables only. Can you explain where you were going with this particular set of > changes in a bit more detail please? > > Thanks! > > -eric CUDA/NVPTX supports only 3 types of the debug info: limited/full, debug directives and no debug info at all. It does not support debug tables, so I just convert this into debug directives only. The main idea is to mimic what nvcc does. It behaves absolutely the same way. If the opt level is O0, we can use full debug info. if opt level is >O0, we can use only lineinfo(debug directives) or no debug info. If we enabling debug info for the device code using `--cuda-noopt-device-debug`, the opt level for the device code is lowered to O0 and we enable full debug info. The host code will be optimized still. Repository: rC Clang https://reviews.llvm.org/D51554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D52097: [OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer - NFC
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D52097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49510: [OpenMP][Clang] Usability improvements for OpenMP offloading
ABataev added a comment. 1. The new tool definitely requires an RFC at first. 2. The patch is too big and should be split into several small patches Repository: rC Clang https://reviews.llvm.org/D49510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49148: [DEBUGINFO] Disable unsupported debug info options for NVPTX target.
ABataev updated this revision to Diff 156575. ABataev added a comment. Added checks for all possible debug options. Repository: rC Clang https://reviews.llvm.org/D49148 Files: include/clang/Basic/DiagnosticDriverKinds.td include/clang/Basic/DiagnosticGroups.td include/clang/Driver/ToolChain.h lib/Driver/ToolChains/Clang.cpp lib/Driver/ToolChains/Cuda.cpp lib/Driver/ToolChains/Cuda.h test/Driver/cuda-dwarf-2.cu test/Driver/cuda-unsupported-debug-options.cu test/Driver/openmp-offload-gpu.c test/Driver/openmp-unsupported-debug-options.c Index: test/Driver/openmp-unsupported-debug-options.c === --- /dev/null +++ test/Driver/openmp-unsupported-debug-options.c @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gz 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-4 -gcodeview 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-5 -gmodules 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb -gembed-source -gdwarf-5 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb1 -fdebug-macro 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb2 -ggnu-pubnames 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb3 -gdwarf-aranges 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gcolumn-info -fdebug-types-section 2>&1 | FileCheck %s +// CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt] +// CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86 +// CHECK: "-triple" "nvptx64-nvidia-cuda" +// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} +// CHECK: "-triple" "x86_64 +// CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} Index: test/Driver/openmp-offload-gpu.c === --- test/Driver/openmp-offload-gpu.c +++ test/Driver/openmp-offload-gpu.c @@ -182,6 +182,8 @@ // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s +// LINE_TABLE-NOT: warning: debug +// NO_DEBUG-NOT: warning: debug // NO_DEBUG: ptxas // LINE_TABLE: "-lineinfo" // NO_DEBUG-NOT: "-g" @@ -203,6 +205,7 @@ // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=HAS_DEBUG %s +// HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-fopenmp-is-device" Index: test/Driver/cuda-unsupported-debug-options.cu === --- /dev/null +++ test/Driver/cuda-unsupported-debug-options.cu @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -c %s -g -gz 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s +// RU
[PATCH] D49148: [DEBUGINFO] Disable unsupported debug info options for NVPTX target.
ABataev updated this revision to Diff 157563. ABataev added a comment. Address ERic's comments. Repository: rC Clang https://reviews.llvm.org/D49148 Files: include/clang/Basic/DiagnosticDriverKinds.td include/clang/Basic/DiagnosticGroups.td include/clang/Driver/ToolChain.h lib/Driver/ToolChains/Clang.cpp lib/Driver/ToolChains/Cuda.cpp lib/Driver/ToolChains/Cuda.h test/Driver/cuda-dwarf-2.cu test/Driver/cuda-unsupported-debug-options.cu test/Driver/openmp-offload-gpu.c test/Driver/openmp-unsupported-debug-options.c Index: test/Driver/openmp-unsupported-debug-options.c === --- /dev/null +++ test/Driver/openmp-unsupported-debug-options.c @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gz 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-4 -gcodeview 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-5 -gmodules 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb -gembed-source -gdwarf-5 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb1 -fdebug-macro 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb2 -ggnu-pubnames 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb3 -gdwarf-aranges 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gcolumn-info -fdebug-types-section 2>&1 | FileCheck %s +// CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt] +// CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86 +// CHECK: "-triple" "nvptx64-nvidia-cuda" +// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} +// CHECK: "-triple" "x86_64 +// CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} Index: test/Driver/openmp-offload-gpu.c === --- test/Driver/openmp-offload-gpu.c +++ test/Driver/openmp-offload-gpu.c @@ -182,6 +182,8 @@ // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s +// LINE_TABLE-NOT: warning: debug +// NO_DEBUG-NOT: warning: debug // NO_DEBUG: ptxas // LINE_TABLE: "-lineinfo" // NO_DEBUG-NOT: "-g" @@ -203,6 +205,7 @@ // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=HAS_DEBUG %s +// HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-fopenmp-is-device" Index: test/Driver/cuda-unsupported-debug-options.cu === --- /dev/null +++ test/Driver/cuda-unsupported-debug-options.cu @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -c %s -g -gz 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s +// RUN: %clang -### -targ
[PATCH] D49148: [DEBUGINFO] Disable unsupported debug info options for NVPTX target.
ABataev marked an inline comment as done. ABataev added inline comments. Comment at: lib/Driver/ToolChains/Clang.cpp:933-938 + if (TC.supportsDebugInfoOption(A)) { +Action(); +return true; + } + reportUnsupportedDebugInfoOption(A, Args, D, TC.getTriple()); + return false; echristo wrote: > I'd probably simplify this as: > > ``` > if (TC.supportsDebugInfoOption(A)) > return true; > reportUnsupportedDebugInfoOption(A, Args, D, TC.getTriple()); > return false; > ``` > > And just leave the action part in the rest of the code. I think that means > you could also leave the bool off. > > As another optimization here you could, instead, just check all of the > arguments ahead of time by getting the full list of debug info and just > checking them all. That's probably not worth it though TBH. > Done, but I need boolean result in most cases. Repository: rC Clang https://reviews.llvm.org/D49148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49148: [DEBUGINFO] Disable unsupported debug info options for NVPTX target.
ABataev added a comment. Eric accepted the patch offline. Repository: rC Clang https://reviews.llvm.org/D49148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49148: [DEBUGINFO] Disable unsupported debug info options for NVPTX target.
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rC338155: [DEBUGINFO] Disable unsupported debug info options for NVPTX target. (authored by ABataev, committed by ). Changed prior to commit: https://reviews.llvm.org/D49148?vs=157563&id=157744#toc Repository: rC Clang https://reviews.llvm.org/D49148 Files: include/clang/Basic/DiagnosticDriverKinds.td include/clang/Basic/DiagnosticGroups.td include/clang/Driver/ToolChain.h lib/Driver/ToolChains/Clang.cpp lib/Driver/ToolChains/Cuda.cpp lib/Driver/ToolChains/Cuda.h test/Driver/cuda-dwarf-2.cu test/Driver/cuda-unsupported-debug-options.cu test/Driver/openmp-offload-gpu.c test/Driver/openmp-unsupported-debug-options.c Index: test/Driver/openmp-unsupported-debug-options.c === --- test/Driver/openmp-unsupported-debug-options.c +++ test/Driver/openmp-unsupported-debug-options.c @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gz 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-4 -gcodeview 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-5 -gmodules 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb -gembed-source -gdwarf-5 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb1 -fdebug-macro 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb2 -ggnu-pubnames 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb3 -gdwarf-aranges 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gcolumn-info -fdebug-types-section 2>&1 | FileCheck %s +// CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt] +// CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86 +// CHECK: "-triple" "nvptx64-nvidia-cuda" +// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} +// CHECK: "-triple" "x86_64 +// CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} Index: test/Driver/cuda-dwarf-2.cu === --- test/Driver/cuda-dwarf-2.cu +++ test/Driver/cuda-dwarf-2.cu @@ -15,6 +15,8 @@ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \ // RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE +// NO_DEBUG-NOT: warning: debug +// LINE_TABLE-NOT: warning: debug // NO_DEBUG: ptxas // NO_DEBUG-NOT: "-g" // LINE_TABLE: "-lineinfo" @@ -36,6 +38,7 @@ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb3 -O3 --cuda-noopt-device-debug 2>&1 | \ // RUN: FileCheck %s -check-prefix HAS_DEBUG +// HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-fcuda-is-device" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG: ptxas Index: test/Driver/cuda-unsupported-debug-options.cu === --- test/Driver/cuda-unsupported-debug-options.cu +++ test/Driver/cuda-unsupported-debug-options.cu @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -c %s -g -gz 2>&1 | FileCheck %s +// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s +// RUN: %clan
[PATCH] D50218: [OpenMP] Encode offload target triples into comdat key for offload initialization code
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3825 +// this particular combination of offloading targets. +SmallVector RegFnNameParts; +RegFnNameParts.push_back("omp_offloading"); Preallocate the memory for all elements at construction, you know the number of elements. https://reviews.llvm.org/D50218 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50218: [OpenMP] Encode offload target triples into comdat key for offload initialization code
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3828-3829 +RegFnNameParts[1] = "descriptor_reg"; +for (size_t I = 0; I < Devices.size(); ++I) + RegFnNameParts[I + 2U] = Devices[I].getTriple(); +llvm::sort(RegFnNameParts.begin() + 2, RegFnNameParts.end()); Use something like this: ``` llvm::copy(Devices, std::next(RegFnNameParts.begin(), 2)); ``` Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3830 + RegFnNameParts[I + 2U] = Devices[I].getTriple(); +llvm::sort(RegFnNameParts.begin() + 2, RegFnNameParts.end()); +std::string Descriptor = getName(RegFnNameParts); Also, use `std::next(RegFnNameParts.begin(), 2)` https://reviews.llvm.org/D50218 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50218: [OpenMP] Encode offload target triples into comdat key for offload initialization code
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D50218 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42581: [NVPTX] Emit debug info in DWARF-2 by default for Cuda devices.
ABataev added inline comments. Comment at: lib/Driver/ToolChains/Cuda.cpp:436-437 assert(Output.isNothing() && "Invalid output."); - if (Args.hasArg(options::OPT_g_Flag)) + if (mustEmitDebugInfo(Args) == FullDebug) CmdArgs.push_back("-g"); tra wrote: > Do we need to pass -g to make lineinfo debugging work? I checked with nvcc, it does not send `-g` in line table only mode. Repository: rC Clang https://reviews.llvm.org/D42581 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43026: [OpenMP] Support for implicit "declare target" functions - CodeGen patch
ABataev added a comment. It is impossible to understand what is going on here. We need to discuss this before even reviewing of this patch. Comment at: lib/CodeGen/CGCXXABI.h:543 + llvm::GlobalVariable *DeclPtr, bool PerformInit, + bool EmitInitOnly, bool EmitDtorOnly) = 0; Why do you need these additional parameters? Comment at: lib/CodeGen/CGDeclCXX.cpp:153-154 + bool PerformInit, + bool EmitInitOnly, + bool EmitDtorOnly) { Why do you need these parameters? Comment at: lib/CodeGen/CGDeclCXX.cpp:588-590 + if (CGM.getLangOpts().OpenMP) +CGM.getOpenMPRuntime().registerDeviceCtorDtorLaunching(*this, *D, Addr, + PerformInit); 1. Check that this is the device codegen. 2. Enclose in braces Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3484-3486 + if (Entry->second.isRegistered()) +return false; + return true; Just `return !Entry->second.isRegistered();` Comment at: lib/CodeGen/CGOpenMPRuntime.h:388 -/// \brief Number of entries registered so far. -unsigned OffloadingEntriesNum; +/// \brief Number of ordered entries registered so far. +unsigned OffloadingOrderedEntriesNum = 0u; Remove `brief`s Comment at: lib/CodeGen/CGOpenMPRuntime.h:508-509 + OffloadEntryInfoDeviceGlobalVar() + : OffloadEntryInfo(OFFLOAD_ENTRY_INFO_DEVICE_GLOBAL_VAR, ~0u, + /*Flags=*/0u), +Addr(nullptr) {} Use enumeric values rather than the magical numbers. Comment at: lib/CodeGen/CGOpenMPRuntime.h:559-563 + : OffloadEntryInfo(OFFLOAD_ENTRY_INFO_DEVICE_FUNCTION, ~0u, + /*Flags=*/0u) {} + explicit OffloadEntryInfoDeviceFunction(bool IsRegistered) + : OffloadEntryInfo(OFFLOAD_ENTRY_INFO_DEVICE_FUNCTION, ~0u, + /*Flags=*/0u), Use enum constants rather than the magical numbers Repository: rC Clang https://reviews.llvm.org/D43026 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42581: [NVPTX] Emit debug info in DWARF-2 by default for Cuda devices.
ABataev added a comment. Thanks, will commit it after the commit of the LLVM part Repository: rC Clang https://reviews.llvm.org/D42581 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D43204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
This revision was automatically updated to reflect the committed changes. Closed by commit rL325145: [OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny (authored by ABataev, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D43204?vs=133910&id=134249#toc Repository: rL LLVM https://reviews.llvm.org/D43204 Files: cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/test/Misc/ast-print-pragmas.cpp cfe/trunk/test/OpenMP/atomic_ast_print.cpp cfe/trunk/test/OpenMP/barrier_ast_print.cpp cfe/trunk/test/OpenMP/cancel_ast_print.cpp cfe/trunk/test/OpenMP/cancellation_point_ast_print.cpp cfe/trunk/test/OpenMP/critical_ast_print.cpp cfe/trunk/test/OpenMP/declare_reduction_ast_print.c cfe/trunk/test/OpenMP/declare_reduction_ast_print.cpp cfe/trunk/test/OpenMP/declare_simd_ast_print.c cfe/trunk/test/OpenMP/declare_simd_ast_print.cpp cfe/trunk/test/OpenMP/declare_target_ast_print.cpp cfe/trunk/test/OpenMP/distribute_ast_print.cpp cfe/trunk/test/OpenMP/distribute_dist_schedule_ast_print.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/distribute_simd_ast_print.cpp cfe/trunk/test/OpenMP/flush_ast_print.cpp cfe/trunk/test/OpenMP/for_ast_print.cpp cfe/trunk/test/OpenMP/for_simd_ast_print.cpp cfe/trunk/test/OpenMP/master_ast_print.cpp cfe/trunk/test/OpenMP/ordered_ast_print.cpp cfe/trunk/test/OpenMP/parallel_ast_print.cpp cfe/trunk/test/OpenMP/parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp cfe/trunk/test/OpenMP/sections_ast_print.cpp cfe/trunk/test/OpenMP/simd_ast_print.cpp cfe/trunk/test/OpenMP/single_ast_print.cpp cfe/trunk/test/OpenMP/target_ast_print.cpp cfe/trunk/test/OpenMP/target_data_ast_print.cpp cfe/trunk/test/OpenMP/target_data_use_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp cfe/trunk/test/OpenMP/target_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_update_ast_print.cpp cfe/trunk/test/OpenMP/task_ast_print.cpp cfe/trunk/test/OpenMP/taskgroup_ast_print.cpp cfe/trunk/test/OpenMP/taskloop_ast_print.cpp cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp cfe/trunk/test/OpenMP/taskwait_ast_print.cpp cfe/trunk/test/OpenMP/taskyield_ast_print.cpp cfe/trunk/test/OpenMP/teams_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_simd_ast_print.cpp cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp cfe/trunk/test/PCH/pragma-loop.cpp cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Index: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp === --- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp +++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp @@ -1368,7 +1368,7 @@ "OS << \"" << Prefix << Spelling; if (Variety == "Pragma") { - OS << " \";\n"; + OS << "\";\n"; OS << "printPrettyPragma(OS, Policy);\n"; OS << "OS << \"\\n\";"; OS << "break;\n"; Index: cfe/trunk/lib/AST/StmtPrinter.cpp === --- cfe/trunk/lib/AST/StmtPrinter.cpp +++ cfe/trunk/lib/AST/StmtPrinter.cpp @@ -1030,36 +1030,36 @@ for (ArrayRef::iterator I = Clauses.begin(), E = Clauses.end(); I != E; ++I) if (*I && !(*I)->isImplicit()) { - Printer.Visit(*I); OS << ' '; + Printer.Visit(*I); } OS
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
This revision was automatically updated to reflect the committed changes. Closed by commit rC325145: [OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny (authored by ABataev, committed by ). Repository: rC Clang https://reviews.llvm.org/D43204 Files: include/clang/Basic/Attr.td lib/AST/StmtPrinter.cpp test/Misc/ast-print-pragmas.cpp test/OpenMP/atomic_ast_print.cpp test/OpenMP/barrier_ast_print.cpp test/OpenMP/cancel_ast_print.cpp test/OpenMP/cancellation_point_ast_print.cpp test/OpenMP/critical_ast_print.cpp test/OpenMP/declare_reduction_ast_print.c test/OpenMP/declare_reduction_ast_print.cpp test/OpenMP/declare_simd_ast_print.c test/OpenMP/declare_simd_ast_print.cpp test/OpenMP/declare_target_ast_print.cpp test/OpenMP/distribute_ast_print.cpp test/OpenMP/distribute_dist_schedule_ast_print.cpp test/OpenMP/distribute_parallel_for_ast_print.cpp test/OpenMP/distribute_parallel_for_simd_ast_print.cpp test/OpenMP/distribute_simd_ast_print.cpp test/OpenMP/flush_ast_print.cpp test/OpenMP/for_ast_print.cpp test/OpenMP/for_simd_ast_print.cpp test/OpenMP/master_ast_print.cpp test/OpenMP/ordered_ast_print.cpp test/OpenMP/parallel_ast_print.cpp test/OpenMP/parallel_for_ast_print.cpp test/OpenMP/parallel_for_simd_ast_print.cpp test/OpenMP/parallel_sections_ast_print.cpp test/OpenMP/sections_ast_print.cpp test/OpenMP/simd_ast_print.cpp test/OpenMP/single_ast_print.cpp test/OpenMP/target_ast_print.cpp test/OpenMP/target_data_ast_print.cpp test/OpenMP/target_data_use_device_ptr_ast_print.cpp test/OpenMP/target_enter_data_ast_print.cpp test/OpenMP/target_exit_data_ast_print.cpp test/OpenMP/target_is_device_ptr_ast_print.cpp test/OpenMP/target_parallel_ast_print.cpp test/OpenMP/target_parallel_for_ast_print.cpp test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp test/OpenMP/target_parallel_for_simd_ast_print.cpp test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp test/OpenMP/target_simd_ast_print.cpp test/OpenMP/target_teams_ast_print.cpp test/OpenMP/target_teams_distribute_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp test/OpenMP/target_teams_distribute_simd_ast_print.cpp test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp test/OpenMP/target_teams_is_device_ptr_ast_print.cpp test/OpenMP/target_update_ast_print.cpp test/OpenMP/task_ast_print.cpp test/OpenMP/taskgroup_ast_print.cpp test/OpenMP/taskloop_ast_print.cpp test/OpenMP/taskloop_simd_ast_print.cpp test/OpenMP/taskwait_ast_print.cpp test/OpenMP/taskyield_ast_print.cpp test/OpenMP/teams_ast_print.cpp test/OpenMP/teams_distribute_ast_print.cpp test/OpenMP/teams_distribute_parallel_for_ast_print.cpp test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp test/OpenMP/teams_distribute_simd_ast_print.cpp test/OpenMP/threadprivate_ast_print.cpp test/PCH/pragma-loop.cpp utils/TableGen/ClangAttrEmitter.cpp Index: utils/TableGen/ClangAttrEmitter.cpp === --- utils/TableGen/ClangAttrEmitter.cpp +++ utils/TableGen/ClangAttrEmitter.cpp @@ -1368,7 +1368,7 @@ "OS << \"" << Prefix << Spelling; if (Variety == "Pragma") { - OS << " \";\n"; + OS << "\";\n"; OS << "printPrettyPragma(OS, Policy);\n"; OS << "OS << \"\\n\";"; OS << "break;\n"; Index: test/Misc/ast-print-pragmas.cpp === --- test/Misc/ast-print-pragmas.cpp +++ test/Misc/ast-print-pragmas.cpp @@ -4,7 +4,7 @@ // FIXME: A bug in ParsedAttributes causes the order of the attributes to be // reversed. The checks are consequently in the reverse order below. -// CHECK: #pragma clang loop interleave_count(8) +// CHECK: #pragma clang loop interleave_count(8){{$}} // CHECK-NEXT: #pragma clang loop vectorize_width(4) void test(int *List, int Length) { @@ -61,7 +61,7 @@ #ifdef MS_EXT #pragma init_seg(compiler) -// MS-EXT: #pragma init_seg (.CRT$XCC) +// MS-EXT: #pragma init_seg (.CRT$XCC){{$}} // MS-EXT-NEXT: int x = 3 __declspec(thread); int __declspec(thread) x = 3; #endif //MS_EXT Index: test/OpenMP/parallel_for_ast_print.cpp === --- test/OpenMP/parallel_for_ast_print.cpp +++ test/OpenMP/parallel_for_ast_print.cpp @@ -39,7 +39,7 @@ } }; -// CHECK: #pragma omp parallel for private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp parallel for private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp parallel for private(this->a) pr
[PATCH] D43513: [OpenMP] Limit reduction support for pragma 'distribute' when combined with pragma 'simd'
ABataev added a comment. Tests? Repository: rC Clang https://reviews.llvm.org/D43513 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43513: [OpenMP] Limit reduction support for pragma 'distribute' when combined with pragma 'simd'
ABataev added a comment. LG Repository: rC Clang https://reviews.llvm.org/D43513 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43625: [OpenMP] Remove implicit data sharing code gen that aims to use device shared memory
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:564 +llvm::Value *FnArgs[] = {ZeroAddr.getPointer(), ZeroAddr.getPointer()}; +emitCall(CGF, Fn, FnArgs); Pass non-null `SourceLocation` here as the last argument Repository: rC Clang https://reviews.llvm.org/D43625 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43660: [OpenMP] Add OpenMP data sharing infrastructure using global memory
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:555 Work.clear(); + WrapperFunctionsMap.clear(); Do we need this? Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:640-641 + GlobalRecordSizeArg); + auto GlobalRecCastAddr = Bld.CreatePointerBitCastOrAddrSpaceCast( + GlobalRecValue, CGF.ConvertTypeForMem(RecTy)->getPointerTo()); + FunctionToGlobalRecPtr.try_emplace(CGF.CurFn, GlobalRecValue); `auto`->`llvm::Value *` Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:863-864 +// - the master thread ID; +emitCall(CGF, W, {Bld.getInt16(/*ParallelLevel=*/0), +getMasterThreadID(CGF)}); 1. Update it to the latest version. And use clang-format! 2. This must be in a separate patch Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:933 /// void *outlined_function, int16_t IsOMPRuntimeInitialized); -llvm::Type *TypeParams[] = {CGM.Int8PtrTy, -CGM.Int16Ty}; +llvm::Type *TypeParams[] = {CGM.Int8PtrTy, CGM.Int16Ty}; llvm::FunctionType *FnTy = Separate patch Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:1101 +llvm::FunctionType *FnTy = +llvm::FunctionType::get(CGM.VoidTy, {}, /*isVarArg*/ false); +RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_end_sharing_variables"); `{}`->`llvm::None` Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:1203-1210 + auto *OutlinedFun = cast( + CGOpenMPRuntime::emitParallelOutlinedFunction( + D, ThreadIDVar, InnermostKind, CodeGen)); + if (!isInSpmdExecutionMode()) { +llvm::Function *WrapperFun = +createDataSharingWrapper(OutlinedFun, D); +WrapperFunctionsMap[OutlinedFun] = WrapperFun; Should it be in this patch? Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.h:324-331 + /// Emit function which wraps the outline parallel region + /// and controls the parameters which are passed to this function. + /// The wrapper ensures that the outlined function is called + /// with the correct arguments when data is shared. + llvm::Function * + createDataSharingWrapper(llvm::Function *OutlinedParallelFn, + const OMPExecutableDirective &D); Do we need this function at all? Repository: rC Clang https://reviews.llvm.org/D43660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33509: [OpenMP] Create COMDAT group for OpenMP offload registration code to avoid multiple copies
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D33509 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev created this revision. If the first parameter of the function is the ImplicitParamDecl codegen automatically marks it as an implicit argument with `this` or `self` pointer. To fix this problem Implicit ThisOrSelfAttr is added. This attribute is used to mark real `this` or `self` pointers only. https://reviews.llvm.org/D33735 Files: include/clang/Basic/Attr.td lib/AST/DeclObjC.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp test/Misc/ast-dump-decl.m test/Misc/pragma-attribute-objc-subject-match-rules.m test/Misc/pragma-attribute-objc.m Index: test/Misc/pragma-attribute-objc.m === --- test/Misc/pragma-attribute-objc.m +++ test/Misc/pragma-attribute-objc.m @@ -63,6 +63,7 @@ - (void)testIm:(int) x { // CHECK-LABEL: ObjCMethodDecl{{.*}}testIm // CHECK-NEXT: ImplicitParamDecl +// CHECK-NEXT: ThisOrSelfAttr // CHECK-NEXT: ImplicitParamDecl // CHECK-NEXT: ParmVarDecl{{.*}} x // CHECK-NEXT: AnnotateAttr{{.*}} "test" Index: test/Misc/pragma-attribute-objc-subject-match-rules.m === --- test/Misc/pragma-attribute-objc-subject-match-rules.m +++ test/Misc/pragma-attribute-objc-subject-match-rules.m @@ -60,16 +60,19 @@ @end // CHECK-OBJC_METHOD: ObjCMethodDecl{{.*}} testInstanceMethod // CHECK-OBJC_METHOD-NEXT: ImplicitParamDecl +// CHECK-OBJC_METHOD-NEXT: ThisOrSelfAttr // CHECK-OBJC_METHOD-NEXT: ImplicitParamDecl // CHECK-OBJC_METHOD-NEXT: CompoundStmt // CHECK-OBJC_METHOD-NEXT: AnnotateAttr{{.*}} "test" // CHECK-OBJC_METHOD: ObjCMethodDecl{{.*}} testClassMethod // CHECK-OBJC_METHOD-NEXT: ImplicitParamDecl +// CHECK-OBJC_METHOD-NEXT: ThisOrSelfAttr // CHECK-OBJC_METHOD-NEXT: ImplicitParamDecl // CHECK-OBJC_METHOD-NEXT: CompoundStmt // CHECK-OBJC_METHOD-NEXT: AnnotateAttr{{.*}} "test" // CHECK-OBJC_METHOD_IS_INSTANCE-LABEL: ObjCMethodDecl{{.*}} testInstanceMethod // CHECK-OBJC_METHOD_IS_INSTANCE-NEXT: ImplicitParamDecl +// CHECK-OBJC_METHOD_IS_INSTANCE-NEXT: ThisOrSelfAttr // CHECK-OBJC_METHOD_IS_INSTANCE-NEXT: ImplicitParamDecl // CHECK-OBJC_METHOD_IS_INSTANCE-NEXT: CompoundStmt // CHECK-OBJC_METHOD_IS_INSTANCE-NEXT: AnnotateAttr{{.*}} "test" Index: test/Misc/ast-dump-decl.m === --- test/Misc/ast-dump-decl.m +++ test/Misc/ast-dump-decl.m @@ -39,6 +39,7 @@ } // CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int' // CHECK-NEXT: ImplicitParamDecl{{.*}} self +// CHECK-NEXT: ThisOrSelfAttr // CHECK-NEXT: ImplicitParamDecl{{.*}} _cmd // CHECK-NEXT: ParmVarDecl{{.*}} i 'int' // CHECK-NEXT: ... Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %it
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev added a comment. In https://reviews.llvm.org/D33735#770288, @aaron.ballman wrote: > Can you help me to understand what problem is being solved with this new > attribute? Under what circumstances would the first argument be an > `ImplicitParamDecl` but not an implicit this or self? For captured regions an outlined function is created, where all parameters are ImplicitParamDecls. And the very first parameter is wrongly treated as 'this' argument of the member function. https://reviews.llvm.org/D33735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev added a comment. In https://reviews.llvm.org/D33735#770333, @rjmccall wrote: > In https://reviews.llvm.org/D33735#770318, @aaron.ballman wrote: > > > In https://reviews.llvm.org/D33735#770296, @ABataev wrote: > > > > > In https://reviews.llvm.org/D33735#770288, @aaron.ballman wrote: > > > > > > > Can you help me to understand what problem is being solved with this > > > > new attribute? Under what circumstances would the first argument be an > > > > `ImplicitParamDecl` but not an implicit this or self? > > > > > > > > > For captured regions an outlined function is created, where all > > > parameters are ImplicitParamDecls. And the very first parameter is > > > wrongly treated as 'this' argument of the member function. > > > > > > Ah, thank you! That makes sense to me, but it begs the question: why an > > attribute rather than a bit on ImplicitParamDecl? > > > I agree: it would make more sense for ImplicitParamDecl to store a Kind that > would always be provided at construction. Ok, will add a field to ImplicitParamDecl, thanks https://reviews.llvm.org/D33735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev updated this revision to Diff 101199. ABataev added a comment. Updates after review https://reviews.llvm.org/D33735 Files: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 @@ -98,3 +98,8 @@ // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ // CHECK-GLOBALS: load i32, i32* @e + +// CHECK-GLOBALS-NOT: DIFlagObjectPointer +// CHECK-1-NOT: DIFlagObjectPointer +// CHECK-2-NOT: DIFlagObjectPointer +// CHECK-3-NOT: DIFlagObjectPointer Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -967,6 +967,7 @@ void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) { VisitVarDecl(D); + Record.push_back(D->isThisOrSelfParam()); Code = serialization::DECL_IMPLICIT_PARAM; } Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/ASTReaderDecl.cpp +++ lib/Serialization/ASTReaderDecl.cpp @@ -1278,6 +1278,7 @@ void ASTDeclReader::VisitImplicitParamDecl(ImplicitParamDecl *PD) { VisitVarDecl(PD); + PD->IsThisOrSelf = Record.readInt(); } void ASTDeclReader::VisitParmVarDecl(ParmVarDecl *PD) { Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -3462,13 +3462,12 @@ unsigned AddressSpace = CGM.getContext().getTargetAddressSpace(VD->getType()); AppendAddressSpaceXDeref(AddressSpace, Expr); - // If this is the first argument and it is implicit then - // give it an object pointer flag. - // FIXME: There has to be a better way to do this, but for static - // functions there won't be an implicit param at arg1 and - // otherwise it is 'self' or 'this'. - if (isa(VD) && ArgNo && *ArgNo == 1) - Flags |= llvm::DINode::FlagObjectPointer; + // If this is the first argument, it is implicit and has ThisOrSelf attribute + // then give it an object pointer flag. + if (ArgNo && *ArgNo == 1) +if (auto *IPD = dyn_cast(VD)) + if (IPD->isThisOrSelfParam()) +Flags |= llvm::DINode::FlagObje
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev updated this revision to Diff 101262. ABataev added a comment. Herald added a subscriber: jholewinski. Added different kinds of ImplicitParamDecl. https://reviews.llvm.org/D33735 Files: include/clang/AST/Decl.h lib/AST/ASTImporter.cpp lib/AST/Decl.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGException.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjC.cpp lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 @@ -98,3 +98,8 @@ // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ // CHECK-GLOBALS: load i32, i32* @e + +// CHECK-GLOBALS-NOT: DIFlagObjectPointer +// CHECK-1-NOT: DIFlagObjectPointer +// CHECK-2-NOT: DIFlagObjectPointer +// CHECK-3-NOT: DIFlagObjectPointer Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -967,6 +967,7 @@ void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) { VisitVarDecl(D); + Record.push_back(D->getParameterKind()); Code = serialization::DECL_IMPLICIT_PARAM; } Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/ASTReaderDecl.cpp +++ lib/Serialization/ASTReaderDecl.cpp @@ -1278,6 +1278,8 @@ void ASTDeclReader::VisitImplicitParamDecl(ImplicitParamDecl *PD) { VisitVarDecl(PD); + PD->ParamKind = + static_cast(Record.readInt()); } void ASTDeclReader::VisitParmVarDecl(ParmVarDecl *PD) { Index: lib/Sema/SemaStmt.cpp === --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -3956,8 +3956,9 @@ DeclContext *DC = CapturedDecl::castToDeclContext(CD); IdentifierInfo *ParamName = &Context.Idents.get("__context"); QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD)); - ImplicitParamDecl *Param -= ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType); +
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev updated this revision to Diff 101402. ABataev added a comment. Added DeclContext parameter to constructors of ImplicitParamDecl class. https://reviews.llvm.org/D33735 Files: include/clang/AST/Decl.h lib/AST/ASTImporter.cpp lib/AST/Decl.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGException.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjC.cpp lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 @@ -98,3 +98,8 @@ // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ // CHECK-GLOBALS: load i32, i32* @e + +// CHECK-GLOBALS-NOT: DIFlagObjectPointer +// CHECK-1-NOT: DIFlagObjectPointer +// CHECK-2-NOT: DIFlagObjectPointer +// CHECK-3-NOT: DIFlagObjectPointer Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -967,6 +967,7 @@ void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) { VisitVarDecl(D); + Record.push_back(D->getParameterKind()); Code = serialization::DECL_IMPLICIT_PARAM; } Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/ASTReaderDecl.cpp +++ lib/Serialization/ASTReaderDecl.cpp @@ -1278,6 +1278,8 @@ void ASTDeclReader::VisitImplicitParamDecl(ImplicitParamDecl *PD) { VisitVarDecl(PD); + PD->ParamKind = + static_cast(Record.readInt()); } void ASTDeclReader::VisitParmVarDecl(ParmVarDecl *PD) { Index: lib/Sema/SemaStmt.cpp === --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -3956,8 +3956,9 @@ DeclContext *DC = CapturedDecl::castToDeclContext(CD); IdentifierInfo *ParamName = &Context.Idents.get("__context"); QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD)); - ImplicitParamDecl *Param -= ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType); + ImplicitPar
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev marked 7 inline comments as done. ABataev added inline comments. Comment at: include/clang/AST/Decl.h:1387 +IPK_CapturedContext, /// Parameter for captured context +IPK_GeneralParam,/// General implicit parameter + }; rjmccall wrote: > I would just call this "Other" and document it as being for kinds of implicit > parameters that we haven't seen a purpose in categorizing yet. (Or you could > just classify them all, I suppose.) > > We can use C++11 features in Clang now, so I would recommend hoisting this > type out of ImplicitParamDecl and making it an enum class. You can then drop > the "IPK_" prefixes. It's hard to classify them, in most cases they just represent some general parameters used for correct codegen of function types and that's it. https://reviews.llvm.org/D33735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev updated this revision to Diff 101571. ABataev marked an inline comment as done. ABataev added a comment. Address John comments. https://reviews.llvm.org/D33735 Files: include/clang/AST/Decl.h lib/AST/ASTImporter.cpp lib/AST/Decl.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGException.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjC.cpp lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 @@ -98,3 +98,8 @@ // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ // CHECK-GLOBALS: load i32, i32* @e + +// CHECK-GLOBALS-NOT: DIFlagObjectPointer +// CHECK-1-NOT: DIFlagObjectPointer +// CHECK-2-NOT: DIFlagObjectPointer +// CHECK-3-NOT: DIFlagObjectPointer Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -915,6 +915,10 @@ Record.push_back(D->isConstexpr()); Record.push_back(D->isInitCapture()); Record.push_back(D->isPreviousDeclInSameBlockScope()); +if (auto *IPD = dyn_cast(D)) + Record.push_back(static_cast(IPD->getParameterKind())); +else + Record.push_back(0); } Record.push_back(D->getLinkageInternal()); @@ -1989,6 +1993,7 @@ Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope + Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local) Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum) Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/ASTReaderDecl.cpp +++ lib/Serialization/ASTReaderDecl.cpp @@ -1229,6 +1229,7 @@
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev added inline comments. Comment at: include/clang/AST/Decl.h:901 +/// member functions. +unsigned ImplicitParamKind : 3; }; aaron.ballman wrote: > It's a bit strange to me that the non-parameter declaration bits now have a > field for implicit parameter information. Why here instead of > `ParmVarDeclBits`? Actually, `ImplicitParamDecl` already uses some bits from the `NonParmVarDeclBitfields`, at least it may be marked as `ARCPseudoStrong` for ObjC. That's why I had to reuse `NonParmVarDeclBitfields` part. Comment at: include/clang/AST/Decl.h:1383 class ImplicitParamDecl : public VarDecl { +public: + /// Defines the kind of the implicit parameter: is this an implicit parameter aaron.ballman wrote: > Rather than use three access specifiers, can you reorder this? > ``` > class ... { > void anchor() override; > > public: > ... > }; > ``` Ok Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3467 ImplicitParamDecl TaskPrivatesArg( - C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, - C.getPointerType(PrivatesQTy).withConst().withRestrict()); + C, C.getPointerType(PrivatesQTy).withConst().withRestrict(), + ImplicitParamDecl::Other); aaron.ballman wrote: > This no longer sets the SourceLocation -- is that intended? Just missed this after some reworks, will return it back https://reviews.llvm.org/D33735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev added inline comments. Comment at: include/clang/AST/Decl.h:901 +/// member functions. +unsigned ImplicitParamKind : 3; }; aaron.ballman wrote: > ABataev wrote: > > aaron.ballman wrote: > > > It's a bit strange to me that the non-parameter declaration bits now have > > > a field for implicit parameter information. Why here instead of > > > `ParmVarDeclBits`? > > Actually, `ImplicitParamDecl` already uses some bits from the > > `NonParmVarDeclBitfields`, at least it may be marked as `ARCPseudoStrong` > > for ObjC. That's why I had to reuse `NonParmVarDeclBitfields` part. > Ew. That's nasty and we should probably fix that (not as part of this patch). > Can you add a FIXME here? Ok, I will add FIXME for `ARCPseudoStrong` and for the `ImplicitParamKind` bitfields https://reviews.llvm.org/D33735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev updated this revision to Diff 101751. ABataev added a comment. Update after review https://reviews.llvm.org/D33735 Files: include/clang/AST/Decl.h lib/AST/ASTImporter.cpp lib/AST/Decl.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGException.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjC.cpp lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 @@ -98,3 +98,8 @@ // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ // CHECK-GLOBALS: load i32, i32* @e + +// CHECK-GLOBALS-NOT: DIFlagObjectPointer +// CHECK-1-NOT: DIFlagObjectPointer +// CHECK-2-NOT: DIFlagObjectPointer +// CHECK-3-NOT: DIFlagObjectPointer Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -915,6 +915,10 @@ Record.push_back(D->isConstexpr()); Record.push_back(D->isInitCapture()); Record.push_back(D->isPreviousDeclInSameBlockScope()); +if (auto *IPD = dyn_cast(D)) + Record.push_back(static_cast(IPD->getParameterKind())); +else + Record.push_back(0); } Record.push_back(D->getLinkageInternal()); @@ -1989,6 +1993,7 @@ Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope + Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local) Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum) Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/ASTReaderDecl.cpp +++ lib/Serialization/ASTReaderDecl.cpp @@ -1229,6 +1229,7 @@ VD->NonParmVarDeclBits.IsConstexpr = Reco
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
ABataev updated this revision to Diff 101908. ABataev added a comment. Removed FIXMEs and corrected comment https://reviews.llvm.org/D33735 Files: include/clang/AST/Decl.h lib/AST/ASTImporter.cpp lib/AST/Decl.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCXXABI.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGException.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjC.cpp lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/CodeGen/captured-statements.c test/CodeGenCXX/captured-statements.cpp Index: test/CodeGenCXX/captured-statements.cpp === --- test/CodeGenCXX/captured-statements.cpp +++ test/CodeGenCXX/captured-statements.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3 @@ -194,3 +194,18 @@ void call_test_captured_linkage() { test_captured_linkage(); } + +// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) +// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial) Index: test/CodeGen/captured-statements.c === --- test/CodeGen/captured-statements.c +++ test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2 @@ -98,3 +98,8 @@ // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ // CHECK-GLOBALS: load i32, i32* @e + +// CHECK-GLOBALS-NOT: DIFlagObjectPointer +// CHECK-1-NOT: DIFlagObjectPointer +// CHECK-2-NOT: DIFlagObjectPointer +// CHECK-3-NOT: DIFlagObjectPointer Index: lib/Serialization/ASTWriterDecl.cpp === --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -915,6 +915,10 @@ Record.push_back(D->isConstexpr()); Record.push_back(D->isInitCapture()); Record.push_back(D->isPreviousDeclInSameBlockScope()); +if (auto *IPD = dyn_cast(D)) + Record.push_back(static_cast(IPD->getParameterKind())); +else + Record.push_back(0); } Record.push_back(D->getLinkageInternal()); @@ -1989,6 +1993,7 @@ Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope + Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local) Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum) Index: lib/Serialization/ASTReaderDecl.cpp === --- lib/Serialization/ASTReaderDecl.cpp +++ lib/Serialization/ASTReaderDecl.cpp @@ -1229,6 +1229,7 @@ VD->NonParmVarDeclBits.I
[PATCH] D33735: [DebugInfo] Add ThisOrSelf attribute for emission of FlagObjectPointer.
This revision was automatically updated to reflect the committed changes. Closed by commit rL305075: [DebugInfo] Add kind of ImplicitParamDecl for emission of FlagObjectPointer. (authored by ABataev). Changed prior to commit: https://reviews.llvm.org/D33735?vs=101908&id=102024#toc Repository: rL LLVM https://reviews.llvm.org/D33735 Files: cfe/trunk/include/clang/AST/Decl.h cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/lib/AST/Decl.cpp cfe/trunk/lib/AST/DeclObjC.cpp cfe/trunk/lib/CodeGen/CGBlocks.cpp cfe/trunk/lib/CodeGen/CGCXXABI.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDeclCXX.cpp cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CGExpr.cpp cfe/trunk/lib/CodeGen/CGObjC.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp cfe/trunk/test/CodeGen/captured-statements.c cfe/trunk/test/CodeGenCXX/captured-statements.cpp Index: cfe/trunk/include/clang/AST/Decl.h === --- cfe/trunk/include/clang/AST/Decl.h +++ cfe/trunk/include/clang/AST/Decl.h @@ -851,6 +851,7 @@ class NonParmVarDeclBitfields { friend class VarDecl; +friend class ImplicitParamDecl; friend class ASTDeclReader; unsigned : NumVarDeclBits; @@ -894,6 +895,10 @@ /// declared in the same block scope. This controls whether we should merge /// the type of this declaration with its previous declaration. unsigned PreviousDeclInSameBlockScope : 1; + +/// Defines kind of the ImplicitParamDecl: 'this', 'self', 'vtt', '_cmd' or +/// something else. +unsigned ImplicitParamKind : 3; }; union { @@ -1376,20 +1381,50 @@ class ImplicitParamDecl : public VarDecl { void anchor() override; + public: + /// Defines the kind of the implicit parameter: is this an implicit parameter + /// with pointer to 'this', 'self', '_cmd', virtual table pointers, captured + /// context or something else. + enum ImplicitParamKind : unsigned { +ObjCSelf,/// Parameter for Objective-C 'self' argument +ObjCCmd, /// Parameter for Objective-C '_cmd' argument +CXXThis, /// Parameter for C++ 'this' argument +CXXVTT, /// Parameter for C++ virtual table pointers +CapturedContext, /// Parameter for captured context +Other, /// Other implicit parameter + }; + + /// Create implicit parameter. static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, - QualType T); + QualType T, ImplicitParamKind ParamKind); + static ImplicitParamDecl *Create(ASTContext &C, QualType T, + ImplicitParamKind ParamKind); static ImplicitParamDecl *CreateDeserialized(ASTContext &C, unsigned ID); ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, -IdentifierInfo *Id, QualType Type) -: VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type, - /*tinfo*/ nullptr, SC_None) { +IdentifierInfo *Id, QualType Type, +ImplicitParamKind ParamKind) + : VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type, +/*TInfo=*/nullptr, SC_None) { +NonParmVarDeclBits.ImplicitParamKind = ParamKind; setImplicit(); } + ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind) + : VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(), +SourceLocation(), /*Id=*/nullptr, Type, +/*TInfo=*/nullptr, SC_None) { +NonParmVarDeclBits.ImplicitParamKind = ParamKind; +setImplicit(); + } + + /// Returns the implicit parameter kind. + ImplicitParamKind getParameterKind() const { +return static_cast(NonParmVarDeclBits.ImplicitParamKind); + } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classofKind(Kind K) { return K == ImplicitParam; } Index: cfe/trunk/test/CodeGen/captured-statements.c === --- cfe/trunk/test/CodeGen/captured-statements.c +++ cfe/trunk/test/CodeGen/captured-statements.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS // RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1 // RUN: FileCheck %s -input-fil
[PATCH] D39457: [OPENMP] Current status of OpenMP support.
ABataev updated this revision to Diff 128238. ABataev added a comment. Updated status of `target (update|enter data|exit data)` directives. Marked that support for cuda devices is not ready yet. Repository: rC Clang https://reviews.llvm.org/D39457 Files: docs/OpenMPSupport.rst docs/index.rst Index: docs/index.rst === --- docs/index.rst +++ docs/index.rst @@ -39,6 +39,7 @@ SourceBasedCodeCoverage Modules MSVCCompatibility + OpenMPSupport ThinLTO CommandGuide/index FAQ Index: docs/OpenMPSupport.rst === --- /dev/null +++ docs/OpenMPSupport.rst @@ -0,0 +1,68 @@ +.. raw:: html + + +.none { background-color: #FF } +.partial { background-color: #99 } +.good { background-color: #CCFF99 } + + +.. role:: none +.. role:: partial +.. role:: good + +== +OpenMP Support +== + +Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64 and PPC64[LE] devices. +Support for Cuda devices is not ready yet. +The status of major OpenMP 4.5 features support in Clang. + +Standalone directives += + +* #pragma omp [for] simd: :good:`Complete`. + +* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic + analysis + generation of special attributes for X86 target, but still + missing the LLVM pass for vectorization. + +* #pragma omp taskloop [simd]: :good:`Complete`. + +* #pragma omp target [enter|exit] data: :good:`Complete`. + +* #pragma omp target update: :good:`Complete`. + +* #pragma omp target: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp declare target: :partial:`Partial`. No full codegen support. + +* #pragma omp teams: :good:`Complete`. + +* #pragma omp distribute [simd]: :good:`Complete`. + +* #pragma omp distribute parallel for [simd]: :good:`Complete`. + +Combined directives +=== + +* #pragma omp parallel for simd: :good:`Complete`. + +* #pragma omp target parallel: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target parallel for [simd]: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target simd: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target teams: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp teams distribute [simd]: :good:`Complete`. + +* #pragma omp target teams distribute [simd]: :partial:`Partial`. No support for the and `depend` clauses. + +* #pragma omp teams distribute parallel for [simd]: :good:`Complete`. + +* #pragma omp target teams distribute parallel for [simd]: :partial:`Partial`. No full codegen support. + +Clang does not support any constructs/updates from upcoming OpenMP 5.0 except for `reduction`-based clauses in the `task` and `target`-based directives. + Index: docs/index.rst === --- docs/index.rst +++ docs/index.rst @@ -39,6 +39,7 @@ SourceBasedCodeCoverage Modules MSVCCompatibility + OpenMPSupport ThinLTO CommandGuide/index FAQ Index: docs/OpenMPSupport.rst === --- /dev/null +++ docs/OpenMPSupport.rst @@ -0,0 +1,68 @@ +.. raw:: html + + +.none { background-color: #FF } +.partial { background-color: #99 } +.good { background-color: #CCFF99 } + + +.. role:: none +.. role:: partial +.. role:: good + +== +OpenMP Support +== + +Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64 and PPC64[LE] devices. +Support for Cuda devices is not ready yet. +The status of major OpenMP 4.5 features support in Clang. + +Standalone directives += + +* #pragma omp [for] simd: :good:`Complete`. + +* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic + analysis + generation of special attributes for X86 target, but still + missing the LLVM pass for vectorization. + +* #pragma omp taskloop [simd]: :good:`Complete`. + +* #pragma omp target [enter|exit] data: :good:`Complete`. + +* #pragma omp target update: :good:`Complete`. + +* #pragma omp target: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp declare target: :partial:`Partial`. No full codegen support. + +* #pragma omp teams: :good:`Complete`. + +* #pragma omp distribute [simd]: :good:`Complete`. + +* #pragma omp distribute parallel for [simd]: :good:`Complete`. + +Combined directives +=== + +* #pragma omp parallel for simd: :good:`Complete`. + +* #pragma omp target parallel: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target parallel for [simd]: :partial:`Partial`. No support for the `depend` clauses. +
[PATCH] D41709: [OpenMP] Initial implementation of code generation for pragma 'target teams distribute parallel for' on host
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D41709 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31417: [OpenMP] Add support for omp simd pragmas without runtime
ABataev added a comment. I think we can abandon this one as support for -fopenmp-simd was committed already? https://reviews.llvm.org/D31417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39457: [OPENMP] Current status of OpenMP support.
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rC322018: [OPENMP] Current status of OpenMP support. (authored by ABataev, committed by ). Changed prior to commit: https://reviews.llvm.org/D39457?vs=128238&id=128957#toc Repository: rC Clang https://reviews.llvm.org/D39457 Files: docs/OpenMPSupport.rst docs/index.rst Index: docs/OpenMPSupport.rst === --- docs/OpenMPSupport.rst +++ docs/OpenMPSupport.rst @@ -0,0 +1,68 @@ +.. raw:: html + + +.none { background-color: #FF } +.partial { background-color: #99 } +.good { background-color: #CCFF99 } + + +.. role:: none +.. role:: partial +.. role:: good + +== +OpenMP Support +== + +Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64 and PPC64[LE] devices. +Support for Cuda devices is not ready yet. +The status of major OpenMP 4.5 features support in Clang. + +Standalone directives += + +* #pragma omp [for] simd: :good:`Complete`. + +* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic + analysis + generation of special attributes for X86 target, but still + missing the LLVM pass for vectorization. + +* #pragma omp taskloop [simd]: :good:`Complete`. + +* #pragma omp target [enter|exit] data: :good:`Complete`. + +* #pragma omp target update: :good:`Complete`. + +* #pragma omp target: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp declare target: :partial:`Partial`. No full codegen support. + +* #pragma omp teams: :good:`Complete`. + +* #pragma omp distribute [simd]: :good:`Complete`. + +* #pragma omp distribute parallel for [simd]: :good:`Complete`. + +Combined directives +=== + +* #pragma omp parallel for simd: :good:`Complete`. + +* #pragma omp target parallel: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target parallel for [simd]: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target simd: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target teams: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp teams distribute [simd]: :good:`Complete`. + +* #pragma omp target teams distribute [simd]: :partial:`Partial`. No support for the and `depend` clauses. + +* #pragma omp teams distribute parallel for [simd]: :good:`Complete`. + +* #pragma omp target teams distribute parallel for [simd]: :partial:`Partial`. No full codegen support. + +Clang does not support any constructs/updates from upcoming OpenMP 5.0 except for `reduction`-based clauses in the `task` and `target`-based directives. + Index: docs/index.rst === --- docs/index.rst +++ docs/index.rst @@ -39,6 +39,7 @@ SourceBasedCodeCoverage Modules MSVCCompatibility + OpenMPSupport ThinLTO CommandGuide/index FAQ Index: docs/OpenMPSupport.rst === --- docs/OpenMPSupport.rst +++ docs/OpenMPSupport.rst @@ -0,0 +1,68 @@ +.. raw:: html + + +.none { background-color: #FF } +.partial { background-color: #99 } +.good { background-color: #CCFF99 } + + +.. role:: none +.. role:: partial +.. role:: good + +== +OpenMP Support +== + +Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64 and PPC64[LE] devices. +Support for Cuda devices is not ready yet. +The status of major OpenMP 4.5 features support in Clang. + +Standalone directives += + +* #pragma omp [for] simd: :good:`Complete`. + +* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic + analysis + generation of special attributes for X86 target, but still + missing the LLVM pass for vectorization. + +* #pragma omp taskloop [simd]: :good:`Complete`. + +* #pragma omp target [enter|exit] data: :good:`Complete`. + +* #pragma omp target update: :good:`Complete`. + +* #pragma omp target: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp declare target: :partial:`Partial`. No full codegen support. + +* #pragma omp teams: :good:`Complete`. + +* #pragma omp distribute [simd]: :good:`Complete`. + +* #pragma omp distribute parallel for [simd]: :good:`Complete`. + +Combined directives +=== + +* #pragma omp parallel for simd: :good:`Complete`. + +* #pragma omp target parallel: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target parallel for [simd]: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target simd: :partial:`Partial`. No support for the `depend` clauses. + +*
[PATCH] D41841: [OpenMP] Fix handling of clause on wrong directive
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D41841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41841: [OpenMP] Fix handling of clause on wrong directive
ABataev added a comment. In https://reviews.llvm.org/D41841#971375, @jdenny wrote: > Alexey: Thanks for accepting. I do not have commit privileges. Would > you please commit for me? Sure https://reviews.llvm.org/D41841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41841: [OpenMP] Fix handling of clause on wrong directive
This revision was automatically updated to reflect the committed changes. Closed by commit rL322107: [OpenMP] Fix handling of clause on wrong directive, by Joel. E. Denny (authored by ABataev, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41841?vs=128993&id=129132#toc Repository: rL LLVM https://reviews.llvm.org/D41841 Files: cfe/trunk/include/clang/Parse/Parser.h cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp cfe/trunk/test/OpenMP/for_misc_messages.c cfe/trunk/test/OpenMP/parallel_messages.cpp cfe/trunk/test/OpenMP/simd_loop_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_messages.cpp cfe/trunk/test/OpenMP/taskloop_loop_messages.cpp Index: cfe/trunk/include/clang/Parse/Parser.h === --- cfe/trunk/include/clang/Parse/Parser.h +++ cfe/trunk/include/clang/Parse/Parser.h @@ -2675,30 +2675,42 @@ /// \brief Parses clause with a single expression of a kind \a Kind. /// /// \param Kind Kind of current clause. + /// \param ParseOnly true to skip the clause's semantic actions and return + /// nullptr. /// - OMPClause *ParseOpenMPSingleExprClause(OpenMPClauseKind Kind); + OMPClause *ParseOpenMPSingleExprClause(OpenMPClauseKind Kind, + bool ParseOnly); /// \brief Parses simple clause of a kind \a Kind. /// /// \param Kind Kind of current clause. + /// \param ParseOnly true to skip the clause's semantic actions and return + /// nullptr. /// - OMPClause *ParseOpenMPSimpleClause(OpenMPClauseKind Kind); + OMPClause *ParseOpenMPSimpleClause(OpenMPClauseKind Kind, bool ParseOnly); /// \brief Parses clause with a single expression and an additional argument /// of a kind \a Kind. /// /// \param Kind Kind of current clause. + /// \param ParseOnly true to skip the clause's semantic actions and return + /// nullptr. /// - OMPClause *ParseOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind); + OMPClause *ParseOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, +bool ParseOnly); /// \brief Parses clause without any additional arguments. /// /// \param Kind Kind of current clause. + /// \param ParseOnly true to skip the clause's semantic actions and return + /// nullptr. /// - OMPClause *ParseOpenMPClause(OpenMPClauseKind Kind); + OMPClause *ParseOpenMPClause(OpenMPClauseKind Kind, bool ParseOnly = false); /// \brief Parses clause with the list of variables of a kind \a Kind. /// /// \param Kind Kind of current clause. + /// \param ParseOnly true to skip the clause's semantic actions and return + /// nullptr. /// OMPClause *ParseOpenMPVarListClause(OpenMPDirectiveKind DKind, - OpenMPClauseKind Kind); + OpenMPClauseKind Kind, bool ParseOnly); public: /// Parses simple expression in parens for single-expression clauses of OpenMP Index: cfe/trunk/test/OpenMP/taskloop_loop_messages.cpp === --- cfe/trunk/test/OpenMP/taskloop_loop_messages.cpp +++ cfe/trunk/test/OpenMP/taskloop_loop_messages.cpp @@ -294,10 +294,8 @@ c[ii] = a[ii]; #pragma omp parallel -// expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp taskloop'}} -// expected-note@+1 {{defined as linear}} +// expected-error@+1 {{unexpected OpenMP clause 'linear' in directive '#pragma omp taskloop'}} #pragma omp taskloop linear(ii) -// expected-error@+1 {{loop iteration variable in the associated loop of 'omp taskloop' directive may not be linear, predetermined as private}} for (ii = 0; ii < 10; ii++) c[ii] = a[ii]; Index: cfe/trunk/test/OpenMP/for_misc_messages.c === --- cfe/trunk/test/OpenMP/for_misc_messages.c +++ cfe/trunk/test/OpenMP/for_misc_messages.c @@ -54,6 +54,20 @@ #pragma omp for foo bar for (i = 0; i < 16; ++i) ; +// At one time, this failed an assert. +// expected-error@+1 {{unexpected OpenMP clause 'num_teams' in directive '#pragma omp for'}} +#pragma omp for num_teams(3) + for (i = 0; i < 16; ++i) +; +// At one time, this error was reported twice. +// expected-error@+1 {{unexpected OpenMP clause 'uniform' in directive '#pragma omp for'}} +#pragma omp for uniform + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{unexpected OpenMP clause 'if' in directive '#pragma omp for'}} +#pragma omp for if(0) + for (i = 0; i < 16; ++i) +; } void test_non_identifiers() { Index: cfe/trunk/test/OpenMP/simd_loop_messages.cpp === --- cfe/trunk/test/OpenMP/simd_loop_messages.cpp +++ cfe/trunk/test/OpenMP/simd_loop_messages.cpp @@ -236,9 +236,7 @@ for (ii = 0;
[PATCH] D43852: [OpenMP] Extend NVPTX SPMD implementation of combined constructs
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG, with some nits Comment at: include/clang/Driver/Options.td:1428 +def fopenmp_cuda_mode : Flag<["-"], "fopenmp-cuda-mode">, Group, Flags<[CC1Option, NoArgumentUnused]>; +def fno_openmp_cuda_mode : Flag<["-"], "fno-openmp-cuda-mode">, Group, Flags<[NoArgumentUnused]>; def fno_optimize_sibling_calls : Flag<["-"], "fno-optimize-sibling-calls">, Group; This flag also must be `CC1Option` Comment at: lib/Frontend/CompilerInvocation.cpp:2533 + Args.hasFlag(OPT_fopenmp_cuda_mode, OPT_fno_openmp_cuda_mode, + /*Default=*/false); + After some thoughts I think it is better to make `true` by default, because `Generic` mode is not completed yet. Repository: rC Clang https://reviews.llvm.org/D43852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43852: [OpenMP] Extend NVPTX SPMD implementation of combined constructs
ABataev added inline comments. Comment at: include/clang/Driver/Options.td:1428 +def fopenmp_cuda_mode : Flag<["-"], "fopenmp-cuda-mode">, Group, Flags<[CC1Option, NoArgumentUnused]>; +def fno_openmp_cuda_mode : Flag<["-"], "fno-openmp-cuda-mode">, Group, Flags<[NoArgumentUnused]>; def fno_optimize_sibling_calls : Flag<["-"], "fno-optimize-sibling-calls">, Group; ABataev wrote: > This flag also must be `CC1Option` If you implement Jonas's suggested fix, no need to mark it as `CC1Option` Comment at: lib/Driver/ToolChains/Clang.cpp:3976-3977 + // cuda-mode flag + Args.AddLastArg(CmdArgs, options::OPT_fopenmp_cuda_mode, + options::OPT_fno_openmp_cuda_mode); break; Hahnfeld wrote: > I think most other boolean options do the following: > ```lang=c++ > if (Args.hasFlag(...)) > CmdArgs.push_back("...") > ``` > > Is there a reason we need this differently here? Agree, this looks much better Comment at: lib/Frontend/CompilerInvocation.cpp:2533 + Args.hasFlag(OPT_fopenmp_cuda_mode, OPT_fno_openmp_cuda_mode, + /*Default=*/false); + Hahnfeld wrote: > ABataev wrote: > > After some thoughts I think it is better to make `true` by default, because > > `Generic` mode is not completed yet. > Yes, I'd also expect all SPMD constructs to default to CUDA mode. Or is there > a case where this doesn't work? If yes, that should be explained in the > summary. Cuda mode is going to be the default for all constructs, as `Generic` mode is not ready yet. The codegen mode is not controlled by the construct, but by the option completely. Repository: rC Clang https://reviews.llvm.org/D43852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43660: [OpenMP] Add OpenMP data sharing infrastructure using global memory
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D43660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43625: [OpenMP] Remove implicit data sharing code gen that aims to use device shared memory
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D43625 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
ABataev added inline comments. Comment at: lib/Driver/ToolChains/Cuda.cpp:535 +SmallVector LibraryPaths; +if (char *env = ::getenv("LIBRARY_PATH")) { + StringRef CompilerPath = env; 1. `char *`->`const char *` 2. `::getenv`->`llvm::Process::GetEnv` Comment at: lib/Driver/ToolChains/Cuda.cpp:539 +std::pair Split = +CompilerPath.split(llvm::sys::EnvPathSeparator); +LibraryPaths.push_back(Split.first); Use `llvm::SplitString` instead Comment at: lib/Driver/ToolChains/Cuda.cpp:548 +bool FoundBCLibrary = false; +for (std::string LibraryPath : LibraryPaths) { + SmallString<128> LibOmpTargetFile(LibraryPath); `const std::string &` Repository: rC Clang https://reviews.llvm.org/D43197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
ABataev added inline comments. Comment at: lib/Driver/ToolChains/Cuda.cpp:591 +llvm::sys::path::append(DefaultLibPath, "lib" CLANG_LIBDIR_SUFFIX); +LibraryPaths.emplace_back(DriverArgs.MakeArgString(DefaultLibPath)); + Maybe just `LibraryPaths.emplace_back(DefaultLibPath);`? Comment at: lib/Driver/ToolChains/Cuda.cpp:598 + llvm::SplitString(*LibPath, Frags, + StringRef(&(llvm::sys::EnvPathSeparator))); + for (auto Path : Frags) Wow, never do such things! This is a pointer to non-null terminated string. Instead ``` const char EnvPathSeparatorStr[] = {EnvPathSeparator, '\0'}; ``` And use this array as a separator. Repository: rC Clang https://reviews.llvm.org/D43197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
ABataev added inline comments. Comment at: include/clang/Basic/DiagnosticDriverKinds.td:207-208 +def remark_drv_omp_offload_target_missingbcruntime : Warning< + "Expect degraded performance on the target device due to missing '%0' in LIBRARY_PATH.">, + InGroup; def err_drv_bitcode_unsupported_on_toolchain : Error< Fix the message in the warning, it does not follow the logic of the patch Comment at: lib/Driver/ToolChains/Cuda.cpp:586 + if (DeviceOffloadingKind == Action::OFK_OpenMP) { +SmallVector LibraryPaths; +// Add path to lib and/or lib64 folders. Do you really need `std::string` here? Or StringRef is enough? Repository: rC Clang https://reviews.llvm.org/D43197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43660: [OpenMP] Add OpenMP data sharing infrastructure using global memory
ABataev accepted this revision. ABataev added a comment. LG Repository: rC Clang https://reviews.llvm.org/D43660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
ABataev added inline comments. Comment at: lib/Driver/ToolChains/Cuda.cpp:592 +Twine("lib") + CLANG_LIBDIR_SUFFIX); +LibraryPaths.emplace_back(DefaultLibPath.c_str()); + Do you still need `.c_str()` here? Comment at: test/Driver/openmp-offload-gpu.c:150 +/// bitcode library and add it to the LIBRARY_PATH. +// RUN: touch %T/libomptarget-nvptx-sm_60.bc +// RUN: env LIBRARY_PATH=%T %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \ Create empty `libomptarget-nvptx-sm_60.bc` in `Driver/lib` directory and use it in the test rather create|delete it dynamically. Repository: rC Clang https://reviews.llvm.org/D43197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
ABataev added inline comments. Comment at: lib/Driver/ToolChains/Cuda.cpp:595-596 +// Add user defined library paths from LIBRARY_PATH. +if (llvm::Optional LibPath = + llvm::sys::Process::GetEnv("LIBRARY_PATH")) { + SmallVector Frags; Move the definition of `LibPath` out of `if` statement scope. Comment at: lib/Driver/ToolChains/Cuda.cpp:600 + llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr); + for (auto Path : Frags) +LibraryPaths.emplace_back(Path.trim()); `auto`->`StringRef` Comment at: lib/Driver/ToolChains/Cuda.cpp:607 +bool FoundBCLibrary = false; +for (const std::string &LibraryPath : LibraryPaths) { + SmallString<128> LibOmpTargetFile(LibraryPath); `const std::string &`->`StringRef` Repository: rC Clang https://reviews.llvm.org/D43197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
ABataev accepted this revision. ABataev added a comment. LG Repository: rC Clang https://reviews.llvm.org/D43197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44541: [OpenMP][Clang] Move device global stack init before master-workers split
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D44541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44588: [OpenMP][Clang] Pass global thread ID to outlined function
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. Tests? Repository: rC Clang https://reviews.llvm.org/D44588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls
ABataev added a comment. Add tests for C++ and move OpenMP specific tests to OpenMP directory Comment at: lib/Headers/__clang_cuda_device_functions.h:28 +#if defined(_OPENMP) +#include <__clang_cuda_libdevice_declares.h> +#include Do we really need to include all that stuff here? Will it work with C++, especially with the latest versions of the standard? Comment at: lib/Headers/__clang_cuda_device_functions.h:44 +#elif defined(_OPENMP) +#define __DEVICE__ static __inline__ __attribute__((always_inline)) +#endif Do you really need "__inline__" if you are using 'alwsys_inline' attribute already? Will it work on Windows? Repository: rC Clang https://reviews.llvm.org/D47849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53079: [OPENMP] Add 'dynamic_allocators' clause to OMP5.0 'requires' directive
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D53079 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51554: [CUDA][OPENMP][NVPTX]Improve logic of the debug info support.
ABataev added a comment. Ping! Repository: rC Clang https://reviews.llvm.org/D51554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53395: [OPENMP] Move OMPClausePrinter to OpenMPClause.h/OpenMPClause.cpp - NFC
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D53395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53443: [OpenMP][NVPTX] Enable default scheduling for parallel for in non-SPMD cases.
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.h:350 void getDefaultScheduleAndChunk(CodeGenFunction &CGF, - const OMPLoopDirective &S, OpenMPScheduleClauseKind &ScheduleKind, + const OMPLoopDirective &S, OpenMPScheduleTy &ScheduleKind, llvm::Value *&Chunk) const override; Why do you need to change the type of the parameter? Repository: rC Clang https://reviews.llvm.org/D53443 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53513: [OPENMP] Add support for 'atomic_default_mem_order' clause on requires directive
ABataev added a comment. Check the code formatting, please. There should be lines longer than 80 symbols. Comment at: clang/include/clang/AST/OpenMPClause.h:886 + /// \param K Kind of clause. + void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) { +Kind = K; Check formatting here Comment at: clang/include/clang/AST/OpenMPClause.h:906 + /// \param EndLoc Ending location of the clause. + OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A, + SourceLocation ALoc, SourceLocation StartLoc, Also, formatting Comment at: clang/include/clang/AST/OpenMPClause.h:930 + /// Returns location of clause kind. + SourceLocation getAtomicDefaultMemOrderKindKwLoc() const { return KindKwLoc; } + Again, probably too long line. Repository: rC Clang https://reviews.llvm.org/D53513 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53513: [OPENMP] Add support for 'atomic_default_mem_order' clause on requires directive
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D53513 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53141: [OpenMP][libomptarget] Add runtime function for pushing coalesced global records
ABataev added inline comments. Comment at: libomptarget/deviceRTLs/nvptx/src/data_sharing.cu:389 unsigned WID = getWarpId(); + // void * volatile FramePointer = 0; void *&FrameP = DataSharingState.FramePtr[WID]; This must be removed Comment at: libomptarget/deviceRTLs/nvptx/src/data_sharing.cu:438 +// point to the start of the new frame held in StackP. +//atomicExch((unsigned long long *)&FrameP, (unsigned long long)StackP); +FrameP = StackP; Also, must be removed Comment at: libomptarget/deviceRTLs/nvptx/src/data_sharing.cu:444 +} + } while (!FrameP); It is a very bad idea to have something like this without atomic instructions. Also, for writing, you need to use atomic instructions (+, possibly, `volatile` data type). Otherwise, it leads to undefined behavior and problems during optimization. Repository: rOMP OpenMP https://reviews.llvm.org/D53141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53443: [OpenMP][NVPTX] Enable default scheduling for parallel for in non-SPMD cases.
ABataev added a comment. What about tests? Repository: rC Clang https://reviews.llvm.org/D53443 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53448: [OpenMP][NVPTX] Use single loops when generating code for distribute parallel for
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntime.h:904 + /// + virtual bool isStaticChunked(OpenMPDistScheduleClauseKind ScheduleKind, + bool Chunked) const; I'd rename this into `isDistStaticChunked` Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:4249 CodeGenFunction &CGF, const OMPLoopDirective &S, -OpenMPScheduleClauseKind &ScheduleKind, +OpenMPScheduleTy &ScheduleKind, llvm::Value *&Chunk) const { If the `ChunkOne` field is not required, you need to restore original code here Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2360 OMPCancelStack.emitExit(*this, S.getDirectiveKind(), CodeGen); + } else if (RT.isStaticChunked(ScheduleKind.Schedule, +/* Chunked */ Chunk != nullptr) && This whole code is very similar to the unchunked case. Could you merge it? Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2362 +/* Chunked */ Chunk != nullptr) && + ScheduleKind.HasChunkOne && + isOpenMPLoopBoundSharingDirective(S.getDirectiveKind())) { It allows you to check only the implicit case, what about if the user explicitly specifies that `chunk` is `1`? Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3421 RT.emitForStaticFinish(*this, S.getBeginLoc(), S.getDirectiveKind()); + } else if (RT.isStaticChunked(ScheduleKind, +/* Chunked */ Chunk != nullptr) && Again, very similar to the unchunked code. Merge it. Comment at: lib/Sema/SemaOpenMP.cpp:5207 +CombDistCond = +SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), LastIteration.get()); + } Seems to me, you need to use `NumIterations` instead of `LastIteration` Repository: rC Clang https://reviews.llvm.org/D53448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53636: Do not always request an implicit taskgroup region inside the kmpc_taskloop function
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D53636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53636: Do not always request an implicit taskgroup region inside the kmpc_taskloop function
ABataev added a comment. In https://reviews.llvm.org/D53636#1274673, @smateo wrote: > Hi Alexey, > > Thanks for the prompt review! > > I don't have commit access yet, do you mind to commit it for me? > > Thanks! Sure, no problems, thanks for the patch! Repository: rC Clang https://reviews.llvm.org/D53636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53636: Do not always request an implicit taskgroup region inside the kmpc_taskloop function
This revision was automatically updated to reflect the committed changes. Closed by commit rC345180: Do not always request an implicit taskgroup region inside the kmpc_taskloop… (authored by ABataev, committed by ). Repository: rC Clang https://reviews.llvm.org/D53636 Files: lib/CodeGen/CGOpenMPRuntime.cpp test/OpenMP/taskloop_codegen.cpp test/OpenMP/taskloop_firstprivate_codegen.cpp test/OpenMP/taskloop_lastprivate_codegen.cpp test/OpenMP/taskloop_private_codegen.cpp test/OpenMP/taskloop_reduction_codegen.cpp test/OpenMP/taskloop_simd_codegen.cpp test/OpenMP/taskloop_simd_firstprivate_codegen.cpp test/OpenMP/taskloop_simd_lastprivate_codegen.cpp test/OpenMP/taskloop_simd_private_codegen.cpp test/OpenMP/taskloop_simd_reduction_codegen.cpp Index: test/OpenMP/taskloop_simd_private_codegen.cpp === --- test/OpenMP/taskloop_simd_private_codegen.cpp +++ test/OpenMP/taskloop_simd_private_codegen.cpp @@ -65,7 +65,7 @@ // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 -// LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) +// LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* null) // LAMBDA: ret #pragma omp taskloop simd private(g, sivar) for (int i = 0; i < 10; ++i) { @@ -101,7 +101,7 @@ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 - // BLOCKS: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) + // BLOCKS: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* null) // BLOCKS: ret #pragma omp taskloop simd private(g, sivar) for (int i = 0; i < 10; ++i) { @@ -193,7 +193,7 @@ // CHECK: store i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[DESTRUCTORS:@.+]] to i32 (i32, i8*)*), i32 (i32, i8*)** [[DESTRUCTORS_PTR]], // Start task. -// CHECK: call void @__kmpc_taskloop([[LOC]], i32 [[GTID]], i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_MAIN_TY]]*, [[KMP_TASK_MAIN_TY]]*, i32)* [[MAIN_DUP:@.+]] to i8*)) +// CHECK: call void @__kmpc_taskloop([[LOC]], i32 [[GTID]], i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_MAIN_TY]]*, [[KMP_TASK_MAIN_TY]]*, i32)* [[MAIN_DUP:@.+]] to i8*)) // CHECK: call i32 @__kmpc_omp_task([[LOC]], i32 [[GTID]], i8* // CHECK: = call i{{.+}} [[TMAIN_INT:@.+]]() @@ -324,7 +324,7 @@ // CHECK: store i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_TMAIN_TY]]*)* [[DESTRUCTORS:@.+]] to i32 (i32, i8*)*), i32 (i32, i8*)** [[DESTRUCTORS_PTR]], // Start task. -// CHECK: call void @__kmpc_taskloop([[LOC]], i32 [[GTID]], i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_TMAIN_TY]]*, [[KMP_TASK_TMAIN_TY]]*, i32)* [[TMAIN_DUP:@.+]] to i8*)) +// CHECK: call void @__kmpc_taskloop([[LOC]], i32 [[GTID]], i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_TMAIN_TY]]*, [[KMP_TASK_TMAIN_TY]]*, i32)* [[TMAIN_DUP:@.+]] to i8*)) // No destructors must be called for private copies of s_arr and var. // CHECK-NOT: getelementptr inbounds [[PRIVATES_TMAIN_TY]], [[PRIVATES_TMAIN_TY]]* [[PRIVATES]], i{{.+}} 0, i{{.+}} 2 Index: test/OpenMP/taskloop_private_codegen.cpp === --- test/OpenMP/taskloop_private_codegen.cpp +++ test/OpenMP/taskloop_private_codegen.cpp @@ -65,7 +65,7 @@ // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 -// LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}
[PATCH] D53448: [OpenMP][NVPTX] Use single loops when generating code for distribute parallel for
ABataev added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntime.h:904 + /// + virtual bool isStaticChunked(OpenMPDistScheduleClauseKind ScheduleKind, + bool Chunked) const; gtbercea wrote: > ABataev wrote: > > I'd rename this into `isDistStaticChunked` > I've used the same naming convention as the isStaticNonchunked function for > consistency. What about this? Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2360 OMPCancelStack.emitExit(*this, S.getDirectiveKind(), CodeGen); + } else if (RT.isStaticChunked(ScheduleKind.Schedule, +/* Chunked */ Chunk != nullptr) && ABataev wrote: > This whole code is very similar to the unchunked case. Could you merge it? What about this? Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3421 RT.emitForStaticFinish(*this, S.getBeginLoc(), S.getDirectiveKind()); + } else if (RT.isStaticChunked(ScheduleKind, +/* Chunked */ Chunk != nullptr) && ABataev wrote: > Again, very similar to the unchunked code. Merge it. ? Comment at: lib/Sema/SemaOpenMP.cpp:5207 +CombDistCond = +SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), LastIteration.get()); + } ABataev wrote: > Seems to me, you need to use `NumIterations` instead of `LastIteration` Add the tests for the collapsed loops. Repository: rC Clang https://reviews.llvm.org/D53448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53448: [OpenMP][NVPTX] Use single loops when generating code for distribute parallel for
ABataev added a comment. What about collapsed loops? Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3390 // UB = min(UB, GlobalUB); -EmitIgnoredExpr(isOpenMPLoopBoundSharingDirective(S.getDirectiveKind()) +EmitIgnoredExpr(StaticChunked || +(!StaticChunked && Restore the original code here, the logic can be simplified Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3396 // IV = LB; -EmitIgnoredExpr(isOpenMPLoopBoundSharingDirective(S.getDirectiveKind()) +EmitIgnoredExpr(StaticChunked || +(!StaticChunked && The same Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3434-3454 +if (StaticChunked) + EmitOMPInnerLoop(S, LoopScope.requiresCleanups(), Cond, IncExpr, + [&S, LoopExit, &CodeGenLoop](CodeGenFunction &CGF) { + CodeGenLoop(CGF, S, LoopExit); + }, + [&S](CodeGenFunction &CGF) { + CGF.EmitIgnoredExpr(S.getCombinedNextLowerBound()); Please, simplify this Repository: rC Clang https://reviews.llvm.org/D53448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53448: [OpenMP][NVPTX] Use single loops when generating code for distribute parallel for
ABataev added inline comments. Comment at: test/OpenMP/distribute_parallel_for_codegen.cpp:410 // LAMBDA-DAG: [[OMP_IV:%.omp.iv]] = alloca + // LAMBDA-DAG: [[OMP_CAPT_EXPR:%.capture_expr.1]] = alloca // LAMBDA-DAG: [[OMP_LB:%.omp.comb.lb]] = alloca Bad check for names, you should not rely on them. Comment at: test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp:117 // CHECK: define {{.*}}void {{@__omp_offloading_.+}}({{.+}}, i{{32|64}} [[F_IN:%.+]]) +// CHECK-DAG: [[OMP_IV:%.omp.iv.i]] = alloca +// CHECK-DAG: [[OMP_LB:%.omp.comb.lb.i]] = alloca Also, bad checks. Repository: rC Clang https://reviews.llvm.org/D53448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53448: [OpenMP][NVPTX] Use single loops when generating code for distribute parallel for
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG, with a nit Comment at: lib/Sema/SemaOpenMP.cpp:5308 + +// Build IV <= PrevEUB to be used in parallel for is in combination with +// a distribute directive with schedule(static, 1) Fix the comment here Repository: rC Clang https://reviews.llvm.org/D53448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53443: [OpenMP][NVPTX] Enable default scheduling for parallel for in non-SPMD cases.
ABataev added inline comments. Comment at: test/OpenMP/nvptx_parallel_for_codegen.cpp:44 +// CHECK: call void @__kmpc_kernel_prepare_parallel( +// CHECK: call void @__kmpc_begin_sharing_variables(i8*** %shared_arg_refs, i64 2) +// CHECK: call void @llvm.nvvm.barrier0() Do not use names of the IR vars, use regular expressions. Repository: rC Clang https://reviews.llvm.org/D53443 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53772: [NFC][OpenMP] Add new test for parallel for code generation.
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D53772 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits