[amdgpu] Fix broken error detection in LDS lowering
authorJon Chesterfield <jonathanchesterfield@gmail.com>
Thu, 30 Mar 2023 12:42:37 +0000 (13:42 +0100)
committerJon Chesterfield <jonathanchesterfield@gmail.com>
Thu, 30 Mar 2023 12:42:38 +0000 (13:42 +0100)
commit75c7019b7ea4a846575337fa5cf4f1780a2d5b74
tree029642d3991ede97b1318907d54ae274d7109a3a
parent273cbb58e5e272d265a247234555a42526ee5e9a
[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
llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp