[all-commits] [llvm/llvm-project] 75c701: [amdgpu] Fix broken error detection in LDS lowering

Jon Chesterfield via All-commits all-commits at lists.llvm.org
Thu Mar 30 05:43:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75c7019b7ea4a846575337fa5cf4f1780a2d5b74
      https://github.com/llvm/llvm-project/commit/75c7019b7ea4a846575337fa5cf4f1780a2d5b74
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp

  Log Message:
  -----------
  [amdgpu] Fix broken error detection in LDS lowering

std::optional<uint32_t> can be compared to uint32_t without warning, but does
not compare to the value within the optional. It needs to be prefixed *.
Wconversion does not warn about this.
```
bool bug(uint32_t Offset, std::optional<uint32_t> Expect)
{
  return (Offset != Expect);
}
bool deref(uint32_t Offset, std::optional<uint32_t> Expect)
{
  return (Offset != *Expect);
}
```
Both compile without warnings. Wrote the former, intended the latter.

Reviewed By: arsenm

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




More information about the All-commits mailing list