[PATCH] D104648: [Mem2Reg] Use poison instead of undef for read of uninitialized memory

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 17:05:19 PDT 2021


efriedma added a comment.

In D104648#2831212 <https://reviews.llvm.org/D104648#2831212>, @aqjune wrote:

> This is a big change because AFAIK clang intentionally encodes the value of uninitialized variables in a benign way.
> For example: https://godbolt.org/z/EYjasxM1M is optimized to 0 even if it is undef ^ undef = undef. If poison is used, this won't work.

I'm not sure what you're getting at here.  This isn't a difference between undef and poison.  It's perfectly legal to fold "poison ^ poison -> 0".  And we probably should, just to avoid the hassle involved in diagnosing the issues that would result from changing this fold.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104648



More information about the llvm-commits mailing list