[LoopSimplify] don't separate nested loops with convergent calls
authorSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>
Tue, 19 May 2020 03:52:08 +0000 (09:22 +0530)
committerSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>
Tue, 19 May 2020 03:52:39 +0000 (09:22 +0530)
commit6c8488436644af41b3e29564ff85dc5eaa240347
tree24326f09ccdfbf1d9c92c2aebcbf97c1ed39a582
parenta6be4d17e349f834e4d365f68e0435a1c4334a81
[LoopSimplify] don't separate nested loops with convergent calls

Summary:
When a loop has multiple backedges, loop simplification attempts to
separate them out into nested loops. This results in incorrect control
flow in the presence of some functions like a GPU barrier. This change
skips the transformation when such "convergent" function calls are
present in the loop body.

Reviewed By: nhaehnle

Differential Revision: https://reviews.llvm.org/D80078
llvm/lib/Transforms/Utils/LoopSimplify.cpp
llvm/test/Transforms/LoopSimplify/convergent.ll [new file with mode: 0644]