@@ -84,14 +84,14 @@ namespace {
8484 if (skipModule (M))
8585 return false ;
8686 DeadArgumentEliminationPass DAEP (ShouldHackArguments (),
87- CheckSyclKernels ());
87+ CheckSpirKernels ());
8888 ModuleAnalysisManager DummyMAM;
8989 PreservedAnalyses PA = DAEP.run (M, DummyMAM);
9090 return !PA.areAllPreserved ();
9191 }
9292
9393 virtual bool ShouldHackArguments () const { return false ; }
94- virtual bool CheckSyclKernels () const { return false ; }
94+ virtual bool CheckSpirKernels () const { return false ; }
9595 };
9696
9797} // end anonymous namespace
@@ -111,7 +111,7 @@ namespace {
111111 DAH () : DAE(ID) {}
112112
113113 bool ShouldHackArguments () const override { return true ; }
114- bool CheckSyclKernels () const override { return false ; }
114+ bool CheckSpirKernels () const override { return false ; }
115115 };
116116
117117} // end anonymous namespace
@@ -124,7 +124,7 @@ INITIALIZE_PASS(DAH, "deadarghaX0r",
124124
125125namespace {
126126
127- // / DAESYCL - DeadArgumentElimination pass for SYCL kernel functions even
127+ // / DAESYCL - DeadArgumentElimination pass for SPIR kernel functions even
128128// / if they are external.
129129struct DAESYCL : public DAE {
130130 static char ID;
@@ -134,19 +134,21 @@ struct DAESYCL : public DAE {
134134 }
135135
136136 StringRef getPassName () const override {
137- return " Dead Argument Elimination for SYCL kernels" ;
137+ return " Dead Argument Elimination for SPIR kernels in SYCL environment " ;
138138 }
139139
140140 bool ShouldHackArguments () const override { return false ; }
141- bool CheckSyclKernels () const override { return true ; }
141+ bool CheckSpirKernels () const override { return true ; }
142142};
143143
144144} // end anonymous namespace
145145
146146char DAESYCL::ID = 0 ;
147147
148- INITIALIZE_PASS (DAESYCL, " deadargelim-sycl" ,
149- " Dead Argument Elimination for SYCL kernels" , false , false )
148+ INITIALIZE_PASS (
149+ DAESYCL, " deadargelim-sycl" ,
150+ " Dead Argument Elimination for SPIR kernels in SYCL environment" , false ,
151+ false )
150152
151153// / createDeadArgEliminationPass - This pass removes arguments from functions
152154// / which are not used by the body of the function.
@@ -573,12 +575,12 @@ void DeadArgumentEliminationPass::SurveyFunction(const Function &F) {
573575 }
574576
575577 // We can't modify arguments if the function is not local
576- // but we can do so for SYCL kernel function.
577- bool FuncIsSyclKernel =
578- CheckSyclKernels &&
578+ // but we can do so for SPIR kernel function in SYCL environment .
579+ bool FuncIsSpirKernel =
580+ CheckSpirKernels &&
579581 StringRef (F.getParent ()->getTargetTriple ()).contains (" sycldevice" ) &&
580582 F.getCallingConv () == CallingConv::SPIR_KERNEL;
581- bool FuncIsLive = !F.hasLocalLinkage () && !FuncIsSyclKernel ;
583+ bool FuncIsLive = !F.hasLocalLinkage () && !FuncIsSpirKernel ;
582584 if (FuncIsLive && (!ShouldHackArguments || F.isIntrinsic ())) {
583585 MarkLive (F);
584586 return ;
@@ -768,10 +770,10 @@ void DeadArgumentEliminationPass::PropagateLiveness(const RetOrArg &RA) {
768770// false, false,
769771// // OMIT_TABLE_END
770772// };
771- // TODO: batch changes to multiple SYCL kernels and do one bulk update.
773+ // TODO: batch changes to multiple SPIR kernels and do one bulk update.
772774constexpr StringLiteral OMIT_TABLE_BEGIN (" // OMIT_TABLE_BEGIN" );
773775constexpr StringLiteral OMIT_TABLE_END (" // OMIT_TABLE_END" );
774- static void updateIntegrationHeader (StringRef SyclKernelName ,
776+ static void updateIntegrationHeader (StringRef SpirKernelName ,
775777 const ArrayRef<bool > &ArgAlive) {
776778 ErrorOr<std::unique_ptr<MemoryBuffer>> IntHeaderBuffer =
777779 MemoryBuffer::getFile (IntegrationHeaderFileName);
@@ -796,14 +798,14 @@ static void updateIntegrationHeader(StringRef SyclKernelName,
796798
797799 StringRef OmitArgTable = IntHeader.slice (BeginRegionPos, EndRegionPos);
798800
799- // 2. Find the line that corresponds to the SYCL kernel
800- if (!OmitArgTable.contains (SyclKernelName ))
801+ // 2. Find the line that corresponds to the SPIR kernel
802+ if (!OmitArgTable.contains (SpirKernelName ))
801803 report_fatal_error (
802804 " Argument table not found in integration header for function '" +
803- SyclKernelName + " '" );
805+ SpirKernelName + " '" );
804806
805807 size_t BeginLinePos =
806- OmitArgTable.find (SyclKernelName ) + SyclKernelName .size ();
808+ OmitArgTable.find (SpirKernelName ) + SpirKernelName .size ();
807809 size_t EndLinePos = OmitArgTable.find (" //" , BeginLinePos);
808810
809811 StringRef OmitArgLine = OmitArgTable.slice (BeginLinePos, EndLinePos);
@@ -873,7 +875,7 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
873875 }
874876 }
875877
876- if (CheckSyclKernels )
878+ if (CheckSpirKernels )
877879 updateIntegrationHeader (F->getName (), ArgAlive);
878880
879881 // Find out the new return value.
@@ -1193,7 +1195,7 @@ PreservedAnalyses DeadArgumentEliminationPass::run(Module &M,
11931195 ModuleAnalysisManager &) {
11941196 // Integration header file must be provided for
11951197 // DAE to work on SPIR kernels.
1196- if (CheckSyclKernels && !IntegrationHeaderFileName.getNumOccurrences ())
1198+ if (CheckSpirKernels && !IntegrationHeaderFileName.getNumOccurrences ())
11971199 return PreservedAnalyses::all ();
11981200
11991201 bool Changed = false ;
0 commit comments