[llvm] fix build error in MSVC build (PR #86622)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 20:10:12 PDT 2024


https://github.com/SevenIsSeven created https://github.com/llvm/llvm-project/pull/86622

This commit(https://github.com/llvm/llvm-project/pull/84738) introduced following compile warning then treated-as-error in MSVC build.

>>>"'^': unsafe mix of type 'unsigned int' and type 'bool' in operation"

>From 3094482cbf07a52cd651dc786e9de6bd67fbcfae Mon Sep 17 00:00:00 2001
From: Seven <Seven.Li at amd.com>
Date: Tue, 26 Mar 2024 11:52:09 +0900
Subject: [PATCH] fix build error in MSVC build

This commit(https://github.com/llvm/llvm-project/pull/84738) introduced
following compile warning then treated-as-error in MSVC build.

>>>"'^': unsafe mix of type 'unsigned int' and type 'bool' in operation"
---
 llvm/include/llvm/IR/BasicBlock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 0eea4cdccca5bb..ca87e40727c71d 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -791,7 +791,7 @@ template <> struct DenseMapInfo<BasicBlock::iterator> {
   static unsigned getHashValue(const BasicBlock::iterator &It) {
     return DenseMapInfo<void *>::getHashValue(
                reinterpret_cast<void *>(It.getNodePtr())) ^
-           It.getHeadBit();
+           (int) It.getHeadBit();
   }
 
   static bool isEqual(const BasicBlock::iterator &LHS,



More information about the llvm-commits mailing list