The OpenMP spec seems to require the compound operators be used for
+, *, &, |, and ^ reduction. So use these if a class has those operators.
If not try the simple operators as we did previously to limit the impact
to existing code.
Details
Diff Detail
Event Timeline
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
16859 | For scalars there is no difference in functionality afaik but it does end up generating different llvm IR. The resulting IR changes in some non-trivial ways in some cases changing atomic instructions to critical sections in some of the lit tests. I didn't want to change and possibly destabilize known working codegen for no known benefit. | |
clang/test/OpenMP/reduction_compound_op.cpp | ||
2 | Sorry I am not familiar with such a script. Can you give me a pointer or explain? |
clang/test/OpenMP/reduction_compound_op.cpp | ||
---|---|---|
2 | The script is llvm/utils/update_cc_test_checks.py. You can check test/OpenMP/nvptx_target_codegen.cpp as an example for args |
clang/test/OpenMP/reduction_compound_op.cpp | ||
---|---|---|
10–11 | Add checks for -fopenmp-simd flags, that no _kmpc|tgt calls are emitted |
clang/test/OpenMP/reduction_compound_op.cpp | ||
---|---|---|
10–11 | Thinking about this more I am not modifying any codegen so I think it's probably better to test this in the AST. The scripted codegen test makes it very difficult to tell what is being tested. Is it okay if I drop this codegen test and write an AST test instead? |
clang/test/OpenMP/reduction_compound_op.cpp | ||
---|---|---|
10–11 | Better to keep it, if possible. Just the test for simd must very simole,withou check l8nes,just need to check that no kmpc|tgt calls are generated. |
Added -fopenmp-simd check to reduction_compound_op.cpp
Regenerated checks for nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp since it uses complex reduction with operator+=.
Why only for records?