[PATCH] D142783: [InstCombine][LV] Fold (add (zext (add X, -1)), 1) -> (zext X) if X is non-zero.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 15:42:40 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/add.ll:2901
+  call void @llvm.assume(i1 %z)
+  %a = sub i8 %x, 1
+  %b = zext i8 %a to i32
----------------
spatel wrote:
> This will get canonicalized to `add`, or many other things will break. So there's not much value in this particular test IMO.
Ok I'll remove it. I took inspiration from the `icmp_dec_assume_nonzero` and `icmp_dec_sub_assume_nonzero` tests in icmp-add.ll which also use isKnownNonZero.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142783



More information about the llvm-commits mailing list