[PATCH] D108848: [LoopDeletion] Separate logic in breakBackedgeIfNotTaken using symboic max trip count [nfc]

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 30 11:23:14 PDT 2021


reames added a comment.

Digging into the ArchiveCommandLine.ll case, the symbolic expression we compute (instead of the constant max zero) is (-1 + (zext i32 (1 umax (1 smin %29)) to i64))<nsw>.  This comes from the howFarToZero codepath.  I tried bugpointing this, and the reduced example seems to depend on overflow logic again, but the reduced example is different enough that I'm not 100% sure the unreduced case is the same.  It could simply be a missing combine.  Either way, we end up with another case where max == 0, and exact = <some symbolic possibly zero value>.

Given this seems to be a broader pattern, I tried tweaking the constructor of ExitLimit to set the exact trip count to zero when the max trip count is zero.  Oddly, that causes regression in some Thumb2 code placement tests.  I have no idea why just yet.

My proposal is to land D108921 <https://reviews.llvm.org/D108921> (once reviewed), then understand the Thumb regression, fix that, and then sink the zero check into ExitLimit, then land this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108848



More information about the llvm-commits mailing list