[all-commits] [llvm/llvm-project] 08131c: [AMDGPU] Fix a miscompile with S_ADD/S_SUB

Piotr Sobczak via All-commits all-commits at lists.llvm.org
Wed Feb 17 03:26:53 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 08131c7439336e84b9df3e37b3aaeb76b8f60702
      https://github.com/llvm/llvm-project/commit/08131c7439336e84b9df3e37b3aaeb76b8f60702
  Author: Piotr Sobczak <Piotr.Sobczak at amd.com>
  Date:   2021-02-17 (Wed, 17 Feb 2021)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    A llvm/test/CodeGen/AMDGPU/combine-add-zext-xor.ll

  Log Message:
  -----------
  [AMDGPU] Fix a miscompile with S_ADD/S_SUB

The helper function isBoolSGPR is too aggressive when determining
when a v_cndmask can be skipped on a boolean value because the
function does not check the operands of and/or/xor.

This can be problematic for the Add/Sub combines that can leave
bits set even for inactive lanes leading to wrong results.

Fix this by inspecting the operands of and/or/xor recursively.

Differential Revision: https://reviews.llvm.org/D86878




More information about the All-commits mailing list