[PATCH] D124327: [SCCP] Add initial support for propagation through freeze.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 23 04:43:43 PDT 2022


fhahn added a comment.

In D124327#3469848 <https://reviews.llvm.org/D124327#3469848>, @nikic wrote:

> What about `constant` lattice element with a constant expression that may be undef/poison? What about `constantrange_including_undef` lattice element?

I *think* the handling in the patch should be conservatively correct, as the it should be a valid over-approximation to have the freeze result may include undef.

If we use the range to replace with a constant, the assumption is that we choose a value in the range and which particular one doesn't matter. As users of the range have to assume the value could be any in the range, I don't think we can get in a situation where 2 different users would pick different values due to undef in the range. This should effectively delay committing to a constant value for the freeze until we use the range to replace with a constant. The `_including_undef` part of the name is probably not entirely accurate. The important property is that we cannot use such ranges to perform simplifications *without* replacing the value with a constant ( (see test case`@test1_sext_op_can_be_undef_but_frozen`  in rGb2a885a290be <https://reviews.llvm.org/rGb2a885a290be0ff9d2524cb1ed0b7b19a0fe6a8b>)

If we would need to commit to eliminating the `undef` part of a range at the point we mark the result of the freeze we would have to mark it as overdefined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124327



More information about the llvm-commits mailing list