[llvm-dev] Analyze SCEV expression after IR is removed clarification

Markus Lavin via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 16 02:21:17 PST 2020

In short:

Shall analysis of a SCEV expression be allowed even though part of the IR that was analyzed to build the SCEV expression has been removed?

In more detail with background:

About a month ago I landed https://reviews.llvm.org/D87494 where SCEV is used to do additional debug-info salvaging in LSR. The idea was to compute (and store) a SCEV of what llvm.dbg.value intrinsics inside the loop refers to and then after LSR transformation compare these SCEVs with the current SCEVs of PHI-nodes of the loop header. If any of these match (with a possible offset) then the llvm.dbg.value intrinsic can be updated to refer to the PHI-node (with a possible offset in the DIExpression).

This use-case obviously depends on being able to analyze a SCEV where parts of the corresponding IR has been removed.

Now last week https://bugs.llvm.org/show_bug.cgi?id=48166 was reported which raises the question if this is allowed use-case or not.

Clearly if the Value that a SCEVUnknown refers to has been deleted then that renders the entire SCEV useless. But if only IR that SCEV has successfully "analyzed through" is removed then I would argue that the SCEV expression should still be analyzable.

Thoughts, comments and clarifications are welcome.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201116/18c3cf2b/attachment.html>

More information about the llvm-dev mailing list