[all-commits] [llvm/llvm-project] 79ce93: [InstCombine] Extend `(lshr/shl (shl/lshr -1, x), ...

goldsteinn via All-commits all-commits at lists.llvm.org
Tue Feb 13 10:53:49 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 79ce933114e46c891a5632f7ad4a004b93a5b808
      https://github.com/llvm/llvm-project/commit/79ce933114e46c891a5632f7ad4a004b93a5b808
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
    M llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-eq-to-icmp-ule.ll
    M llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v4-and-icmp-ne-to-icmp-ugt.ll
    M llvm/test/Transforms/InstCombine/partally-redundant-left-shift-input-masking-after-truncation-variant-d.ll
    M llvm/test/Transforms/InstCombine/partally-redundant-left-shift-input-masking-variant-d.ll
    M llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-after-truncation-variant-d.ll
    M llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-d.ll

  Log Message:
  -----------
  [InstCombine] Extend `(lshr/shl (shl/lshr -1, x), x)` -> `(lshr/shl -1, x)` for multi-use

We previously did this iff the inner `(shl/lshr -1, x)` was
one-use. No instructions are added even if the inner `(shl/lshr -1,
x)` is multi-use and this canonicalization both makes the resulting
instruction easier to analyze and shrinks its dependency chain.

Closes #81576




More information about the All-commits mailing list