Please review codegen implementation of the ‘omp for’ loop with dynamic schedule kinds.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Generally looks good. A couple organization suggestions to eliminate some of the code duplication.
lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
426 ↗ | (On Diff #18653) | Your only caller here pattern-matches on the integer size and signedness so that it can pass the right enum value down just so that this code can immediately switch out to cases that are identical except for slight differences in integer size and signedness. This is kindof silly. You don't *have* to shove everything through this one method; you can have a CreateDispatchRuntimeFunction method or something that returns the appropriate function from a named family for a given integer size and signedness. Or you could be slightly less type-safe and just have CreateRuntimeFunction take (defaultable) arguments that pick the right function from a family, like how LLVM overloaded intrinsics work. Please do something like that instead of having all this redundancy, though. |
lib/CodeGen/CGOpenMPRuntime.h | ||
383 ↗ | (On Diff #18653) | These are not useful documentation. You can just leave off the comment about CGF. For Loc, there's probably an existing discussion about the purpose of the source locations you can refer to. |
394 ↗ | (On Diff #18653) | Why does this specifically return a CallInst* instead of just a Value*? |
lib/CodeGen/CGStmtOpenMP.cpp | ||
591 ↗ | (On Diff #18653) | Just have EmitOMPForNext do this conversion and return an i1. |
610 ↗ | (On Diff #18653) | Is there no init otherwise? Seems like something that should be asserted. |
Hi John,
Thank you for review! I've fixed all the issues.
I think a similar refactoring can be done for OMPRTL__kmpc_for_static_init_*, I can do it in follow-up commit.
Best regards,
Alexander