[PATCH] D154791: [InstCombine] Transform bitwise (A >> C - 1, zext(icmp)) -> zext (bitwise(A < 0, icmp)) fold.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 13:09:31 PDT 2023


nikic added a comment.

Looks mostly fine, but I think the one-use check isn't quite correct.



================
Comment at: llvm/test/Transforms/InstCombine/and-or-icmps.ll:2670
 
 define <2 x i64> @icmp_slt_0_or_icmp_sgt_0_i64x2_fail(<2 x i64> %x) {
 ; CHECK-LABEL: @icmp_slt_0_or_icmp_sgt_0_i64x2_fail(
----------------
Not _fail?


================
Comment at: llvm/test/Transforms/InstCombine/and-or-icmps.ll:2912
+; CHECK-NEXT:    [[TMP2:%.*]] = or i1 [[TMP1]], [[A]]
+; CHECK-NEXT:    [[D:%.*]] = zext i1 [[TMP2]] to i32
 ; CHECK-NEXT:    call void @use32(i32 [[C]])
----------------
Creating more instructions here. You should probably always require one-use on the lshr rather than one-use on one of the operands.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154791



More information about the llvm-commits mailing list