[all-commits] [llvm/llvm-project] 51fa20: [DAG] Fold (setcc ((x | x >> c0 | ...) & mask)) se...

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Tue Jul 29 04:09:18 PDT 2025


  Branch: refs/heads/users/pierre-vh/dag-combine-workitems-intrinsics
  Home:   https://github.com/llvm/llvm-project
  Commit: 51fa20db2af5513bc6915b6df9bc17f5e22fe0ab
      https://github.com/llvm/llvm-project/commit/51fa20db2af5513bc6915b6df9bc17f5e22fe0ab
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-07-29 (Tue, 29 Jul 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AMDGPU/workitem-intrinsic-opts.ll

  Log Message:
  -----------
  [DAG] Fold (setcc ((x | x >> c0 | ...) & mask)) sequences

Fold sequences where we extract a bunch of contiguous bits from a value,
merge them into the low bit and then check if the low bits are zero or not.

It seems like a strange sequence at first but it's an idiom used by device
libs in device libs to check workitem IDs for AMDGPU.

The reason I put this in DAGCombiner instead of the target combiner is
because this is a generic, valid transform that's also fairly niche, so
there isn't much risk of a combine loop I think.

See #136727


  Commit: 262994c111f5327f2b31bca203f530201f282d67
      https://github.com/llvm/llvm-project/commit/262994c111f5327f2b31bca203f530201f282d67
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-07-29 (Tue, 29 Jul 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/AMDGPU/merged-bfx-opt.ll

  Log Message:
  -----------
  comments


  Commit: be70e003727d587609ea780f134eee9f9725a1d3
      https://github.com/llvm/llvm-project/commit/be70e003727d587609ea780f134eee9f9725a1d3
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-07-29 (Tue, 29 Jul 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AMDGPU/merged-bfx-opt.ll

  Log Message:
  -----------
  comments


Compare: https://github.com/llvm/llvm-project/compare/2ae6cfd33a8b...be70e003727d

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