[PATCH] D149077: [InstCombine] Add !noundef if is guaranteed do not violate !range

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 01:09:42 PDT 2023


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

In D149077#4295353 <https://reviews.llvm.org/D149077#4295353>, @nikic wrote:

> I think the right way to fix that would be to support poison flag/metadata drop in impliesPoison() transform. Even if we can't prove that the metadata does not produce poison, we can still drop it.

To expand on this: The general policy is that presence of poison flags/metadata should not block transforms, instead we should drop the flags/metadata to allow the transform. For example, when we push freeze into operands we call canCreateUndefOrPoison with ConsiderFlagsAndMetadata=false and drop those flags. The impliesPoison() based select -> and/or transform currently doesn't do this, so we may fail the transform in cases where it would succeed if we dropped flags. Supporting this will need some API changes, in particular impliesPoison() will have to collect instructions on which flags need to be dropped.

I believe this is the proper way to fix this, which will also address other uses of flags/metadata.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149077



More information about the llvm-commits mailing list