[PATCH] D129636: Fix a LSR debug invariance issue

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 01:25:47 PDT 2022


mkazantsev requested changes to this revision.
mkazantsev added a comment.
This revision now requires changes to proceed.

The connection between described problem (as far as I understood, the fact that debuginfo changes IR is treated as a problem) and the proposed fix is not clear to me. The patch absolutely needs a detailed explanation, why existing SCEVs is a problem, in the commit message.

Note that, in presence of potential poison values, SCEV as well as many transform passes should treat it correctly. Sometimes "correctly" means "very conservatively", and this is what most likely happened here. Look at this:

https://godbolt.org/z/sbshjW1nM
https://godbolt.org/z/3fM8Exq6x

I've annotated the function's argument as `noundef`, and now there is no difference b/w presenting and not-presenting dbgs is in no-wrap flags in IR. This flag is there because poison argument of a call is UB by specification (didn't really check for dbg.value, but should be).

The issue will be gone if you annotate incoming parameters as noundef. Does your frontent allow this for this function?


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

https://reviews.llvm.org/D129636



More information about the llvm-commits mailing list