[PATCH] D96663: [InstCombine] Fold icmp (select c, const, arg), null if arg has nonnullattr

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 22:39:04 PST 2021


xbolva00 added a comment.

In D96663#2577600 <https://reviews.llvm.org/D96663#2577600>, @spatel wrote:

> The code duplication suggests that we should have a common place for this logic (especially if it already exists in SimplifyCFG). 
> Could it be added to ValueTracking's isKnownNonZero() or wrap around that? 
> It might already be in there under isKnownNonNullFromDominatingCondition(), but we need to fix it up to deal with selects?

I dont think this could be unified so easily.

In D96663#2583945 <https://reviews.llvm.org/D96663#2583945>, @aqjune wrote:

> Make foldICmpInstWithConstantNotInt fold (select cond, null, arg) == null if arg has nonnullattr instead

But original fold was more powerful and general IMHO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96663



More information about the llvm-commits mailing list