[llvm-bugs] [Bug 49802] "Attempt to use a SCEVCouldNotCompute object!" with opt -indvars -loop-deletion

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 1 18:02:43 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49802

listmail at philipreames.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |listmail at philipreames.com
             Status|NEW                         |RESOLVED

--- Comment #3 from listmail at philipreames.com ---
Should be fixed in:

commit 91790c67850d588edb3a0e195a388c0e450f1723 (HEAD -> main, origin/main)
Author: Philip Reames <listmail at philipreames.com>
Date:   Thu Apr 1 17:45:53 2021 -0700

    [indvars[ Fix pr49802 by checking for SCEVCouldNotCompute

    The code is assuming that having an exact exit count for the loop implies
that exit counts for every exit are known.  This used to be true, but when we
added handling for dead exits we broke this invariant.  The new invariant is
that an exact loop count implies that any exits non trivially dead have exit
counts.

    We could have fixed this by either a) explicitly checking for a dead exit,
or b) just testing for SCEVCouldNotCompute.  I chose the second as it was
simpler.

    (Debugging this took longer than it should have since I'd mistyped the
original assert and it wasn't checking what it was meant to...)

    p.s. Sorry for the lack of test case.  Getting things into a state to
actually hit this is difficult and fragile.  The original repro involves
loop-deletion leaving SCEV in a slightly inprecise state which lets us bypass
other transforms in IndVarSimplify on the way to this one.  All of my attempts
to separate it into a standalone test failed.


Thanks again for the greatly reduced test case.  Debugging this without it
would have nearly impossible.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210402/5d62ed6f/attachment.html>


More information about the llvm-bugs mailing list