summaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/critical_codegen.cpp
AgeCommit message (Collapse)Author
2024-08-09[IRBuilder] Generate nuw GEPs for struct member accesses (#99538)Hari Limaye
Generate nuw GEPs for struct member accesses, as inbounds + non-negative implies nuw. Regression tests are updated using update scripts where possible, and by find + replace where not.
2022-10-07[OpenMP] Convert tests to opaque pointers (NFC)Nikita Popov
Conversion performed using the script at: https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34 These are only tests where no manual fixup was required.
2022-04-26[OpenMPIRBuilder] Remove ContinuationBB argument from Body callback.Michael Kruse
The callback is expected to create a branch to the ContinuationBB (sometimes called FiniBB in some lambdas) argument when finishing. This creates problems: 1. The InsertPoint used for CodeGenIP does not need to be the end of a block. If it is not, a naive callback will insert a branch instruction into the middle of the block. 2. The BasicBlock the CodeGenIP is pointing to may or may not have a terminator. There is an conflict where to branch to if the block already has a terminator. 3. Some API functions work only with block having a terminator. Some workarounds have been used to insert a temporary terminator that is removed again. 4. Some callbacks are sensitive to whether the BasicBlock has a terminator or not. This creates a callback ordering problem where different callback may have different behaviour depending on whether a previous callback created a terminator or not. The problem also exists for FinalizeCallbackTy where some callbacks do create branch to another "continue" block, but unlike BodyGenCallbackTy does not receive the target as argument. This is not addressed in this patch. With this patch, the callback receives an CodeGenIP into a BasicBlock where to insert instructions. If it has to insert control flow, it can split the block at that position as needed but otherwise no separate ContinuationBB is needed. In particular, a callback can be empty without breaking the emitted IR. If the caller needs the control flow to branch to a specific target, it can insert the branch instruction itself and pass an InsertPoint before the terminator to the callback. Certain frontends such as Clang may expect the current IRBuilder position to be at the end of a basic block. In this case its callbacks must split the block at CodeGenIP before setting the IRBuilder position such that the instructions after CodeGenIP are moved to another basic block and before returning create a new branch instruction to the split block. Some utility functions such as `splitBB` are supporting correct splitting of BasicBlocks, independent of whether they have a terminator or not, returning/setting the InsertPoint of an IRBuilder to the end of split predecessor block, and optionally omitting creating a branch to the split successor block to be added later. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D118409
2022-04-07[OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)Nikita Popov
This adds -no-opaque-pointers to clang tests whose output will change when opaque pointers are enabled by default. This is intended to be part of the migration approach described in https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9. The patch has been produced by replacing %clang_cc1 with %clang_cc1 -no-opaque-pointers for tests that fail with opaque pointers enabled. Worth noting that this doesn't cover all tests, there's a remaining ~40 tests not using %clang_cc1 that will need a followup change. Differential Revision: https://reviews.llvm.org/D123115
2021-03-24[OPENMP]Fix PR48571: critical/master in outlined contexts cause crash.Alexey Bataev
If emit inlined region for master/critical directives, no need to clear lambda/block context data, otherwise the variables cannot be found and it causes a crash at compile time. Differential Revision: https://reviews.llvm.org/D99280
2020-08-07[OPENMP]Simplify representation for atomic, critical, master and sectionAlexey Bataev
constrcut. Several constructs may be represented wityout relying on CapturedStmt. It saves memory and improves compilation speed.
2020-07-15[CodeGen] Emit a call instruction instead of an invoke if the calledAkira Hatanaka
llvm function is marked nounwind This fixes cases where an invoke is emitted, despite the called llvm function being marked nounwind, because ConstructAttributeList failed to add the attribute to the attribute list. llvm optimization passes turn invokes into calls and optimize away the exception handling code, but it's better to avoid emitting the code in the front-end if the called function is known not to raise an exception. Differential Revision: https://reviews.llvm.org/D83906
2020-02-15[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.Fady Ghanim
Add support for Master and Critical directive in the OMPIRBuilder. Both make use of a new common interface for emitting inlined OMP regions called `emitInlinedRegion` which was added in this patch as well. Also this patch modifies clang to use the new directives when `-fopenmp-enable-irbuilder` commandline option is passed. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D72304
2020-02-10Revert "[OpenMP] Fix unused variable"Kadir Cetinkaya
This breaks under asan, see http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/38597/steps/check-clang%20asan/logs/stdio This reverts commit bb5045429545f47a76980864322a637c31594c7f. Revert "[FIX] Ordering problem accidentally introduced with D72304" This reverts commit 08c0a06d8f375e48d4acebac886bfdf19a2276ed. Revert "[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder." This reverts commit e8a436c5ea26f69378e4c1cf3ddb5b647b201e0f.
2020-02-08[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.fady
Add support for Master and Critical directive in the OMPIRBuilder. Both make use of a new common interface for emitting inlined OMP regions called `emitInlinedRegion` which was added in this patch as well. Also this patch modifies clang to use the new directives when `-fopenmp-enable-irbuilder` commandline option is passed. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D72304
2020-02-03Revert "[OpenMP][OMPIRBuilder] Add Directives (master and critical) to ↵Johannes Doerfert
OMPBuilder." This reverts commit 1ca740387b9bbdc142ac81c8bdd6370a8813e328. The bots break [0], investigation is needed. [0] http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/22899
2020-02-03[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.Fady Ghanim
Add support for Master and Critical directive in the OMPIRBuilder. Both make use of a new common interface for emitting inlined OMP regions called `emitInlinedRegion` which was added in this patch as well. Also this patch modifies clang to use the new directives when `-fopenmp-enable-irbuilder` commandline option is passed. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D72304
2017-12-29[OPENMP] Support for -fopenmp-simd option with compilation of simd loopsAlexey Bataev
only. Added support for -fopenmp-simd option that allows compilation of simd-based constructs without emission of OpenMP runtime calls. llvm-svn: 321560
2017-11-02[OPENMP] Fix PR35156: Get correct thread id with windows exceptions.Alexey Bataev
If the thread id is requested in windows mode within funclets, we may generate incorrect function call that could lead to broken codegen. llvm-svn: 317208
2017-08-16[OPRNMP] Fix for PR33445: ICE: OpenMP target containing ordered for.Alexey Bataev
If exceptions are enabled, there may be a problem with the codegen of the finalization functions from OpenMP runtime. It happens because of the problem with the getting of thread identifier value. Patch tries to fix it by using the result of the call of function __kmpc_global_thread_num() rather than loading of value of outlined function parameter. llvm-svn: 311007
2016-10-21Remove unnecessary x86 backend requirements from OpenMP testsReid Kleckner
Clang can generate LLVM IR for x86 without a registered x86 backend. llvm-svn: 284836
2016-04-27[OPENMP] Fix for codegen of captured variables in inlined directives.Alexey Bataev
Currently there is a problem with codegen of inlined directives inside lambdas, it may cause a crash during codegen because of incorrect capturing of variables. Patch fixes this problem. llvm-svn: 267677
2016-03-29[OPENMP] Allow runtime insert its own code inside OpenMP regions.Alexey Bataev
Solution unifies interface of RegionCodeGenTy type to allow insert runtime-specific code before/after main codegen action defined in CGStmtOpenMP.cpp file. Runtime should not define its own RegionCodeGenTy for general OpenMP directives, but must be allowed to insert its own (required) code to support target specific codegen. llvm-svn: 264700
2016-03-28Revert "[OPENMP] Allow runtime insert its own code inside OpenMP regions."Alexey Bataev
Reverting because of failed tests. llvm-svn: 264577
2016-03-28[OPENMP] Allow runtime insert its own code inside OpenMP regions.Alexey Bataev
Solution unifies interface of RegionCodeGenTy type to allow insert runtime-specific code before/after main codegen action defined in CGStmtOpenMP.cpp file. Runtime should not define its own RegionCodeGenTy for general OpenMP directives, but must be allowed to insert its own (required) code to support target specific codegen. llvm-svn: 264576
2016-03-28Revert "[OPENMP] Allow runtime insert its own code inside OpenMP regions."Alexey Bataev
This reverts commit 3ee791165100607178073f14531a0dc90c622b36. llvm-svn: 264570
2016-03-28[OPENMP] Allow runtime insert its own code inside OpenMP regions.Alexey Bataev
Solution unifies interface of RegionCodeGenTy type to allow insert runtime-specific code before/after main codegen action defined in CGStmtOpenMP.cpp file. Runtime should not define its own RegionCodeGenTy for general OpenMP directives, but must be allowed to insert its own (required) code to support target specific codegen. llvm-svn: 264569
2015-12-18[OPENMP] Fix for http://llvm.org/PR25878: Error compiling an OpenMP programAlexey Bataev
OpenMP codegen tried to emit the code for its constructs even if it was detected as a dead-code. Added checks to ensure that the code is emitted if the code is not dead. llvm-svn: 255990
2015-12-15[OPENMP 4.5] Fix test compatibility with 32 bit mode.Alexey Bataev
llvm-svn: 255640
2015-12-15[OPENMP 4.5] Codegen for 'hint' clause of 'critical' directiveAlexey Bataev
OpenMP 4.5 defines 'hint' clause for 'critical' directive. Patch adds codegen for this clause. llvm-svn: 255639
2015-10-08Stop messing with the 'g' group of options in CompilerInvocation.Douglas Katzman
With this change, most 'g' options are rejected by CompilerInvocation. They remain only as Driver options. The new way to request debug info from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}" and "-dwarf-version={2|3|4}". In the absence of a command-line option to specify Dwarf version, the Toolchain decides it, rather than placing Toolchain-specific logic in CompilerInvocation. Also fix a bug in the Windows compatibility argument parsing in which the "rightmost argument wins" principle failed. Differential Revision: http://reviews.llvm.org/D13221 llvm-svn: 249655
2015-09-04[OPENMP] Fix for http://llvm.org/PR24674: assertion failed and and abort trapAlexey Bataev
Fix processing of shared variables with reference types in OpenMP constructs. Previously, if the variable was not marked in one of the private clauses, the reference to this variable was emitted incorrectly and caused an assertion later. llvm-svn: 246846
2015-07-08Revert "Revert r241620 and follow-up commits" and move the initializationAdrian Prantl
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. llvm-svn: 241653
2015-07-07Revert r241620 and follow-up commits while investigating linux buildbot ↵Adrian Prantl
failures. llvm-svn: 241642
2015-07-07Wrap clang modules and pch files in an object file container.Adrian Prantl
This patch adds ObjectFilePCHContainerOperations uses the LLVM backend to put the contents of a PCH into a __clangast section inside a COFF, ELF, or Mach-O object file container. This is done to facilitate module debugging by makeing it possible to store the debug info for the types defined by a module alongside the AST. rdar://problem/20091852 llvm-svn: 241620
2015-06-29Account for calling convention specifiers in function definitions in IR test ↵David Blaikie
cases Several tests wouldn't pass when executed on an armv7a_pc_linux triple due to the non-default arm_aapcs calling convention produced on the function definitions in the IR output. Account for this with the application of a little regex. Patch by Ying Yi. llvm-svn: 240971
2015-05-20[OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)Alexey Bataev
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified). Differential Revision: http://reviews.llvm.org/D9736 llvm-svn: 237769
2015-04-29DebugInfo: Metadata constructs now start with DI*Duncan P. N. Exon Smith
LLVM r236120 renamed debug info IR constructs to use a `DI` prefix, now that the `DIDescriptor` hierarchy has been gone for about a week. This commit was generated using the rename-md-di-nodes.sh upgrade script attached to PR23080, followed by running clang-format-diff.py on the `lib/` portion of the patch. llvm-svn: 236121
2015-04-10[OPENMP] Refactoring of codegen for OpenMP directives.Alexey Bataev
Refactored API of OpenMPRuntime for compatibility with combined directives. Differential Revision: http://reviews.llvm.org/D8859 llvm-svn: 234564
2015-03-10[OPENMP] Fixed tests for non-debug builds. NFC.Alexey Bataev
llvm-svn: 231758
2015-03-10[OPENMP] Improved code for generating debug info + generation of all OpenMP ↵Alexey Bataev
regions in termination scope Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions Differential Revision: http://reviews.llvm.org/D7935 llvm-svn: 231757
2015-03-10Revert "[OPENMP] Improved code for generating debug info + generation of all ↵Rafael Espindola
OpenMP regions in termination scope Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions Differential Revision: http://reviews.llvm.org/D7935" This reverts commit r231752. It was failing to link with cmake: lib64/libclangCodeGen.a(CGOpenMPRuntime.cpp.o):/home/espindola/llvm/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:function clang::CodeGen::InlinedOpenMPRegionRAII::~InlinedOpenMPRegionRAII(): error: undefined reference to 'clang::CodeGen::EHScopeStack::popTerminate()' clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation) llvm-svn: 231754
2015-03-10[OPENMP] Improved code for generating debug info + generation of all OpenMP ↵Alexey Bataev
regions in termination scope Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions Differential Revision: http://reviews.llvm.org/D7935 llvm-svn: 231752
2015-02-26[OPENMP] Fixed codegen for directives without function outlining.Alexey Bataev
Fixed crash on codegen for directives like 'omp for', 'omp single' etc. inside of the 'omp parallel', 'omp task' etc. regions. llvm-svn: 230621
2015-02-25Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl
llvm-svn: 230454
2015-02-25Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
2014-09-22[OPENMP] Codegen for 'omp critical' directive.Alexey Bataev
This patch adds codegen for constructs: #pragma omp critical [name] <body> It generates global variable ".gomp_critical_user_[name].var" of type int32[8]. Then it generates library call "kmpc_critical(loc, gtid, .gomp_critical_user_[name].var)", code for <body> statement and final call "kmpc_end_critical(loc, gtid, .gomp_critical_user_[name].var)". Differential Revision: http://reviews.llvm.org/D5202 llvm-svn: 218239