[PATCH] D101291: [IndVars] avoid crash in LFTR when assuming an add recurrence

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 11:15:28 PDT 2021


reames added a comment.

This patch looks suspiciously like it's fixing a symptom not the cause.  The test case in this review does not reproduce for me.  However, the original reduced case from the mentioned bug does.

Glancing at the SCEV for the original test before the transform shows that both the phi and the add *are* AddRecExprs.  I'd suggest printing the SCEVs at the point of crash to see what might have changed or to better understand how we can match a loop counter - which the example does appear to be - and yet end up with the increment not being an addrec.

Your patch seems like a workaround.  I suspect we'll see other problems if the expected pre-conditions to the LFTR method are not met.

To be clear, I'm not opposing a workaround if this is breaking something badly, I just want to make sure we don't stop at the workaround if there's a deeper issue here.


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

https://reviews.llvm.org/D101291



More information about the llvm-commits mailing list