[PATCH] D112634: [InstCombine] canonicalize icmp with trunc op into mask and cmp, part 2

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 18:20:52 PST 2022


MatzeB added a comment.

It seems this leads to slightly worse x86 codegen. Where we previously had:

  %v1 = trunc i64 %v0 to i32
  %cmp = icmp slt i32 %v1, 0

resulting in:

  testl   %eax, %eax
  js      .LBB0_1

instcombine now changes this to:

  %v1 = and i64 %v0, 2147483648
  %cmp = icmp eq i64 %v1, 0

resulting in

  testl   $-2147483648, %eax              # imm = 0x80000000
  jne     .LBB0_2

Though I guess we best fix this by adding more x86 patterns...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112634



More information about the llvm-commits mailing list