[PATCH] D141129: [InstCombine] Use KnownBits for lshr/add -> (a + b < a)

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 01:10:55 PST 2023


foad added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:873-874
 
-  // X/Y are zexts from `ShAmt`-sized ints.
-  if (X->getType()->getScalarSizeInBits() != ShAmt ||
-      Y->getType()->getScalarSizeInBits() != ShAmt)
+  if (ComputeMaxUnsignedSignificantBits(X, 0, &I) != ShAmt ||
+      ComputeMaxUnsignedSignificantBits(Y, 0, &I) != ShAmt)
     return nullptr;
----------------
Should be '>' instead of '!=' surely? It would be fine if these values happen to have //more// leading zeros than required.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141129



More information about the llvm-commits mailing list