summaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/parallel_reduction_task_codegen.cpp
AgeCommit message (Collapse)Author
2024-09-05Reland "[clang] Add nuw attribute to GEPs (#105496)" (#107257)Hari Limaye
Add nuw attribute to inbounds GEPs where the expression used to form the GEP is an addition of unsigned indices. Relands #105496, which was reverted because it exposed a miscompilation arising from #98608. This is now fixed by #106512.
2024-08-28Revert "[clang] Add nuw attribute to GEPs" (#106343)Vitaly Buka
Reverts llvm/llvm-project#105496 This patch breaks: https://lab.llvm.org/buildbot/#/builders/25/builds/1952 https://lab.llvm.org/buildbot/#/builders/52/builds/1775 Somehow output is different with sanitizers. Maybe non-determinism in the code?
2024-08-27[clang] Add nuw attribute to GEPs (#105496)Hari Limaye
Add nuw attribute to inbounds GEPs where the expression used to form the GEP is an addition of unsigned indices.
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.
2023-08-23[OpenMP][NFC] Update clang OpenMP testsJohannes Doerfert
Just re-running the script to make future updates easier
2023-08-09Intrinsics: Add type overload to stacksave and stackstoreMatt Arsenault
This allows use with non-0 address space stacks. llvm_ptr_ty should never be used. This could use some more percolation up through mlir, but this is enough to fix existing tests. https://reviews.llvm.org/D156666
2023-07-11clang: Regenerate OpenMP testsMatt Arsenault
Avoid diffs from no longer hardcoding metadata checks
2023-06-15[OpenMP] Update the default version of OpenMP to 5.1Animesh Kumar
The default version of OpenMP is updated from 5.0 to 5.1 which means if -fopenmp is specified but -fopenmp-version is not specified with clang, the default version of OpenMP is taken to be 5.1. After modifying the Frontend for that, various LIT tests were updated. This patch contains all such changes. At a high level, these are the patterns of changes observed in LIT tests - # RUN lines which mentioned `-fopenmp-version=50` need to kept only if the IR for version 5.0 and 5.1 are different. Otherwise only one RUN line with no version info(i.e. default version) needs to be there. # Test cases of this sort already had the RUN lines with respect to the older default version 5.0 and the version 5.1. Only swapping the version specification flag `-fopenmp-version` from newer version RUN line to older version RUN line is required. # Diagnostics: Remove the 5.0 version specific RUN lines if there was no difference in the Diagnostics messages with respect to the default 5.1. # Diagnostics: In case there was any difference in diagnostics messages between 5.0 and 5.1, mention version specific messages in tests. # If the test contained version specific ifdef's e.g. "#ifdef OMP5" but there were no RUN lines for any other version than 5.X, then bring the code guarded by ifdef's outside and remove the ifdef's. # Some tests had RUN lines for both 5.0 and 5.1 versions, but it is found that the IR for 5.0 is not different from the 5.1, therefore such RUN lines are redundant. So, such duplicated lines are removed. # To generate CHECK lines automatically, use the script llvm/utils/update_cc_test_checks.py Reviewed By: saiislam, ABataev Differential Revision: https://reviews.llvm.org/D129635 (cherry picked from commit 9dd2999907dc791136a75238a6000f69bf67cf4e)
2023-05-12[OpenMP] Naturally align internal global variables in the OpenMPIRBuilderJoseph Huber
We use this helper to make several internal global variables during codegen. currently we do not specify any alignment which allows the alignment to be set incorrectly after some changes in how alignment was handled. This patch explicitly aligns these variables to the natural alignment as specified by the data layout Fixes https://github.com/llvm/llvm-project/issues/62668 Reviewed By: tianshilei1992, gchatelet Differential Revision: https://reviews.llvm.org/D150461
2023-04-24[InstSimplify] sdiv a (1 srem b) --> aSiyuan Zhu
Extend the existing fold for division by zero or one to use known bits, so it catches additional patterns like division by (1 srem b). Fixes https://github.com/llvm/llvm-project/issues/62163. Differential Revision: https://reviews.llvm.org/D149001
2023-04-19[OpenMP] Prefix outlined and reduction func names with original func's nameItay Bookstein
This patch prefixes omp outlined helpers and reduction funcs with the original function's name. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D140722
2023-04-19Revert "[OpenMP] Prefix outlined and reduction func names with original ↵Itay Bookstein
func's name" This reverts commit 029bfc311d4d7d3cd90be81bb08c046848796d02.
2023-04-19[OpenMP] Prefix outlined and reduction func names with original func's nameItay Bookstein
This patch attempts to prefix omp outlined helpers and reduction funcs with the original function's name. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D140722
2023-01-09[OpenMP][NFC] Rerun the update_cc_test_checks on most OpenMP testsJohannes Doerfert
The script changes over time and unrelated changes to the test check lines should not pollute future revisions.
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-09-15Revert "[OpenMP] Codegen aggregate for outlined function captures"Dhruva Chakrabarti
This reverts commit 7539e9cf811e590d9f12ae39673ca789e26386b4.
2022-09-15[OpenMP] Codegen aggregate for outlined function capturesGiorgis Georgakoudis
Parallel regions are outlined as functions with capture variables explicitly generated as distinct parameters in the function's argument list. That complicates the fork_call interface in the OpenMP runtime: (1) the fork_call is variadic since there is a variable number of arguments to forward to the outlined function, (2) wrapping/unwrapping arguments happens in the OpenMP runtime, which is sub-optimal, has been a source of ABI bugs, and has a hardcoded limit (16) in the number of arguments, (3) forwarded arguments must cast to pointer types, which complicates debugging. This patch avoids those issues by aggregating captured arguments in a struct to pass to the fork_call. Reviewed By: jdoerfert, jhuber6, ABataev Differential Revision: https://reviews.llvm.org/D102107
2022-08-01Use @llvm.threadlocal.address intrinsic to access TLS variableChuanqi Xu
This is successor for D125291. This revision would try to use @llvm.threadlocal.address in clang to access TLS variable. The reason why the OpenMP tests contains a lot of change is that they uses utils/update_cc_test_checks.py to update their tests. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D129833
2022-07-20Inliner: don't mark call sites as 'nounwind' if that would be redundantNicolai Hähnle
When F calls G calls H, G is nounwind, and G is inlined into F, then the inlined call-site to H should be effectively nounwind so as not to lose information during inlining. If H itself is nounwind (which often happens when H is an intrinsic), we no longer mark the callsite explicitly as nounwind. Previously, there were cases where the inlined call-site of H differs from a pre-existing call-site of H in F *only* in the explicitly added nounwind attribute, thus preventing common subexpression elimination. v2: - just check CI->doesNotThrow v3 (resubmit after revert at 344378808778c61d5599f4e0ac783ef7e6f8ed05): - update Clang tests Differential Revision: https://reviews.llvm.org/D129860
2022-07-18Rerun ./utils/update_cc_test.py on a bunch of testsNicolai Hähnle
Due to update script changes; this reduces the size of a later "real" diff.
2022-07-01[OpenMP][NFC] Reuse check lines for Clang/OpenMP testsJohannes Doerfert
I used a script to reuse existing check lines rather than creating new ones. There are more opportunities to reduce the line count but the "check generated functions" logic makes that somewhat tricky. FWIW, we really should redo the update script with all these use cases in mind... Differential Revision: https://reviews.llvm.org/D128686
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
2022-03-21[CodeGen][OpenMP] Use correct type in EmitLoadOfPointer()Nikita Popov
Rather than using a dummy void pointer type, we should specify the correct private type and perform the bitcast beforehand rather than afterwards. This way, the Address will have correct alignment information.
2022-03-18[OpenMPRuntime] Specify correct pointer typeNikita Popov
Rather than specifying a dummy type in EmitLoadOfPointer() and then casting it to the correct one, we should instead specify the correct type and cast beforehand. Otherwise the computed alignment will be incorrect.
2022-01-16[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵hyeongyu kim
turn it off by default Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169
2021-11-09Revert "[Clang/Test]: Rename enable_noundef_analysis to ↵hyeongyu kim
disable-noundef-analysis and turn it off by default" This reverts commit aacfbb953eb705af2ecfeb95a6262818fa85dd92. Revert "Fix lit test failures in CodeGenCoroutines" This reverts commit 63fff0f5bffe20fa2c84a45a41161afa0043cb34.
2021-11-06[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵hyeongyukim
turn it off by default Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169 [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default (2) This patch updates test files after D105169. Autogenerated test codes are changed by `utils/update_cc_test_checks.py,` and non-autogenerated test codes are changed as follows: (1) I wrote a python script that (partially) updates the tests using regex: {F18594904} The script is not perfect, but I believe it gives hints about which patterns are updated to have `noundef` attached. (2) The remaining tests are updated manually. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D108453 Resolve lit failures in clang after 8ca4b3e's land Fix lit test failures in clang-ppc* and clang-x64-windows-msvc Fix missing failures in clang-ppc64be* and retry fixing clang-x64-windows-msvc Fix internal_clone(aarch64) inline assembly
2021-11-06Revert "[Clang/Test]: Rename enable_noundef_analysis to ↵Juneyoung Lee
disable-noundef-analysis and turn it off by default" This reverts commit 7584ef766a7219b6ee5a400637206d26e0fa98ac.
2021-11-06[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵Juneyoung Lee
turn it off by default Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169
2021-10-18Revert D105169 due to the two-stage failure in ASANJuneyoung Lee
This reverts the following commits: 37ca7a795b277c20c02a218bf44052278c03344b 9aa6c72b92b6c89cc6d23b693257df9af7de2d15 705387c5074bcca36d626882462ebbc2bcc3bed4 8ca4b3ef19fe82d7ad6a6e1515317dcc01b41515 80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a
2021-10-16[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵Juneyoung Lee
turn it off by default (2) This patch updates test files after D105169. Autogenerated test codes are changed by `utils/update_cc_test_checks.py,` and non-autogenerated test codes are changed as follows: (1) I wrote a python script that (partially) updates the tests using regex: {F18594904} The script is not perfect, but I believe it gives hints about which patterns are updated to have `noundef` attached. (2) The remaining tests are updated manually. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D108453
2021-09-21Revert "[OpenMP] Codegen aggregate for outlined function captures"Giorgis Georgakoudis
This reverts commit 1d66649adf28d48ae1731516d87fb899426e3349. Revert to fix AMG GPU issue.
2021-09-21[OpenMP] Codegen aggregate for outlined function capturesGiorgis Georgakoudis
Parallel regions are outlined as functions with capture variables explicitly generated as distinct parameters in the function's argument list. That complicates the fork_call interface in the OpenMP runtime: (1) the fork_call is variadic since there is a variable number of arguments to forward to the outlined function, (2) wrapping/unwrapping arguments happens in the OpenMP runtime, which is sub-optimal, has been a source of ABI bugs, and has a hardcoded limit (16) in the number of arguments, (3) forwarded arguments must cast to pointer types, which complicates debugging. This patch avoids those issues by aggregating captured arguments in a struct to pass to the fork_call. Reviewed By: jdoerfert, jhuber6 Differential Revision: https://reviews.llvm.org/D102107
2021-07-19Revert "[OpenMP] Codegen aggregate for outlined function captures"Giorgis Georgakoudis
This reverts commit e9c7291cb25f071f1a1dfa4049ed9f5a8a217b3e. Fix failing tests
2021-07-16[OpenMP] Codegen aggregate for outlined function capturesGiorgis Georgakoudis
Parallel regions are outlined as functions with capture variables explicitly generated as distinct parameters in the function's argument list. That complicates the fork_call interface in the OpenMP runtime: (1) the fork_call is variadic since there is a variable number of arguments to forward to the outlined function, (2) wrapping/unwrapping arguments happens in the OpenMP runtime, which is sub-optimal, has been a source of ABI bugs, and has a hardcoded limit (16) in the number of arguments, (3) forwarded arguments must cast to pointer types, which complicates debugging. This patch avoids those issues by aggregating captured arguments in a struct to pass to the fork_call. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D102107
2021-06-25[OpenMP] Add Module metadata for OpenMP compilationJoseph Huber
This patch adds a module level metadata flag indicating that the module was compiled with the `-fopenmp` flag. This will make it easier for passes like OpenMPOpt to determine if it should be run. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D102361
2021-05-19[OpenMP][NFC] Remove SIMD check lines for non-simd testsJohannes Doerfert
If a test does not contain an " simd" but -fopenmp-simd RUN lines we can just check that we do not create __kmpc|__tgt calls. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D101973
2021-05-05[OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checksGiorgis Georgakoudis
This patch refactors a subset of Clang OpenMP tests, generating checklines using the update_cc_test_checks script. This refactoring facilitates updating the Clang OpenMP code generation codebase by automating test generation. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D101849
2021-05-04Revert "[OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks"Giorgis Georgakoudis
This reverts commit 956cae2f09b21429dbcb02066c99e35a239aa4bf.
2021-05-04[OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checksGiorgis Georgakoudis
This patch refactors a subset of Clang OpenMP tests, generating checklines using the update_cc_test_checks script. This refactoring facilitates updating the Clang OpenMP code generation codebase by automating test generation. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D101849
2020-08-18[OPENMP]Do not capture base pointer by reference if it is used as a base for ↵Alexey Bataev
array-like reduction. If the declaration is used in the reduction clause, it is captured by reference by default. But if the declaration is a pointer and it is a base for array-like reduction, this declaration can be captured by value, since the pointee is reduced but not the original declaration. Differential Revision: https://reviews.llvm.org/D85321
2020-05-01[OPENMP50]Codegen for reduction clauses with 'task' modifier.Alexey Bataev
Summary: Added codegen for reduction clause with task modifier. ``` #pragma omp ... reduction(task, +: a) { #pragma omp ... in_reduction(+: a) } ``` is translated into something like this: ``` #pragma omp ... reduction(+:a) { struct red_input_t { void *reduce_shar; void *reduce_orig; size_t reduce_size; void *reduce_init; void *reduce_fini; void *reduce_comb; unsigned flags; } r_var; r_var.reduce_shar = &a; r_var.reduce_orig = &original a; r_var.reduce_size = sizeof(a); r_var.reduce_init = [](void* l,void*){return *(int*)l=0;}; r_var.reduce_fini = nullptr; r_var.reduce_comb = [](void* l,void* r){return *(int*)l += *(int)r;}; void *tg = __kmpc_taskred_modifier_init(<loc_addr>,<gtid>, <flag - 0 for parallel, 1 for worksharing>, <1 - number of reduction elements>, &r_var); { #pragma omp ... in_reduction(+: a) firstprivate(tg) ... } __kmpc_task_reduction_modifier_fini(<loc_addr>,<gtid>, <flag - 0 for parallel, 1 for worksharing>); } ``` Reviewers: jdoerfert Subscribers: yaxunl, guansong, jfb, cfe-commits, caomhin Tags: #clang Differential Revision: https://reviews.llvm.org/D79034