OSDN Git Service

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)
commit4a413d30ec3e791a032c299cd84756435d56022f
tree62600ea593df5d409d27f1881bce15184887c75e
parent67b6109ba6436c5074dd9762da8f7fa9264945f7
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356298 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
test/CodeGen/AMDGPU/si-annotatecfg-multiple-backedges.ll [new file with mode: 0644]