Add the AAExecutionDomainInfo attributor instance to OpenMPOpt.
This will infer information relating to domain information that an
instruction might be expecting in. Right now this only includes a very
crude check for instructions that will be executed by the master thread
by comparing a thread-id function with a constant zero.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks like a reasonable start, some comments:
Hook it up to the globalization to make it easier to test it. We also need negative tests and such, swapped conditions, swapped edges, ...
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
3851 ↗ | (On Diff #341661) | Comments are copy&paste but I don't assume we need these functions at all. |
3866 ↗ | (On Diff #341661) | Nit: take references |
llvm/lib/Transforms/IPO/AttributorAttributes.cpp | ||
4347 ↗ | (On Diff #341661) | Not needed |
8150 ↗ | (On Diff #341661) | |
8177 ↗ | (On Diff #341661) | -Master I don't get the TrueBB part, you don't know which successor the block you are looking at is from the code below. Make it "SuccBB" and check the condition first, then check if this is the successor under which the condition is tid == 0. Given that we have all the openmp specific functions in here we should move this into OpenMPOpt. |
8185 ↗ | (On Diff #341661) | |
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
1166 | I assume this is only for testing, right? |
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
---|---|---|
2281 | return how many blocks are single threaded of how many, as string: "3/7 BBs thread 0 only" | |
2312 | You could use a set, during initialize put all blocks in the set, remove one if you cannot argue it's single threaded. you know something changed if the size at the end of update is not the size at the beginning. That should make things a lot simpler, whenever you fail to show single threaded, remove it from the set right away, no need to communicate booleans all over the place and check the set all the time to update "changed". | |
2333 | also check if it is an equality, this would allow tid >= 0, I think. | |
2369 | Move down to the usage, also IsSingleThreadOnly | |
2380–2382 | ||
2439 | unreachable for all but function. See the other createForPosition |
Hi,
The added test llvm/test/Transforms/OpenMP/single_threaded_execution.ll fails in release builds when assertions are disabled.
You probably need to add ; REQUIRES: asserts like it is done in llvm/test/CodeGen/Mips/brind-tailcall.ll.
Thanks, seems like someone already fixed it in 05146fe5171076eaec3ef6a9eeeab4c8a33acf15.
I assume this is only for testing, right?