[PATCH] D108992: [KnownBits] Add support for X*X self-multiplication

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 6 11:20:22 PST 2022


RKSimon added a comment.

In D108992#3264920 <https://reviews.llvm.org/D108992#3264920>, @craig.topper wrote:

> In D108992#3264899 <https://reviews.llvm.org/D108992#3264899>, @RKSimon wrote:
>
>> OK, I'll add isGuaranteedNotToBeUndefOrPoison handling
>
> Is the "The product of a number with itself is non-negative." case in ValueTracking.cpp's `computeKnownBitsMul` also broken for the same reason?

Looks OK, Alive2:

  ----------------------------------------
  define i8 @src(i8 %x) {
    %m = mul nsw i8 %x, %x
    %s = lshr i8 %m, 7
    ret i8 %s
  }
  =>
  define i8 @tgt(i8 %x) {
    ret i8 0
  }
  Transformation seems to be correct!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108992



More information about the llvm-commits mailing list