[PATCH] D44046: [AMDGPU] Fixed incorrect break from loop

Tim Renouf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 14:45:39 PST 2018


tpr created this revision.
Herald added subscribers: llvm-commits, t-tye, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl, arsenm.

Lower control flow did not correctly handle the case that a loop break
in if/else was on a condition that was not guaranteed to be masked by
exec. The first test kernel shows an example of this going wrong; after
exiting the loop, exec is all ones, even if it was not before the loop.

The fix is for lowering of if-break and else-break to insert an
S_AND_B64 to mask the break condition with exec. This commit also
includes the optimization of not inserting that S_AND_B64 if it is
obviously not needed because the break condition is the result of a
V_CMP in the same basic block.


Repository:
  rL LLVM

https://reviews.llvm.org/D44046

Files:
  lib/Target/AMDGPU/SILowerControlFlow.cpp
  test/CodeGen/AMDGPU/loop_exit_with_xor.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44046.136857.patch
Type: text/x-patch
Size: 4119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180302/db1011ee/attachment.bin>


More information about the llvm-commits mailing list