[llvm] [SPIR-V][NewPM] Register SPIRVEmitIntrinsics with the new pass manager (PR #209966)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 22:13:40 PDT 2026


https://github.com/aobolensk created https://github.com/llvm/llvm-project/pull/209966

None

>From a32b87b94e093598449cd3371e53a65466ee6485 Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <arseniy.obolenskiy at amd.com>
Date: Thu, 16 Jul 2026 07:12:46 +0200
Subject: [PATCH] [SPIR-V][NewPM] Register SPIRVEmitIntrinsics with the new
 pass manager

---
 llvm/lib/Target/SPIRV/SPIRV.h                 |   2 +-
 llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp | 255 +++++++++---------
 llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp  |   2 +-
 3 files changed, 135 insertions(+), 124 deletions(-)

diff --git a/llvm/lib/Target/SPIRV/SPIRV.h b/llvm/lib/Target/SPIRV/SPIRV.h
index 42c4ef149539e..f352bb1da5dca 100644
--- a/llvm/lib/Target/SPIRV/SPIRV.h
+++ b/llvm/lib/Target/SPIRV/SPIRV.h
@@ -49,7 +49,7 @@ void initializeSPIRVPostLegalizerPass(PassRegistry &);
 void initializeSPIRVStructurizerPass(PassRegistry &);
 void initializeSPIRVCBufferAccessLegacyPass(PassRegistry &);
 void initializeSPIRVPushConstantAccessLegacyPass(PassRegistry &);
-void initializeSPIRVEmitIntrinsicsPass(PassRegistry &);
+void initializeSPIRVEmitIntrinsicsLegacyPass(PassRegistry &);
 void initializeSPIRVLegalizePointerCastLegacyPass(PassRegistry &);
 void initializeSPIRVRegularizerLegacyPass(PassRegistry &);
 void initializeSPIRVMergeRegionExitTargetsLegacyPass(PassRegistry &);
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
index 19e1e71488ee3..e5afaa5c63e4b 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
@@ -180,9 +180,8 @@ static std::optional<uint64_t> getByteAddressingMultiplier(Type *Ty) {
   return std::nullopt;
 }
 
-class SPIRVEmitIntrinsics
-    : public ModulePass,
-      public InstVisitor<SPIRVEmitIntrinsics, Instruction *> {
+class SPIRVEmitIntrinsicsImpl
+    : public InstVisitor<SPIRVEmitIntrinsicsImpl, Instruction *> {
   const SPIRVTargetMachine &TM;
   SPIRVGlobalRegistry *GR = nullptr;
   Function *CurrF = nullptr;
@@ -382,8 +381,7 @@ class SPIRVEmitIntrinsics
   Instruction *buildLogicalAccessChainFromGEP(GetElementPtrInst &GEP);
 
 public:
-  static char ID;
-  SPIRVEmitIntrinsics(const SPIRVTargetMachine &TM) : ModulePass(ID), TM(TM) {}
+  SPIRVEmitIntrinsicsImpl(const SPIRVTargetMachine &TM) : TM(TM) {}
   Instruction *visitInstruction(Instruction &I) { return &I; }
   Instruction *visitSwitchInst(SwitchInst &I);
   Instruction *visitGetElementPtrInst(GetElementPtrInst &I);
@@ -400,12 +398,21 @@ class SPIRVEmitIntrinsics
   Instruction *visitUnreachableInst(UnreachableInst &I);
   Instruction *visitCallInst(CallInst &I);
 
-  StringRef getPassName() const override { return "SPIRV emit intrinsics"; }
+  bool runOnModule(Module &M);
+};
 
-  bool runOnModule(Module &M) override;
+class SPIRVEmitIntrinsicsLegacy : public ModulePass {
+  const SPIRVTargetMachine &TM;
+
+public:
+  static char ID;
+  SPIRVEmitIntrinsicsLegacy(const SPIRVTargetMachine &TM)
+      : ModulePass(ID), TM(TM) {}
 
-  void getAnalysisUsage(AnalysisUsage &AU) const override {
-    ModulePass::getAnalysisUsage(AU);
+  StringRef getPassName() const override { return "SPIRV emit intrinsics"; }
+
+  bool runOnModule(Module &M) override {
+    return SPIRVEmitIntrinsicsImpl(TM).runOnModule(M);
   }
 };
 
@@ -432,9 +439,9 @@ Value *getPointerRoot(Value *I) {
 
 } // namespace
 
-char SPIRVEmitIntrinsics::ID = 0;
+char SPIRVEmitIntrinsicsLegacy::ID = 0;
 
-INITIALIZE_PASS(SPIRVEmitIntrinsics, "spirv-emit-intrinsics",
+INITIALIZE_PASS(SPIRVEmitIntrinsicsLegacy, "spirv-emit-intrinsics",
                 "SPIRV emit intrinsics", false, false)
 
 static inline bool isAssignTypeInstr(const Instruction *I) {
@@ -518,8 +525,8 @@ static void emitAssignName(Instruction *I, IRBuilder<> &B) {
   B.CreateIntrinsic(Intrinsic::spv_assign_name, {I->getType()}, Args);
 }
 
-void SPIRVEmitIntrinsics::replaceAllUsesWith(Value *Src, Value *Dest,
-                                             bool DeleteOld) {
+void SPIRVEmitIntrinsicsImpl::replaceAllUsesWith(Value *Src, Value *Dest,
+                                                 bool DeleteOld) {
   GR->replaceAllUsesWith(Src, Dest, DeleteOld);
   // Update uncomplete type records if any
   if (isTodoType(Src)) {
@@ -529,10 +536,10 @@ void SPIRVEmitIntrinsics::replaceAllUsesWith(Value *Src, Value *Dest,
   }
 }
 
-void SPIRVEmitIntrinsics::replaceAllUsesWithAndErase(IRBuilder<> &B,
-                                                     Instruction *Src,
-                                                     Instruction *Dest,
-                                                     bool DeleteOld) {
+void SPIRVEmitIntrinsicsImpl::replaceAllUsesWithAndErase(IRBuilder<> &B,
+                                                         Instruction *Src,
+                                                         Instruction *Dest,
+                                                         bool DeleteOld) {
   replaceAllUsesWith(Src, Dest, DeleteOld);
   std::string Name = Src->hasName() ? Src->getName().str() : "";
   Src->eraseFromParent();
@@ -574,8 +581,9 @@ static inline Type *restoreMutatedType(SPIRVGlobalRegistry *GR, Instruction *I,
 
 // Reconstruct type with nested element types according to deduced type info.
 // Return nullptr if no detailed type info is available.
-Type *SPIRVEmitIntrinsics::reconstructType(Value *Op, bool UnknownElemTypeI8,
-                                           bool IsPostprocessing) {
+Type *SPIRVEmitIntrinsicsImpl::reconstructType(Value *Op,
+                                               bool UnknownElemTypeI8,
+                                               bool IsPostprocessing) {
   Type *Ty = Op->getType();
   if (auto *OpI = dyn_cast<Instruction>(Op)) {
     Ty = restoreMutatedType(GR, OpI, Ty);
@@ -602,8 +610,8 @@ Type *SPIRVEmitIntrinsics::reconstructType(Value *Op, bool UnknownElemTypeI8,
   return nullptr;
 }
 
-CallInst *SPIRVEmitIntrinsics::buildSpvPtrcast(Function *F, Value *Op,
-                                               Type *ElemTy) {
+CallInst *SPIRVEmitIntrinsicsImpl::buildSpvPtrcast(Function *F, Value *Op,
+                                                   Type *ElemTy) {
   IRBuilder<> B(Op->getContext());
   if (auto *OpI = dyn_cast<Instruction>(Op)) {
     // spv_ptrcast's argument Op denotes an instruction that generates
@@ -625,7 +633,7 @@ CallInst *SPIRVEmitIntrinsics::buildSpvPtrcast(Function *F, Value *Op,
   return PtrCasted;
 }
 
-void SPIRVEmitIntrinsics::replaceUsesOfWithSpvPtrcast(
+void SPIRVEmitIntrinsicsImpl::replaceUsesOfWithSpvPtrcast(
     Value *Op, Type *ElemTy, Instruction *I,
     DenseMap<Function *, CallInst *> Ptrcasts) {
   Function *F = I->getParent()->getParent();
@@ -640,7 +648,7 @@ void SPIRVEmitIntrinsics::replaceUsesOfWithSpvPtrcast(
   I->replaceUsesOfWith(Op, PtrCastedI);
 }
 
-void SPIRVEmitIntrinsics::propagateElemType(
+void SPIRVEmitIntrinsicsImpl::propagateElemType(
     Value *Op, Type *ElemTy,
     DenseSet<std::pair<Value *, Value *>> &VisitedSubst) {
   DenseMap<Function *, CallInst *> Ptrcasts;
@@ -658,7 +666,7 @@ void SPIRVEmitIntrinsics::propagateElemType(
   }
 }
 
-void SPIRVEmitIntrinsics::propagateElemTypeRec(
+void SPIRVEmitIntrinsicsImpl::propagateElemTypeRec(
     Value *Op, Type *PtrElemTy, Type *CastElemTy,
     DenseSet<std::pair<Value *, Value *>> &VisitedSubst) {
   SmallPtrSet<Value *, 0> Visited;
@@ -667,7 +675,7 @@ void SPIRVEmitIntrinsics::propagateElemTypeRec(
                        std::move(Ptrcasts));
 }
 
-void SPIRVEmitIntrinsics::propagateElemTypeRec(
+void SPIRVEmitIntrinsicsImpl::propagateElemTypeRec(
     Value *Op, Type *PtrElemTy, Type *CastElemTy,
     DenseSet<std::pair<Value *, Value *>> &VisitedSubst,
     SmallPtrSetImpl<Value *> &Visited,
@@ -691,15 +699,14 @@ void SPIRVEmitIntrinsics::propagateElemTypeRec(
 // Set element pointer type to the given value of ValueTy and tries to
 // specify this type further (recursively) by Operand value, if needed.
 
-Type *
-SPIRVEmitIntrinsics::deduceElementTypeByValueDeep(Type *ValueTy, Value *Operand,
-                                                  bool UnknownElemTypeI8) {
+Type *SPIRVEmitIntrinsicsImpl::deduceElementTypeByValueDeep(
+    Type *ValueTy, Value *Operand, bool UnknownElemTypeI8) {
   SmallPtrSet<Value *, 0> Visited;
   return deduceElementTypeByValueDeep(ValueTy, Operand, Visited,
                                       UnknownElemTypeI8);
 }
 
-Type *SPIRVEmitIntrinsics::deduceElementTypeByValueDeep(
+Type *SPIRVEmitIntrinsicsImpl::deduceElementTypeByValueDeep(
     Type *ValueTy, Value *Operand, SmallPtrSetImpl<Value *> &Visited,
     bool UnknownElemTypeI8) {
   Type *Ty = ValueTy;
@@ -717,7 +724,7 @@ Type *SPIRVEmitIntrinsics::deduceElementTypeByValueDeep(
 }
 
 // Traverse User instructions to deduce an element pointer type of the operand.
-Type *SPIRVEmitIntrinsics::deduceElementTypeByUsersDeep(
+Type *SPIRVEmitIntrinsicsImpl::deduceElementTypeByUsersDeep(
     Value *Op, SmallPtrSetImpl<Value *> &Visited, bool UnknownElemTypeI8) {
   if (!Op || !isPointerTy(Op->getType()) || isa<ConstantPointerNull>(Op) ||
       isa<UndefValue>(Op))
@@ -754,14 +761,15 @@ static Type *getPointeeTypeByCallInst(StringRef DemangledName,
 
 // Deduce and return a successfully deduced Type of the Instruction,
 // or nullptr otherwise.
-Type *SPIRVEmitIntrinsics::deduceElementTypeHelper(Value *I,
-                                                   bool UnknownElemTypeI8) {
+Type *SPIRVEmitIntrinsicsImpl::deduceElementTypeHelper(Value *I,
+                                                       bool UnknownElemTypeI8) {
   SmallPtrSet<Value *, 0> Visited;
   return deduceElementTypeHelper(I, Visited, UnknownElemTypeI8);
 }
 
-void SPIRVEmitIntrinsics::maybeAssignPtrType(Type *&Ty, Value *Op, Type *RefTy,
-                                             bool UnknownElemTypeI8) {
+void SPIRVEmitIntrinsicsImpl::maybeAssignPtrType(Type *&Ty, Value *Op,
+                                                 Type *RefTy,
+                                                 bool UnknownElemTypeI8) {
   if (isUntypedPointerTy(RefTy)) {
     if (!UnknownElemTypeI8)
       return;
@@ -772,7 +780,7 @@ void SPIRVEmitIntrinsics::maybeAssignPtrType(Type *&Ty, Value *Op, Type *RefTy,
   Ty = RefTy;
 }
 
-bool SPIRVEmitIntrinsics::walkLogicalAccessChainDynamic(
+bool SPIRVEmitIntrinsicsImpl::walkLogicalAccessChainDynamic(
     Type *CurType, Value *Operand, uint64_t Multiplier,
     const std::function<void(Type *, uint64_t)> &OnLiteralIndexing,
     const std::function<void(Type *, Value *, uint64_t)> &OnDynamicIndexing) {
@@ -796,7 +804,7 @@ bool SPIRVEmitIntrinsics::walkLogicalAccessChainDynamic(
   return AT == nullptr;
 }
 
-bool SPIRVEmitIntrinsics::walkLogicalAccessChainConstant(
+bool SPIRVEmitIntrinsicsImpl::walkLogicalAccessChainConstant(
     Type *CurType, uint64_t Offset,
     const std::function<void(Type *, uint64_t)> &OnLiteralIndexing) {
   auto &DL = CurrF->getDataLayout();
@@ -838,7 +846,7 @@ bool SPIRVEmitIntrinsics::walkLogicalAccessChainConstant(
   return false;
 }
 
-bool SPIRVEmitIntrinsics::walkLogicalAccessChain(
+bool SPIRVEmitIntrinsicsImpl::walkLogicalAccessChain(
     GetElementPtrInst &GEP,
     const std::function<void(Type *, uint64_t)> &OnLiteralIndexing,
     const std::function<void(Type *, Value *, uint64_t)> &OnDynamicIndexing) {
@@ -862,8 +870,8 @@ bool SPIRVEmitIntrinsics::walkLogicalAccessChain(
                                        OnLiteralIndexing, OnDynamicIndexing);
 }
 
-Instruction *
-SPIRVEmitIntrinsics::buildLogicalAccessChainFromGEP(GetElementPtrInst &GEP) {
+Instruction *SPIRVEmitIntrinsicsImpl::buildLogicalAccessChainFromGEP(
+    GetElementPtrInst &GEP) {
   auto &DL = CurrF->getDataLayout();
   IRBuilder<> B(GEP.getParent());
   B.SetInsertPoint(&GEP);
@@ -913,7 +921,7 @@ SPIRVEmitIntrinsics::buildLogicalAccessChainFromGEP(GetElementPtrInst &GEP) {
   return NewI;
 }
 
-Type *SPIRVEmitIntrinsics::getGEPTypeLogical(GetElementPtrInst *GEP) {
+Type *SPIRVEmitIntrinsicsImpl::getGEPTypeLogical(GetElementPtrInst *GEP) {
 
   Type *CurType = GEP->getResultElementType();
 
@@ -924,7 +932,7 @@ Type *SPIRVEmitIntrinsics::getGEPTypeLogical(GetElementPtrInst *GEP) {
   return Interrupted ? GEP->getResultElementType() : CurType;
 }
 
-Type *SPIRVEmitIntrinsics::getGEPType(GetElementPtrInst *Ref) {
+Type *SPIRVEmitIntrinsicsImpl::getGEPType(GetElementPtrInst *Ref) {
   if (getByteAddressingMultiplier(Ref->getSourceElementType()) &&
       TM.getSubtargetImpl()->isLogicalSPIRV()) {
     return getGEPTypeLogical(Ref);
@@ -943,7 +951,7 @@ Type *SPIRVEmitIntrinsics::getGEPType(GetElementPtrInst *Ref) {
   return Ty;
 }
 
-Type *SPIRVEmitIntrinsics::deduceElementTypeHelper(
+Type *SPIRVEmitIntrinsicsImpl::deduceElementTypeHelper(
     Value *I, SmallPtrSetImpl<Value *> &Visited, bool UnknownElemTypeI8,
     bool IgnoreKnownType) {
   // allow to pass nullptr as an argument
@@ -1101,16 +1109,15 @@ Type *SPIRVEmitIntrinsics::deduceElementTypeHelper(
 // Re-create a type of the value if it has untyped pointer fields, also nested.
 // Return the original value type if no corrections of untyped pointer
 // information is found or needed.
-Type *SPIRVEmitIntrinsics::deduceNestedTypeHelper(User *U,
-                                                  bool UnknownElemTypeI8) {
+Type *SPIRVEmitIntrinsicsImpl::deduceNestedTypeHelper(User *U,
+                                                      bool UnknownElemTypeI8) {
   SmallPtrSet<Value *, 0> Visited;
   return deduceNestedTypeHelper(U, U->getType(), Visited, UnknownElemTypeI8);
 }
 
-Type *
-SPIRVEmitIntrinsics::deduceNestedTypeHelper(User *U, Type *OrigTy,
-                                            SmallPtrSetImpl<Value *> &Visited,
-                                            bool UnknownElemTypeI8) {
+Type *SPIRVEmitIntrinsicsImpl::deduceNestedTypeHelper(
+    User *U, Type *OrigTy, SmallPtrSetImpl<Value *> &Visited,
+    bool UnknownElemTypeI8) {
   if (!U)
     return OrigTy;
 
@@ -1187,7 +1194,8 @@ SPIRVEmitIntrinsics::deduceNestedTypeHelper(User *U, Type *OrigTy,
   return OrigTy;
 }
 
-Type *SPIRVEmitIntrinsics::deduceElementType(Value *I, bool UnknownElemTypeI8) {
+Type *SPIRVEmitIntrinsicsImpl::deduceElementType(Value *I,
+                                                 bool UnknownElemTypeI8) {
   if (Type *Ty = deduceElementTypeHelper(I, UnknownElemTypeI8))
     return Ty;
   if (!UnknownElemTypeI8)
@@ -1211,7 +1219,7 @@ static inline Type *getAtomicElemTy(SPIRVGlobalRegistry *GR, Instruction *I,
 
 // Try to deduce element type for a call base. Returns false if this is an
 // indirect function invocation, and true otherwise.
-bool SPIRVEmitIntrinsics::deduceOperandElementTypeCalledFunction(
+bool SPIRVEmitIntrinsicsImpl::deduceOperandElementTypeCalledFunction(
     CallInst *CI, SmallVector<std::pair<Value *, unsigned>> &Ops,
     Type *&KnownElemTy, bool &Incomplete) {
   Function *CalledF = CI->getCalledFunction();
@@ -1283,7 +1291,7 @@ bool SPIRVEmitIntrinsics::deduceOperandElementTypeCalledFunction(
 }
 
 // Try to deduce element type for a function pointer.
-void SPIRVEmitIntrinsics::deduceOperandElementTypeFunctionPointer(
+void SPIRVEmitIntrinsicsImpl::deduceOperandElementTypeFunctionPointer(
     CallInst *CI, SmallVector<std::pair<Value *, unsigned>> &Ops,
     Type *&KnownElemTy, bool IsPostprocessing) {
   Value *Op = CI->getCalledOperand();
@@ -1327,7 +1335,7 @@ void SPIRVEmitIntrinsics::deduceOperandElementTypeFunctionPointer(
       IsNewFTy ? FunctionType::get(RetTy, ArgTys, FTy->isVarArg()) : FTy;
 }
 
-bool SPIRVEmitIntrinsics::deduceOperandElementTypeFunctionRet(
+bool SPIRVEmitIntrinsicsImpl::deduceOperandElementTypeFunctionRet(
     Instruction *I, SmallPtrSetImpl<Instruction *> *IncompleteRets,
     const SmallPtrSetImpl<Value *> *AskOps, bool IsPostprocessing,
     Type *&KnownElemTy, Value *Op, Function *F) {
@@ -1374,7 +1382,7 @@ bool SPIRVEmitIntrinsics::deduceOperandElementTypeFunctionRet(
 // tries to deduce them. If the Instruction has Pointer operands with known
 // types which differ from expected, this function tries to insert a bitcast to
 // resolve the issue.
-void SPIRVEmitIntrinsics::deduceOperandElementType(
+void SPIRVEmitIntrinsicsImpl::deduceOperandElementType(
     Instruction *I, SmallPtrSetImpl<Instruction *> *IncompleteRets,
     const SmallPtrSetImpl<Value *> *AskOps, bool IsPostprocessing) {
   SmallVector<std::pair<Value *, unsigned>> Ops;
@@ -1577,9 +1585,9 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
   TypeValidated.insert(I);
 }
 
-void SPIRVEmitIntrinsics::replaceMemInstrUses(Instruction *Old,
-                                              Instruction *New,
-                                              IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::replaceMemInstrUses(Instruction *Old,
+                                                  Instruction *New,
+                                                  IRBuilder<> &B) {
   while (!Old->user_empty()) {
     auto *U = Old->user_back();
     if (isAssignTypeInstr(U)) {
@@ -1626,8 +1634,8 @@ void SPIRVEmitIntrinsics::replaceMemInstrUses(Instruction *Old,
 }
 
 // Lower a poison or undef Op to its placeholder intrinsic.
-Value *SPIRVEmitIntrinsics::lowerUndefOrPoison(Value *Op, IRBuilder<> &B,
-                                               bool HasPoisonExt) {
+Value *SPIRVEmitIntrinsicsImpl::lowerUndefOrPoison(Value *Op, IRBuilder<> &B,
+                                                   bool HasPoisonExt) {
   auto *UV = dyn_cast<UndefValue>(Op);
   if (!UV)
     return nullptr;
@@ -1659,7 +1667,7 @@ Value *SPIRVEmitIntrinsics::lowerUndefOrPoison(Value *Op, IRBuilder<> &B,
 // Replace aggregate undef or poison operands and extension-enabled scalar
 // poison operands with placeholder intrinsics. Scalar undef is left as is. See
 // lowerUndefOrPoison.
-void SPIRVEmitIntrinsics::preprocessUndefsAndPoisons(IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::preprocessUndefsAndPoisons(IRBuilder<> &B) {
   const SPIRVSubtarget *STI = TM.getSubtargetImpl(*CurrF);
   bool HasPoisonExt =
       STI->canUseExtension(SPIRV::Extension::SPV_KHR_poison_freeze);
@@ -1698,7 +1706,7 @@ void SPIRVEmitIntrinsics::preprocessUndefsAndPoisons(IRBuilder<> &B) {
 // target type. Casting null always yields null, and this avoids SPIR-V
 // lowering issues where the null gets typed as an integer instead of a
 // pointer.
-void SPIRVEmitIntrinsics::simplifyNullAddrSpaceCasts() {
+void SPIRVEmitIntrinsicsImpl::simplifyNullAddrSpaceCasts() {
   for (Instruction &I : make_early_inc_range(instructions(CurrF)))
     if (auto *ASC = dyn_cast<AddrSpaceCastInst>(&I))
       if (isa<ConstantPointerNull>(ASC->getPointerOperand())) {
@@ -1727,8 +1735,8 @@ static bool isAggregateValueIdInstr(const Instruction &I) {
 // Give each multi-register aggregate arm of an aggregate PHI/select/freeze a
 // single value-id by reassembling it with extractvalue + insertvalue, so the
 // arm matches the result once it is mutated to a value-id.
-void SPIRVEmitIntrinsics::insertCompositeAggregateArms(Instruction *I,
-                                                       IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::insertCompositeAggregateArms(Instruction *I,
+                                                           IRBuilder<> &B) {
   auto *Phi = dyn_cast<PHINode>(I);
   for (Use &U : I->operands()) {
     Value *Op = U.get();
@@ -1750,7 +1758,7 @@ void SPIRVEmitIntrinsics::insertCompositeAggregateArms(Instruction *I,
   }
 }
 
-void SPIRVEmitIntrinsics::preprocessCompositeConstants(IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::preprocessCompositeConstants(IRBuilder<> &B) {
   const SPIRVSubtarget *STI = TM.getSubtargetImpl(*CurrF);
   bool HasPoisonExt =
       STI->canUseExtension(SPIRV::Extension::SPV_KHR_poison_freeze);
@@ -1864,7 +1872,7 @@ static void addSaturatedDecorationToIntrinsic(Instruction *I, IRBuilder<> &B) {
     createSaturatedConversionDecoration(I, B);
 }
 
-Instruction *SPIRVEmitIntrinsics::visitCallInst(CallInst &Call) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitCallInst(CallInst &Call) {
   if (!Call.isInlineAsm())
     return &Call;
 
@@ -1890,8 +1898,8 @@ Instruction *SPIRVEmitIntrinsics::visitCallInst(CallInst &Call) {
 }
 
 // Use a tip about rounding mode to create a decoration.
-void SPIRVEmitIntrinsics::useRoundingMode(ConstrainedFPIntrinsic *FPI,
-                                          IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::useRoundingMode(ConstrainedFPIntrinsic *FPI,
+                                              IRBuilder<> &B) {
   std::optional<RoundingMode> RM = FPI->getRoundingMode();
   if (!RM.has_value())
     return;
@@ -1923,7 +1931,7 @@ void SPIRVEmitIntrinsics::useRoundingMode(ConstrainedFPIntrinsic *FPI,
   createRoundingModeDecoration(FPI, RoundingModeDeco, B);
 }
 
-Instruction *SPIRVEmitIntrinsics::visitSwitchInst(SwitchInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitSwitchInst(SwitchInst &I) {
   BasicBlock *ParentBB = I.getParent();
   Function *F = ParentBB->getParent();
   IRBuilder<> B(ParentBB);
@@ -1959,7 +1967,7 @@ static bool isFirstIndexZero(const GetElementPtrInst *GEP) {
   return GEP->getNumIndices() > 0 && match(GEP->getOperand(1), m_Zero());
 }
 
-Instruction *SPIRVEmitIntrinsics::visitIntrinsicInst(IntrinsicInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitIntrinsicInst(IntrinsicInst &I) {
   auto *SGEP = dyn_cast<StructuredGEPInst>(&I);
   if (!SGEP)
     return &I;
@@ -1980,7 +1988,8 @@ Instruction *SPIRVEmitIntrinsics::visitIntrinsicInst(IntrinsicInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitGetElementPtrInst(GetElementPtrInst &I) {
+Instruction *
+SPIRVEmitIntrinsicsImpl::visitGetElementPtrInst(GetElementPtrInst &I) {
   IRBuilder<> B(I.getParent());
   B.SetInsertPoint(&I);
 
@@ -2089,7 +2098,7 @@ Instruction *SPIRVEmitIntrinsics::visitGetElementPtrInst(GetElementPtrInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitBitCastInst(BitCastInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitBitCastInst(BitCastInst &I) {
   IRBuilder<> B(I.getParent());
   B.SetInsertPoint(&I);
   Value *Source = I.getOperand(0);
@@ -2112,7 +2121,7 @@ Instruction *SPIRVEmitIntrinsics::visitBitCastInst(BitCastInst &I) {
   return NewI;
 }
 
-void SPIRVEmitIntrinsics::insertAssignPtrTypeTargetExt(
+void SPIRVEmitIntrinsicsImpl::insertAssignPtrTypeTargetExt(
     TargetExtType *AssignedType, Value *V, IRBuilder<> &B) {
   Type *VTy = V->getType();
 
@@ -2147,7 +2156,7 @@ void SPIRVEmitIntrinsics::insertAssignPtrTypeTargetExt(
   GR->updateAssignType(AssignCI, V, getNormalizedPoisonValue(AssignedType));
 }
 
-void SPIRVEmitIntrinsics::replacePointerOperandWithPtrCast(
+void SPIRVEmitIntrinsicsImpl::replacePointerOperandWithPtrCast(
     Instruction *I, Value *Pointer, Type *ExpectedElementType,
     unsigned OperandToReplace, IRBuilder<> &B) {
   TypeValidated.insert(I);
@@ -2244,8 +2253,8 @@ void SPIRVEmitIntrinsics::replacePointerOperandWithPtrCast(
   GR->buildAssignPtr(B, ExpectedElementType, PtrCastI);
 }
 
-void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr(Instruction *I,
-                                                         IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::insertPtrCastOrAssignTypeInstr(Instruction *I,
+                                                             IRBuilder<> &B) {
   // Handle basic instructions:
   StoreInst *SI = dyn_cast<StoreInst>(I);
   if (IsKernelArgInt8(CurrF, SI)) {
@@ -2383,7 +2392,8 @@ void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr(Instruction *I,
   }
 }
 
-Instruction *SPIRVEmitIntrinsics::visitInsertElementInst(InsertElementInst &I) {
+Instruction *
+SPIRVEmitIntrinsicsImpl::visitInsertElementInst(InsertElementInst &I) {
   // If it's a <1 x Type> vector type, don't modify it. It's not a legal vector
   // type in LLT and IRTranslator will replace it by the scalar.
   if (isVector1(I.getType()))
@@ -2402,7 +2412,7 @@ Instruction *SPIRVEmitIntrinsics::visitInsertElementInst(InsertElementInst &I) {
 }
 
 Instruction *
-SPIRVEmitIntrinsics::visitExtractElementInst(ExtractElementInst &I) {
+SPIRVEmitIntrinsicsImpl::visitExtractElementInst(ExtractElementInst &I) {
   // If it's a <1 x Type> vector type, don't modify it. It's not a legal vector
   // type in LLT and IRTranslator will replace it by the scalar.
   if (isVector1(I.getVectorOperandType()))
@@ -2419,7 +2429,7 @@ SPIRVEmitIntrinsics::visitExtractElementInst(ExtractElementInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitInsertValueInst(InsertValueInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitInsertValueInst(InsertValueInst &I) {
   IRBuilder<> B(I.getParent());
   B.SetInsertPoint(&I);
   SmallVector<Type *, 1> Types = {I.getInsertedValueOperand()->getType()};
@@ -2438,7 +2448,8 @@ Instruction *SPIRVEmitIntrinsics::visitInsertValueInst(InsertValueInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitExtractValueInst(ExtractValueInst &I) {
+Instruction *
+SPIRVEmitIntrinsicsImpl::visitExtractValueInst(ExtractValueInst &I) {
   IRBuilder<> B(I.getParent());
   B.SetInsertPoint(&I);
   if (I.getAggregateOperand()->getType()->isAggregateType()) {
@@ -2474,7 +2485,7 @@ Instruction *SPIRVEmitIntrinsics::visitExtractValueInst(ExtractValueInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitLoadInst(LoadInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitLoadInst(LoadInst &I) {
   if (!I.getType()->isAggregateType())
     return &I;
   IRBuilder<> B(I.getParent());
@@ -2500,7 +2511,7 @@ Instruction *SPIRVEmitIntrinsics::visitLoadInst(LoadInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitStoreInst(StoreInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitStoreInst(StoreInst &I) {
   if (!AggrStores.contains(&I))
     return &I;
   IRBuilder<> B(I.getParent());
@@ -2540,7 +2551,7 @@ Instruction *SPIRVEmitIntrinsics::visitStoreInst(StoreInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitAllocaInst(AllocaInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitAllocaInst(AllocaInst &I) {
   Value *ArraySize = nullptr;
   if (I.isArrayAllocation()) {
     const SPIRVSubtarget *STI = TM.getSubtargetImpl(*I.getFunction());
@@ -2567,7 +2578,8 @@ Instruction *SPIRVEmitIntrinsics::visitAllocaInst(AllocaInst &I) {
   return NewI;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) {
+Instruction *
+SPIRVEmitIntrinsicsImpl::visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) {
   assert(I.getType()->isAggregateType() && "Aggregate result is expected");
   IRBuilder<> B(I.getParent());
   B.SetInsertPoint(&I);
@@ -2626,7 +2638,7 @@ static bool precededByAbortIntrinsic(const UnreachableInst &I,
   return false;
 }
 
-Instruction *SPIRVEmitIntrinsics::visitUnreachableInst(UnreachableInst &I) {
+Instruction *SPIRVEmitIntrinsicsImpl::visitUnreachableInst(UnreachableInst &I) {
   const SPIRVSubtarget &ST = TM.getSubtarget<SPIRVSubtarget>(*I.getFunction());
   if (precededByAbortIntrinsic(I, ST))
     return &I;
@@ -2694,8 +2706,8 @@ shouldEmitIntrinsicsForGlobalValue(const GlobalVariableUsers &GVUsers,
   return F == &FirstDefinition;
 }
 
-Value *SPIRVEmitIntrinsics::buildSpvUndefComposite(Type *AggrTy,
-                                                   IRBuilder<> &B) {
+Value *SPIRVEmitIntrinsicsImpl::buildSpvUndefComposite(Type *AggrTy,
+                                                       IRBuilder<> &B) {
   auto MakeLeaf = [&](Type *ElemTy) -> Instruction * {
     CallInst *Leaf = B.CreateIntrinsicWithoutFolding(Intrinsic::spv_undef, {});
     AggrConsts[Leaf] = PoisonValue::get(ElemTy);
@@ -2728,8 +2740,8 @@ Value *SPIRVEmitIntrinsics::buildSpvUndefComposite(Type *AggrTy,
 // was rewritten to i32 by SPIRVPrepareFunctions. Rebuild the return value
 // via extractvalue/insertvalue so the regular spv_extractv/spv_insertv
 // lowering produces a valid OpReturnValue.
-void SPIRVEmitIntrinsics::reconstructAggregateReturns(Function &Func,
-                                                      IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::reconstructAggregateReturns(Function &Func,
+                                                          IRBuilder<> &B) {
   Type *OrigRetTy = GR->findMutated(&Func);
   if (!OrigRetTy || !OrigRetTy->isAggregateType())
     return;
@@ -2754,8 +2766,8 @@ void SPIRVEmitIntrinsics::reconstructAggregateReturns(Function &Func,
   }
 }
 
-void SPIRVEmitIntrinsics::processGlobalValue(GlobalVariable &GV,
-                                             IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::processGlobalValue(GlobalVariable &GV,
+                                                 IRBuilder<> &B) {
 
   if (!shouldEmitIntrinsicsForGlobalValue(GVUsers, GV, CurrF))
     return;
@@ -2800,9 +2812,9 @@ void SPIRVEmitIntrinsics::processGlobalValue(GlobalVariable &GV,
 // Return true, if we can't decide what is the pointee type now and will get
 // back to the question later. Return false is spv_assign_ptr_type is not needed
 // or can be inserted immediately.
-bool SPIRVEmitIntrinsics::insertAssignPtrTypeIntrs(Instruction *I,
-                                                   IRBuilder<> &B,
-                                                   bool UnknownElemTypeI8) {
+bool SPIRVEmitIntrinsicsImpl::insertAssignPtrTypeIntrs(Instruction *I,
+                                                       IRBuilder<> &B,
+                                                       bool UnknownElemTypeI8) {
   reportFatalOnTokenType(I);
   if (!isPointerTy(I->getType()) || !requireAssignType(I))
     return false;
@@ -2815,8 +2827,8 @@ bool SPIRVEmitIntrinsics::insertAssignPtrTypeIntrs(Instruction *I,
   return true;
 }
 
-void SPIRVEmitIntrinsics::insertAssignTypeIntrs(Instruction *I,
-                                                IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::insertAssignTypeIntrs(Instruction *I,
+                                                    IRBuilder<> &B) {
   // TODO: extend the list of functions with known result types
   static StringMap<unsigned> ResTypeWellKnown = {
       {"async_work_group_copy", WellKnownTypes::Event},
@@ -2932,7 +2944,7 @@ void SPIRVEmitIntrinsics::insertAssignTypeIntrs(Instruction *I,
   }
 }
 
-bool SPIRVEmitIntrinsics::shouldTryToAddMemAliasingDecoration(
+bool SPIRVEmitIntrinsicsImpl::shouldTryToAddMemAliasingDecoration(
     Instruction *Inst) {
   const SPIRVSubtarget *STI = TM.getSubtargetImpl(*Inst->getFunction());
   if (!STI->canUseExtension(SPIRV::Extension::SPV_INTEL_memory_access_aliasing))
@@ -2945,8 +2957,8 @@ bool SPIRVEmitIntrinsics::shouldTryToAddMemAliasingDecoration(
                m_AnyIntrinsic<Intrinsic::spv_load, Intrinsic::spv_store>());
 }
 
-void SPIRVEmitIntrinsics::insertSpirvDecorations(Instruction *I,
-                                                 IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::insertSpirvDecorations(Instruction *I,
+                                                     IRBuilder<> &B) {
   if (MDNode *MD = I->getMetadata("spirv.Decorations")) {
     setInsertPointAfterDef(B, I);
     B.CreateIntrinsic(Intrinsic::spv_assign_decoration, {I->getType()},
@@ -3045,7 +3057,7 @@ static SPIRV::FPFastMathDefaultInfo &getFPFastMathDefaultInfo(
   return FPFastMathDefaultInfoVec[Index];
 }
 
-void SPIRVEmitIntrinsics::insertConstantsForFPFastMathDefault(Module &M) {
+void SPIRVEmitIntrinsicsImpl::insertConstantsForFPFastMathDefault(Module &M) {
   const SPIRVSubtarget *ST = TM.getSubtargetImpl();
   if (!ST->canUseExtension(SPIRV::Extension::SPV_KHR_float_controls2))
     return;
@@ -3201,8 +3213,8 @@ void SPIRVEmitIntrinsics::insertConstantsForFPFastMathDefault(Module &M) {
   }
 }
 
-void SPIRVEmitIntrinsics::processInstrAfterVisit(Instruction *I,
-                                                 IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::processInstrAfterVisit(Instruction *I,
+                                                     IRBuilder<> &B) {
   auto *II = dyn_cast<IntrinsicInst>(I);
   bool IsConstComposite =
       II && II->getIntrinsicID() == Intrinsic::spv_const_composite;
@@ -3260,13 +3272,13 @@ void SPIRVEmitIntrinsics::processInstrAfterVisit(Instruction *I,
     emitAssignName(I, B);
 }
 
-Type *SPIRVEmitIntrinsics::deduceFunParamElementType(Function *F,
-                                                     unsigned OpIdx) {
+Type *SPIRVEmitIntrinsicsImpl::deduceFunParamElementType(Function *F,
+                                                         unsigned OpIdx) {
   SmallPtrSet<Function *, 0> FVisited;
   return deduceFunParamElementType(F, OpIdx, FVisited);
 }
 
-Type *SPIRVEmitIntrinsics::deduceFunParamElementType(
+Type *SPIRVEmitIntrinsicsImpl::deduceFunParamElementType(
     Function *F, unsigned OpIdx, SmallPtrSetImpl<Function *> &FVisited) {
   // maybe a cycle
   if (!FVisited.insert(F).second)
@@ -3321,8 +3333,8 @@ Type *SPIRVEmitIntrinsics::deduceFunParamElementType(
   return nullptr;
 }
 
-void SPIRVEmitIntrinsics::processParamTypesByFunHeader(Function *F,
-                                                       IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::processParamTypesByFunHeader(Function *F,
+                                                           IRBuilder<> &B) {
   B.SetInsertPointPastAllocas(F);
   for (unsigned OpIdx = 0; OpIdx < F->arg_size(); ++OpIdx) {
     Argument *Arg = F->getArg(OpIdx);
@@ -3383,7 +3395,7 @@ void SPIRVEmitIntrinsics::processParamTypesByFunHeader(Function *F,
   }
 }
 
-void SPIRVEmitIntrinsics::processParamTypes(Function *F, IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::processParamTypes(Function *F, IRBuilder<> &B) {
   B.SetInsertPointPastAllocas(F);
   for (unsigned OpIdx = 0; OpIdx < F->arg_size(); ++OpIdx) {
     Argument *Arg = F->getArg(OpIdx);
@@ -3422,7 +3434,7 @@ static FunctionType *getFunctionPointerElemType(Function *F,
              : FTy;
 }
 
-bool SPIRVEmitIntrinsics::processFunctionPointers(Module &M) {
+bool SPIRVEmitIntrinsicsImpl::processFunctionPointers(Module &M) {
   SmallVector<Function *> Worklist;
   for (auto &F : M) {
     if (F.isIntrinsic())
@@ -3473,7 +3485,7 @@ bool SPIRVEmitIntrinsics::processFunctionPointers(Module &M) {
 }
 
 // Apply types parsed from demangled function declarations.
-void SPIRVEmitIntrinsics::applyDemangledPtrArgTypes(IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::applyDemangledPtrArgTypes(IRBuilder<> &B) {
   DenseMap<Function *, CallInst *> Ptrcasts;
   for (auto It : FDeclPtrTys) {
     Function *F = It.first;
@@ -3524,8 +3536,8 @@ void SPIRVEmitIntrinsics::applyDemangledPtrArgTypes(IRBuilder<> &B) {
   }
 }
 
-GetElementPtrInst *
-SPIRVEmitIntrinsics::simplifyZeroLengthArrayGepInst(GetElementPtrInst *GEP) {
+GetElementPtrInst *SPIRVEmitIntrinsicsImpl::simplifyZeroLengthArrayGepInst(
+    GetElementPtrInst *GEP) {
   // getelementptr [0 x T], P, 0 (zero), I -> getelementptr T, P, I.
   // If type is 0-length array and first index is 0 (zero), drop both the
   // 0-length array type and the first index. This is a common pattern in
@@ -3545,8 +3557,8 @@ SPIRVEmitIntrinsics::simplifyZeroLengthArrayGepInst(GetElementPtrInst *GEP) {
   return nullptr;
 }
 
-void SPIRVEmitIntrinsics::emitUnstructuredLoopControls(Function &F,
-                                                       IRBuilder<> &B) {
+void SPIRVEmitIntrinsicsImpl::emitUnstructuredLoopControls(Function &F,
+                                                           IRBuilder<> &B) {
   const SPIRVSubtarget *ST = TM.getSubtargetImpl(F);
   // Shaders use SPIRVStructurizer which emits OpLoopMerge via spv_loop_merge.
   if (ST->isShader())
@@ -3608,7 +3620,7 @@ void SPIRVEmitIntrinsics::emitUnstructuredLoopControls(Function &F,
   }
 }
 
-bool SPIRVEmitIntrinsics::runOnFunction(Function &Func) {
+bool SPIRVEmitIntrinsicsImpl::runOnFunction(Function &Func) {
   if (Func.isDeclaration())
     return false;
 
@@ -3758,7 +3770,7 @@ bool SPIRVEmitIntrinsics::runOnFunction(Function &Func) {
 }
 
 // Try to deduce a better type for pointers to untyped ptr.
-bool SPIRVEmitIntrinsics::postprocessTypes(Module &M) {
+bool SPIRVEmitIntrinsicsImpl::postprocessTypes(Module &M) {
   if (!GR || TodoTypeSz == 0)
     return false;
 
@@ -3818,7 +3830,7 @@ bool SPIRVEmitIntrinsics::postprocessTypes(Module &M) {
 }
 
 // Parse and store argument types of function declarations where needed.
-void SPIRVEmitIntrinsics::parseFunDeclarations(Module &M) {
+void SPIRVEmitIntrinsicsImpl::parseFunDeclarations(Module &M) {
   for (auto &F : M) {
     if (!F.isDeclaration() || F.isIntrinsic())
       continue;
@@ -3860,7 +3872,7 @@ void SPIRVEmitIntrinsics::parseFunDeclarations(Module &M) {
   }
 }
 
-bool SPIRVEmitIntrinsics::processMaskedMemIntrinsic(IntrinsicInst &I) {
+bool SPIRVEmitIntrinsicsImpl::processMaskedMemIntrinsic(IntrinsicInst &I) {
   const SPIRVSubtarget &ST = TM.getSubtarget<SPIRVSubtarget>(*I.getFunction());
 
   if (I.getIntrinsicID() == Intrinsic::masked_gather) {
@@ -3932,7 +3944,7 @@ bool SPIRVEmitIntrinsics::processMaskedMemIntrinsic(IntrinsicInst &I) {
 // bitcasts into element-wise operations before building instructions
 // worklist, so new instructions are properly visited and converted to
 // SPIR-V intrinsics.
-void SPIRVEmitIntrinsics::preprocessBoolVectorBitcasts(Function &F) {
+void SPIRVEmitIntrinsicsImpl::preprocessBoolVectorBitcasts(Function &F) {
   struct BoolVecBitcast {
     BitCastInst *BC;
     FixedVectorType *BoolVecTy;
@@ -4006,7 +4018,7 @@ void SPIRVEmitIntrinsics::preprocessBoolVectorBitcasts(Function &F) {
   }
 }
 
-bool SPIRVEmitIntrinsics::convertMaskedMemIntrinsics(Module &M) {
+bool SPIRVEmitIntrinsicsImpl::convertMaskedMemIntrinsics(Module &M) {
   bool Changed = false;
 
   for (Function &F : make_early_inc_range(M)) {
@@ -4028,7 +4040,7 @@ bool SPIRVEmitIntrinsics::convertMaskedMemIntrinsics(Module &M) {
   return Changed;
 }
 
-bool SPIRVEmitIntrinsics::runOnModule(Module &M) {
+bool SPIRVEmitIntrinsicsImpl::runOnModule(Module &M) {
   bool Changed = false;
 
   Changed |= convertMaskedMemIntrinsics(M);
@@ -4062,12 +4074,11 @@ bool SPIRVEmitIntrinsics::runOnModule(Module &M) {
 
 PreservedAnalyses
 llvm::SPIRVEmitIntrinsicsPass::run(Module &M, ModuleAnalysisManager &AM) {
-  SPIRVEmitIntrinsics Legacy(TM);
-  if (Legacy.runOnModule(M))
+  if (SPIRVEmitIntrinsicsImpl(TM).runOnModule(M))
     return PreservedAnalyses::none();
   return PreservedAnalyses::all();
 }
 
 ModulePass *llvm::createSPIRVEmitIntrinsicsPass(const SPIRVTargetMachine &TM) {
-  return new SPIRVEmitIntrinsics(TM);
+  return new SPIRVEmitIntrinsicsLegacy(TM);
 }
diff --git a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
index 42e402aa62c27..85ed1cba1ba30 100644
--- a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
@@ -70,7 +70,7 @@ extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSPIRVTarget() {
   initializeSPIRVPreLegalizerPass(PR);
   initializeSPIRVPostLegalizerPass(PR);
   initializeSPIRVMergeRegionExitTargetsLegacyPass(PR);
-  initializeSPIRVEmitIntrinsicsPass(PR);
+  initializeSPIRVEmitIntrinsicsLegacyPass(PR);
   initializeSPIRVPrepareFunctionsLegacyPass(PR);
   initializeSPIRVPrepareGlobalsLegacyPass(PR);
   initializeSPIRVLegalizeImplicitBindingLegacyPass(PR);



More information about the llvm-commits mailing list