D149348 did this for readnone calls, which are handled by SimpleValue.
This patch does the same for all other CSEable calls, which are handled
by CallValue.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
144 | Maybe should be checking nosync instead? |
llvm/lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
144 | How is that related? |
llvm/lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
144 | The comment here and special case of coroutines seems like it was hacking around the general check of nosync. In a roundabout way checking nosync is the same as convergent. IIRC the interaction between them is no-convergent + memory(none) implies nosync |
llvm/lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
144 | The coroutine check has no relation to nosync. It's hacking around a weakness in memory effect modelling that is unrelated to synchronization. |
I'm not familiar with the code but the thrust of it makes sense. We should probably still try to CSE calls that are in the same basic block, though. Is that easy to do?
I need to rethink. The patch as-is does not make much sense because @llvm.read_register is not readnone.
llvm/test/Transforms/EarlyCSE/AMDGPU/convergent-call.ll | ||
---|---|---|
22 | I think something is wrong here but you should test with something normal and not read_register |
Can we have a test with 2 convergent calls in the same block, or do we have one already?
llvm/test/Transforms/EarlyCSE/AMDGPU/convergent-call.ll | ||
---|---|---|
47 | @jdoerfert it is here. (It's not upstream yet - this comes from a patch that I only have locally.) |
There aren't really any normal readonly convergent intrinsics. @llvm.amdgcn.live.mask is currently readonly so I used that - but it seems to me it should probably be convergent readnone.
llvm/lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
545 | Is this supposed to implicitly assume invokes and callbr can't reach here? |
llvm/lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
545 | Yes. This is checked in CallValue::canHandle. |
Maybe should be checking nosync instead?