[llvm] [SPIRV] Fix warning in SPIRVMergeRegionExitTargets.cpp (PR #95283)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 11:16:49 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Helena Kotas (hekota)

<details>
<summary>Changes</summary>

Fix warning in SPIRVMergeRegionExitTargets.cpp about "non-void function does not return a value in all control paths" by changing assert to llvm_unreachable.

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


1 Files Affected:

- (modified) llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp b/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
index 52354281cdd7e..0747dd1bbaf40 100644
--- a/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
@@ -100,7 +100,7 @@ class SPIRVMergeRegionExitTargets : public FunctionPass {
     }
 
     // TODO: add support for switch cases.
-    assert(false && "Unhandled terminator type.");
+    llvm_unreachable("Unhandled terminator type.");
   }
 
   /// Replaces |BB|'s branch targets present in |ToReplace| with |NewTarget|.

``````````

</details>


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


More information about the llvm-commits mailing list