Details
Diff Detail
Event Timeline
We just used to link in libgomp for compatibility with gcc, is this correct? (For example, some object files could be compiled with GCC with OpenMP, while the rest of the program could be compiled with clang and linked with 'clang -fopenmp'.)
If it is so, I think the change is good, the users can get the previous behavior by specifying the required libraries manually.
Yes. But currently llvm accepted libiomp5, not libgomp, so I think it is a good time to switch gomp to iomp5. Besides, iomp5 is binary compatible with gomp.
LGTM. If you feel like it, maybe add a note in release notes that 'clang -fopenmp' now links a different library.
I don't think it is necessary right now. Besides, -fopenmp option exists only as a frontend option. It is disabled in driver and can be passed to frontend only "-Xclang -fopenmp".
lib/Driver/Tools.cpp | ||
---|---|---|
5242–5265 | Then only -fopenmp will work and the warning for -fopenmp=libiomp5 will be emitted. I thought that we have to be conservative with -fopenmp option. | |
test/OpenMP/parallel_ast_print.cpp | ||
1–3 | No, it also turns on OpenMP support in front end. You can consider -fopenmp=libiomp5 option as an extension for -fopenmp option. My idea was not only link libiomp5, but also generate the IR for libiomp5 runtime only if -fopenmp=libiomp5 is specified. If -fopenmp is specified, the IR won't be generated (for compatibility). |
lib/Driver/Tools.cpp | ||
---|---|---|
5242–5265 | OK, please add a test. |
Added test which expects warning when both -fopenmp and -fopenmp=libiomp5 are specified
Updated processing of -fopenmp and -fopenmp= options. -fopenmp is used only to link libgomp library, -fopenmp= is used to activate processing of OpenMP constructs and future codegen.
LGTM.
I think it makes sense to have -fopenmp=libgomp work as well. First, for consistency. But also, for users who are depending on the current -fopenmp behavior, this will give them some time to migrate to a stable flag before we switch the default.
lib/Driver/Tools.cpp | ||
---|---|---|
5261 | This seems somewhat asymmetric: we now have -fopenmp, which links libgomp, and -fopenmp=libiomp5 which links libiomp5. How about having -fopenmp=libgomp link libgomp too? | |
6874 | Same here. |
-fopenmp is used only to link libgomp library, -fopenmp= is used to activate processing of OpenMP constructs and future codegen.
This feels surprising, but I see where you are coming from -- codegen will only support libiomp5 interface. Please document this behavior in the user manual.
On IRC @ABataev said that we should start advertising OpenMP support in the manual only after we have something actually useful for end users.
This patch does not introduce a backwards compatibility issue, so LGTM.
This seems somewhat asymmetric: we now have -fopenmp, which links libgomp, and -fopenmp=libiomp5 which links libiomp5. How about having -fopenmp=libgomp link libgomp too?