Skip to content

[SPIRV] Fix warning in SPIRVMergeRegionExitTargets.cpp #95283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

hekota
Copy link
Member

@hekota hekota commented Jun 12, 2024

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

@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2024

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

Author: Helena Kotas (hekota)

Changes

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 --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|.

@hekota hekota requested a review from Keenuts June 12, 2024 18:17
Copy link
Contributor

@Keenuts Keenuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
How did you get this warning? (Don't have it on my local build)

@hekota hekota merged commit 525c25a into llvm:main Jun 13, 2024
10 checks passed
@hekota
Copy link
Member Author

hekota commented Jun 13, 2024

I've seen it in my local build, this is my config:

cmake -G "Ninja" -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link -DCMAKE_BUILD_TYPE=Debug -DLLVM_PARALLEL_COMPILE_JOBS=60 -DLLVM_PARALLEL_LINK_JOBS=4 -DCMAKE_WARN_DEPRECATED=FALSE -S C:\llvm-project\llvm -B C:\llvm-project\build\x64-Debug -C C:\llvm-project\clang\cmake\caches\HLSL.cmake

@Keenuts
Copy link
Contributor

Keenuts commented Jun 14, 2024

Thanks!

EthanLuisMcDonough pushed a commit to EthanLuisMcDonough/llvm-project that referenced this pull request Aug 13, 2024
Fix warning in SPIRVMergeRegionExitTargets.cpp about "non-void function
does not return a value in all control paths" by changing assert to
llvm_unreachable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants