diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp @@ -135,7 +135,7 @@ if (GV && !canElideModuleLDS(F)) { unsigned Offset = allocateLDSGlobal(M->getDataLayout(), *GV, Align()); std::optional Expect = getLDSAbsoluteAddress(*GV); - if (!Expect || (Offset != Expect)) { + if (!Expect || (Offset != *Expect)) { report_fatal_error("Inconsistent metadata on module LDS variable"); } } @@ -145,7 +145,7 @@ // before any other non-module LDS variables. unsigned Offset = allocateLDSGlobal(M->getDataLayout(), *KV, Align()); std::optional Expect = getLDSAbsoluteAddress(*KV); - if (!Expect || (Offset != Expect)) { + if (!Expect || (Offset != *Expect)) { report_fatal_error("Inconsistent metadata on kernel LDS variable"); } }