[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:13:22 PDT 2024
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/105889
>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 1/2] [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());
>From 2b36357018ae2ae24c64f7430cf187dd63191f2b Mon Sep 17 00:00:00 2001
From: Justin Bogner <mail at justinbogner.com>
Date: Fri, 23 Aug 2024 14:13:09 -0700
Subject: [PATCH 2/2] clang-format
---
llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
index 01c03215fb9e75..b37c7c1a6ee044 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
@@ -1,6 +1,6 @@
-#include "SPIRV.h"
#include "MCTargetDesc/SPIRVBaseInfo.h"
#include "MCTargetDesc/SPIRVMCTargetDesc.h"
+#include "SPIRV.h"
#include "SPIRVGlobalRegistry.h"
#include "SPIRVRegisterInfo.h"
#include "SPIRVTargetMachine.h"
More information about the llvm-commits
mailing list