[llvm] [SPIRV] Fix return value of runOnModule for SPIRVPrepareFunctions (PR #184636)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 07:44:11 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Nick Sarnie (sarnex)

<details>
<summary>Changes</summary>

We need to return `true` if the module is changed by the pass, and we forgot to do that in this new case.

This fixes a buildbot [fail](https://lab.llvm.org/buildbot/#/builders/187/builds/17475).

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


1 Files Affected:

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


``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp b/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
index 219dd2b7f0ca0..06b39800d2f06 100644
--- a/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
@@ -666,6 +666,7 @@ bool SPIRVPrepareFunctions::runOnModule(Module &M) {
       .getMutableSubtargetImpl()
       ->resolveEnvFromModule(M);
 
+  bool Changed = false;
   if (M.functions().empty()) {
     // If there are no functions, insert a service
     // function so that the global/constant tracking intrinsics
@@ -675,9 +676,9 @@ bool SPIRVPrepareFunctions::runOnModule(Module &M) {
     BasicBlock *BB = BasicBlock::Create(M.getContext(), "entry", SF);
     IRBuilder<> IRB(BB);
     IRB.CreateRetVoid();
+    Changed = true;
   }
 
-  bool Changed = false;
   for (Function &F : M) {
     Changed |= substituteIntrinsicCalls(&F);
     Changed |= sortBlocks(F);

``````````

</details>


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


More information about the llvm-commits mailing list