[PATCH] D152773: [SCCP] Propagate undef when visiting some instructions

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 01:43:44 PDT 2023


StephenFan added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:1246
+                 ValueLatticeElement::getRange(
+                     Res, OpSt.isConstantRangeIncludingUndef()));
   } else
----------------
nikic wrote:
> Hm, this seems a bit inaccurate, in that something like `zext i32 undef to i64` will still produce a value where the top bits are all zero, not undef. This would be more precisely modeled by treating undef as a full-set input. But then we would no longer model the case where undef doesn't matter as accurately...
Yes. The way sccp handles undef is very conservative. For this patch, not only `zext i32 under to i64`, but also `and i32 undef, -1` will be regarded as including_undef. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152773



More information about the llvm-commits mailing list