AMDGPU: Fix a SIAnnotateControlFlow issue when there are multiple backedges.
authorChangpeng Fang <changpeng.fang@gmail.com>
Fri, 15 Mar 2019 21:02:48 +0000 (21:02 +0000)
committerChangpeng Fang <changpeng.fang@gmail.com>
Fri, 15 Mar 2019 21:02:48 +0000 (21:02 +0000)
commit989ec59c9f04d89ac4f3dc3e653b96996dd6eafe
treea4c0e59e0a862979ffefc015db75e83188ff039d
parent5ac90b8ba1b321c7ebc4f2fc1ae495d834aaadf5
AMDGPU: Fix a SIAnnotateControlFlow issue when there are multiple backedges.

Summary:
At the exit of the loop, the compiler uses a register to remember and accumulate
the number of threads that have already exited. When all active threads exit the
loop, this register is used to restore the exec mask, and the execution continues
for the post loop code.

When there is a "continue" in the loop, the compiler made a mistake to reset the
register to 0 when the "continue" backedge is taken. This will result in some
threads not executing the post loop code as they are supposed to.

This patch fixed the issue.

Reviewers:
  nhaehnle, arsenm

Differential Revision:
  https://reviews.llvm.org/D59312

llvm-svn: 356298
llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
llvm/test/CodeGen/AMDGPU/si-annotatecfg-multiple-backedges.ll [new file with mode: 0644]