summaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/taskloop_simd_in_reduction_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.
2024-01-11[Clang] Set writable and dead_on_unwind attributes on sret arguments (#77116)Nikita Popov
Set the writable and dead_on_unwind attributes for sret arguments. These indicate that the argument points to writable memory (and it's legal to introduce spurious writes to it on entry to the function) and that the argument memory will not be used if the call unwinds. This enables additional MemCpyOpt/DSE/LICM optimizations.
2024-01-05[Clang] Regenerate test checks (NFC)Nikita Popov
2023-10-20Diagnose use of VLAs in C++ by defaultAaron Ballman
Reapplication of 7339c0f782d5c70e0928f8991b0c05338a90c84c with a fix for a crash involving arrays without a size expression. Clang supports VLAs in C++ as an extension, but we currently only warn on their use when you pass -Wvla, -Wvla-extension, or -pedantic. However, VLAs as they're expressed in C have been considered by WG21 and rejected, are easy to use accidentally to the surprise of users (e.g., https://ddanilov.me/default-non-standard-features/), and they have potential security implications beyond constant-size arrays (https://wiki.sei.cmu.edu/confluence/display/c/ARR32-C.+Ensure+size+arguments+for+variable+length+arrays+are+in+a+valid+range). C++ users should strongly consider using other functionality such as std::vector instead. This seems like sufficiently compelling evidence to warn users about VLA use by default in C++ modes. This patch enables the -Wvla-extension diagnostic group in C++ language modes by default, and adds the warning group to -Wall in GNU++ language modes. The warning is still opt-in in C language modes, where support for VLAs is somewhat less surprising to users. RFC: https://discourse.llvm.org/t/rfc-diagnosing-use-of-vlas-in-c/73109 Fixes https://github.com/llvm/llvm-project/issues/62836 Differential Revision: https://reviews.llvm.org/D156565
2023-10-20Revert "Diagnose use of VLAs in C++ by default"Aaron Ballman
This reverts commit 7339c0f782d5c70e0928f8991b0c05338a90c84c. Breaks bots: https://lab.llvm.org/buildbot/#/builders/139/builds/51875 https://lab.llvm.org/buildbot/#/builders/164/builds/45262
2023-10-20Diagnose use of VLAs in C++ by defaultAaron Ballman
Clang supports VLAs in C++ as an extension, but we currently only warn on their use when you pass -Wvla, -Wvla-extension, or -pedantic. However, VLAs as they're expressed in C have been considered by WG21 and rejected, are easy to use accidentally to the surprise of users (e.g., https://ddanilov.me/default-non-standard-features/), and they have potential security implications beyond constant-size arrays (https://wiki.sei.cmu.edu/confluence/display/c/ARR32-C.+Ensure+size+arguments+for+variable+length+arrays+are+in+a+valid+range). C++ users should strongly consider using other functionality such as std::vector instead. This seems like sufficiently compelling evidence to warn users about VLA use by default in C++ modes. This patch enables the -Wvla-extension diagnostic group in C++ language modes by default, and adds the warning group to -Wall in GNU++ language modes. The warning is still opt-in in C language modes, where support for VLAs is somewhat less surprising to users. RFC: https://discourse.llvm.org/t/rfc-diagnosing-use-of-vlas-in-c/73109 Fixes https://github.com/llvm/llvm-project/issues/62836 Differential Revision: https://reviews.llvm.org/D156565
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-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
2022-10-07[OpenMP] Convert more tests to opaque pointers (NFC)Nikita Popov
These were converted using the script at https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34 followed by a re-run of update_cc_test_checks.py.
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-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-19Rerun ./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-02-18[Clang] Rename `disable-noundef-analysis` flag to ↵hyeongyukim
`-[no-]enable-noundef-analysis` This flag was previously renamed `enable_noundef_analysis` to `disable-noundef-analysis,` which is not a conventional name. (Driver and CC1's boolean options are using [no-] prefix) As discussed at https://reviews.llvm.org/D105169, this patch reverts its name to `[no-]enable_noundef_analysis` and enables noundef-analysis as default. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D119998
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-13Return "[CGCall] Annotate `this` argument with alignment"Roman Lebedev
The original change was reverted because it was discovered that clang mishandles thunks, and they receive wrong attributes for their this/return types - the ones for the function they will call, not the ones they have. While i have tried to fix this in https://reviews.llvm.org/D100388 that patch has been up and stuck for a month now, with little signs of progress. So while it will be good to solve this for real, for now we can simply avoid introducing the bug, by not annotating this/return for thunks. This reverts commit 6270b3a1eafaba4279e021418c5a2c5a35abc002, relanding 0aa0458f1429372038ca6a4edc7e94c96cd9a753.
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
2021-03-31[OPENMP]Fix PR48885: Crash in passing firstprivate args to tasks on Apple M1.Alexey Bataev
Need to bitcast the function pointer passed as a parameter to the real type to avoid possible problem with calling conventions. Differential Revision: https://reviews.llvm.org/D99521
2020-08-10[OpenMP][NFC] Reuse OMPIRBuilder `struct ident_t` handling in ClangJohannes Doerfert
Replace the `ident_t` handling in Clang with the methods offered by the OMPIRBuilder. This cuts down on the clang code as well as the differences between the two, making further transitions easier. Tests have changed but there should not be a real functional change. The most interesting difference is probably that we stop generating local ident_t allocations for now and just use globals. Given that this happens only with debug info, the location part of the `ident_t` is probably bigger than the test anyway. As the location part is already a global, we can avoid the allocation, memcpy, and store in favor of a constant global that is slightly bigger. This can be revisited if there are complications. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D80735
2020-04-24[OPENMP]Use new interface for task reduction.Alexey Bataev
Summary: Patch forces codegen to use the new runtime functions for task reductions where the issue with passing the address of the original variables to the UDR initializers is fixed. Also, this patch is required for upcoming support of task modifier inreduction clause. Reviewers: jdoerfert Subscribers: yaxunl, guansong, cfe-commits, caomhin Tags: #clang Differential Revision: https://reviews.llvm.org/D78733
2020-03-13[OPENMP]Fix PR45047: Do not copy firstprivates in tasks twice.Alexey Bataev
Avoid copying of the orignal variable if it is going to be marked as firstprivate in task regions. For taskloops, still need to copy the non-trvially copyable variables to correctly construct them upon task creation.
2018-04-16[OPENMP] General code improvements.Alexey Bataev
llvm-svn: 330140
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-07-27[OPENMP] Codegen for 'in_reduction' clause.Alexey Bataev
Added codegen for task-based directive with in_reduction clause. ``` <body> ``` The next code is emitted: ``` void *td; ... td = call i8* @__kmpc_task_reduction_init(); ... <type> *priv = (<type> *)call i8* @__kmpc_task_reduction_get_th_data(i32 GTID, i8* td, i8* <orig>) ``` llvm-svn: 309270