[llvm] [CodeGen] Use llvm::has_single_bit (NFC) (PR #143394)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 08:26:15 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/143394

None

>From e6da8f36c28c32c75dbd41287db554f85bd9a1cb Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 6 May 2025 10:52:20 -0700
Subject: [PATCH] [CodeGen] Use llvm::has_single_bit (NFC)

---
 llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h b/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
index a70acca98a5c4..727cd9abf9272 100644
--- a/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
+++ b/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
@@ -59,7 +59,7 @@ class ScoreboardHazardRecognizer : public ScheduleHazardRecognizer {
 
     InstrStage::FuncUnits& operator[](size_t idx) const {
       // Depth is expected to be a power-of-2.
-      assert(Depth && !(Depth & (Depth - 1)) &&
+      assert(llvm::has_single_bit(Depth) &&
              "Scoreboard was not initialized properly!");
 
       return Data[(Head + idx) & (Depth-1)];



More information about the llvm-commits mailing list