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

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 04:09:09 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-spir-v

Author: Nathan Gauër (Keenuts)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/118617.diff


1 Files Affected:

- (modified) llvm/lib/Target/SPIRV/SPIRVUtils.cpp (+3-2) 


``````````diff
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;
     }

``````````

</details>


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


More information about the llvm-commits mailing list