[all-commits] [llvm/llvm-project] 90297b: [AMDGPU] Fix wrong truth table in BitOp3_Op for sh...

carlobertolli via All-commits all-commits at lists.llvm.org
Wed Jun 10 08:13:59 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 90297b8aa167248e7bf73a384476d12218b9375b
      https://github.com/llvm/llvm-project/commit/90297b8aa167248e7bf73a384476d12218b9375b
  Author: carlobertolli <carlo.bertolli at amd.com>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
    A llvm/test/CodeGen/AMDGPU/bitop3-shared-operand.ll

  Log Message:
  -----------
  [AMDGPU] Fix wrong truth table in BitOp3_Op for shared sub-expressions. (#198556)

When the LHS and RHS of a boolean node share a common sub-expression,
LHS recursion can decompose that shared node via the "replace parent
operator" mechanism in getOperandBits (Src[I] = Op where Src[I] == In).
This replaces the Src slot that RHS was originally mapped to with a
sub-operand. If RHS recursion then fails to re-derive its own
decomposition, RHSBits still refers to the old slot index — but the slot
now holds a different value, producing an incorrect truth table.

Fix this by tracking which Src slot RHS occupies before LHS recursion.
If RHS recursion fails and that specific slot was modified, roll back
Src and the bit assignments to the pre-recursion state.

Add a test to show a specific example.

Assisted-by: Cursor (Claude)



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