[llvm] [SPIR-V] Replace assert with report_fatal (PR #118617)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 04:08:31 PST 2024


https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/118617

Irreducible must always be rejected, not only in debug builds.

>From d4b2ec484ad24eb3819c686bb6fffe7e6307f33e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= <brioche at google.com>
Date: Wed, 4 Dec 2024 13:06:46 +0100
Subject: [PATCH] [SPIR-V] Replace assert with report_fatal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Irreducible must always be rejected, not only in debug builds.

Signed-off-by: Nathan Gauër <brioche at google.com>
---
 llvm/lib/Target/SPIRV/SPIRVUtils.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
index 50338f5df90281..6f30638144d885 100644
--- a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
@@ -570,8 +570,9 @@ size_t PartialOrderingVisitor::visit(BasicBlock *BB, size_t Unused) {
 
     if (!CanBeVisited(BB)) {
       ToVisit.push(BB);
-      assert(QueueIndex < ToVisit.size() &&
-             "No valid candidate in the queue. Is the graph reducible?");
+      if (QueueIndex >= ToVisit.size())
+        llvm::report_fatal_error(
+            "No valid candidate in the queue. Is the graph reducible?");
       QueueIndex++;
       continue;
     }



More information about the llvm-commits mailing list