[all-commits] [llvm/llvm-project] 170a21: [InstCombine] Extend Fold of Zero-extended Bit Tes...

Marius Kamp via All-commits all-commits at lists.llvm.org
Wed Aug 21 05:09:24 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 170a21e7f00d0097d88cba3547967e500e0d8dfe
      https://github.com/llvm/llvm-project/commit/170a21e7f00d0097d88cba3547967e500e0d8dfe
  Author: Marius Kamp <msk at posteo.org>
  Date:   2024-08-21 (Wed, 21 Aug 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/zext.ll

  Log Message:
  -----------
  [InstCombine] Extend Fold of Zero-extended Bit Test (#102100)

Previously, (zext (icmp ne (and X, (1 << ShAmt)), 0)) has only been
folded if the bit width of X and the result were equal. Use a trunc or
zext instruction to also support other bit widths.
    
This is a follow-up to commit 533190acdb9d2ed774f96a998b5c03be3df4f857,
which introduced a regression: (zext (icmp ne (and (lshr X ShAmt) 1) 0))
is not folded any longer to (zext/trunc (and (lshr X ShAmt) 1)) since
the commit introduced the fold of (icmp ne (and (lshr X ShAmt) 1) 0) to
(icmp ne (and X (1 << ShAmt)) 0). The change introduced by this commit
restores this fold.
    
Alive proof: https://alive2.llvm.org/ce/z/MFkNXs
    
Relates to issue #86813 and pull request #101838.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list