[llvm] [ExtendLifetimes] Implement llvm.fake.use to extend variable lifetimes (PR #86149)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 15:54:48 PDT 2024


SLTozer wrote:

Thank you @arsenm for the thorough reviews - I'll fix up the remaining comments (regarding AsmPrinter) early tomorrow.

> But perhaps one example to discuss would be useful?

The script only applies to one test right now, though it's run in 4 different ways; the script is specialized for the test file, but it could be parameterized. The purpose of this test is essentially checking that FAKE_USE does what it says on the tin, that a variable that should otherwise by all rights be killed is available for its full scope.

The difficult part is that the test still isn't _narrow_; the test runs `llc` from IR to object with optimizations enabled and checks at the end that the variable under test is still available for its full scope. We could try making the checks exact, but it'd mean 4 different checks (or more if we increase coverage further) that could each change if any pass changes its behaviour. The actual check is simple I think - we read the output of dwarfdump to confirm that the parameter has a continuous location range that extends from `[prologue_end, epilogue_begin)`. Ideally we'd have a proper way of doing this, but I think it'd be messy and brittle to substitute exact checks.

I think I'd be cautious on principle about adding special scripts to run a single test, but I don't see any easy alternatives without major drawbacks, and I think this is worth testing for; ultimately if the verdict comes down against the python script, my backup proposal is to make it a Dexter test (which will need to be moved to the subsequent patch which adds front-end support).

https://github.com/llvm/llvm-project/pull/86149


More information about the llvm-commits mailing list