[PATCH] D151421: [KnownBits] Simplify shl. NFCI.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 07:58:16 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Support/KnownBits.cpp:210-214
+    if (MinShiftAmount == BitWidth) {
+      // Always poison. Return zero because we don't like returning conflict.
+      Known.setAllZero();
+      return Known;
+    }
----------------
foad wrote:
> nikic wrote:
> > Seems like pulling this out of the `isUnknown()` branch would be cleaner, as it is not specific to unknown values.
> Yeah, maybe. This was a result of me trying to work out why this code is required, and it's only required in the LHS.isUnknown() case, otherwise it will naturally fall out in the wash. And since it will almost never happen in practice, I chose to keep it out of the main code path.
It is also only required in order to guarantee that we return zero for poison results. I've just put D151456 to check that property so we don't regress it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151421



More information about the llvm-commits mailing list