HomePhabricator

[indvars[ Fix pr49802 by checking for SCEVCouldNotCompute

Authored by reames on Thu, Apr 1, 5:45 PM.

Description

[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.

Details

Committed
reamesThu, Apr 1, 5:53 PM
Parents
rGf6ad0453665f: [lld][MachO] Make emitEndFunStab independent from .subsections_via_symbols
Branches
Unknown
Tags
Unknown