[llvm] 3e763db - [SPIRV] Fix return type mismatch for createSPIRVEmitNonSemanticDIPass (#105889)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 14:55:43 PDT 2024


Author: Justin Bogner
Date: 2024-08-23T14:55:40-07:00
New Revision: 3e763db81607c71d0bb2eb4c01721ac6965d8de7

URL: https://github.com/llvm/llvm-project/commit/3e763db81607c71d0bb2eb4c01721ac6965d8de7
DIFF: https://github.com/llvm/llvm-project/commit/3e763db81607c71d0bb2eb4c01721ac6965d8de7.diff

LOG: [SPIRV] Fix return type mismatch for createSPIRVEmitNonSemanticDIPass (#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.

Fixes a build break after #97558

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
index cc506356e39043..b37c7c1a6ee044 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
@@ -1,5 +1,6 @@
 #include "MCTargetDesc/SPIRVBaseInfo.h"
 #include "MCTargetDesc/SPIRVMCTargetDesc.h"
+#include "SPIRV.h"
 #include "SPIRVGlobalRegistry.h"
 #include "SPIRVRegisterInfo.h"
 #include "SPIRVTargetMachine.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