[PATCH] D141482: [LVI][CVP] Make use of condition known at use

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 12:19:03 PST 2023


nikic added a comment.

In D141482#4044348 <https://reviews.llvm.org/D141482#4044348>, @spatel wrote:

> Seems like a nice improvement to me, but adding some more potential reviewers in case there are other opinions.
>
> If the intent is to eventually call from other places, the most basic case would be something like this?
>
>   define i16 @sel_true_cond(i16 %x) {
>     %cmp = icmp eq i16 %x, 10
>     %sel = select i1 %cmp, i16 %x, i16 42   ; can replace %x with 10
>     ret i16 %sel
>   }

Basically yes, but CVP doesn't actually perform folds that simple (just replacing a value with a known constant), it's generally some kind of instruction simplification (we do this in InstCombine though, in foldSelectValueEquivalence).


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

https://reviews.llvm.org/D141482



More information about the llvm-commits mailing list