[PATCH] D96119: [Codegenprepare][X86] Use usub with overflow opt for IV increment

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 21:20:59 PST 2021


reames added a comment.

If there is a use of the original phi later in the loop, then performing the transformation does cause the live interval of %iv and %iv.next to overlap when it originally didn't.  I suspect this is still profitable, but it means the comments are slightly out of sink with reality.  Example pseudo code:
{

  %iv = ...
  if %iv == 0) break;
  use(%iv)
  %iv.next = add i32 %iv, 1
  continue;

}

I'd suggest tweaking this patch to add the hasOneUse check on the phi.  With that change, I'd also LGTM this.

As a separate patch, we can consider relaxing the hasOneUse again, but we'll need slightly different reasoning than taken here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96119/new/

https://reviews.llvm.org/D96119



More information about the llvm-commits mailing list