[llvm] [SPIRV] Fix return type mismatch for createSPIRVEmitNonSemanticDIPass (PR #105889)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 14:07:20 PDT 2024
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/105889
The declaration in SPIRV.h had this returning a `MachineFunctionPass *`, but the implementation returned a `FunctionPass *`. This showed up as a build error on windows, but it was clearly a mistake regardless.
I also updated the pass to include SPIRV.h rather than using its own declarations for pass initialization, as this results in better errors for this kind of typo.
>From cbc7dbbb80fe2c3049cb414535ce31adcad8d8e1 Mon Sep 17 00:00:00 2001
From: Justin Bogner <mail at justinbogner.com>
Date: Fri, 23 Aug 2024 14:02:45 -0700
Subject: [PATCH] [SPIRV] Fix return type mismatch for
createSPIRVEmitNonSemanticDIPass
The declaration in SPIRV.h had this returning a `MachineFunctionPass
*`, but the implementation returned a `FunctionPass *`. This showed up
as a build error on windows, but it was clearly a mistake regardless.
I also updated the pass to include SPIRV.h rather than using its own
declarations for pass initialization, as this results in better errors
for this kind of typo.
---
llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
index cc506356e39043..01c03215fb9e75 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
@@ -1,3 +1,4 @@
+#include "SPIRV.h"
#include "MCTargetDesc/SPIRVBaseInfo.h"
#include "MCTargetDesc/SPIRVMCTargetDesc.h"
#include "SPIRVGlobalRegistry.h"
@@ -33,12 +34,6 @@ struct SPIRVEmitNonSemanticDI : public MachineFunctionPass {
bool IsGlobalDIEmitted = false;
bool emitGlobalDI(MachineFunction &MF);
};
-
-void initializeSPIRVEmitNonSemanticDIPass(PassRegistry &);
-
-FunctionPass *createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM) {
- return new SPIRVEmitNonSemanticDI(TM);
-}
} // namespace llvm
using namespace llvm;
@@ -48,6 +43,11 @@ INITIALIZE_PASS(SPIRVEmitNonSemanticDI, DEBUG_TYPE,
char SPIRVEmitNonSemanticDI::ID = 0;
+MachineFunctionPass *
+llvm::createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM) {
+ return new SPIRVEmitNonSemanticDI(TM);
+}
+
SPIRVEmitNonSemanticDI::SPIRVEmitNonSemanticDI(SPIRVTargetMachine *TM)
: MachineFunctionPass(ID), TM(TM) {
initializeSPIRVEmitNonSemanticDIPass(*PassRegistry::getPassRegistry());
More information about the llvm-commits
mailing list