[llvm] [SPIR-V] Refactor buildMemSemanticsReg to ensure type compatibility (PR #123676)

Michal Paszkowski via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 16:09:07 PST 2025


https://github.com/michalpaszkowski updated https://github.com/llvm/llvm-project/pull/123676

>From 8110effd484a29b6e6b1cf12b34e7554a8e94219 Mon Sep 17 00:00:00 2001
From: Michal Paszkowski <michal at michalpaszkowski.com>
Date: Tue, 21 Jan 2025 00:33:11 +0100
Subject: [PATCH] [SPIR-V] Refactor buildMemSemanticsReg to ensure type
 compatibility

Fixed a type mismatch issue in the comparison of std::memory_order with
unsigned.

This fixes an issue reported by clang-debian-cpp20 buildbot for
https://github.com/llvm/llvm-project/pull/123654
---
 llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 784bbe8e662c20..5bf5e3fee37482 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -611,8 +611,7 @@ static Register buildMemSemanticsReg(Register SemanticsRegister,
     Semantics =
         getSPIRVMemSemantics(Order) |
         getMemSemanticsForStorageClass(GR->getPointerStorageClass(PtrRegister));
-
-    if (Order == Semantics) {
+    if (static_cast<unsigned>(Order) == Semantics) {
       MRI->setRegClass(SemanticsRegister, &SPIRV::iIDRegClass);
       return SemanticsRegister;
     }



More information about the llvm-commits mailing list