[PATCH] D153148: [InstCombine] Fold `(-1 + A) & B` into `A ? 0 : B` where A is effectively a bool
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 4 11:53:32 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/binop-cast.ll:307
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X]], 0
+; CHECK-NEXT: [[RES:%.*]] = select i1 [[TMP1]], i32 [[Y]], i32 0
; CHECK-NEXT: ret i32 [[RES]]
----------------
I'm not sure this isn't a regression.
Generally I'd think `add; and` is as easier to analyze than `icmp; select` and likely to get better codegen. I think maybe this should only be done if we can actuall save inst count (so above require the `zext`).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153148/new/
https://reviews.llvm.org/D153148
More information about the llvm-commits
mailing list