@@ -84,14 +84,14 @@ namespace {
84
84
if (skipModule (M))
85
85
return false ;
86
86
DeadArgumentEliminationPass DAEP (ShouldHackArguments (),
87
- CheckSyclKernels ());
87
+ CheckSpirKernels ());
88
88
ModuleAnalysisManager DummyMAM;
89
89
PreservedAnalyses PA = DAEP.run (M, DummyMAM);
90
90
return !PA.areAllPreserved ();
91
91
}
92
92
93
93
virtual bool ShouldHackArguments () const { return false ; }
94
- virtual bool CheckSyclKernels () const { return false ; }
94
+ virtual bool CheckSpirKernels () const { return false ; }
95
95
};
96
96
97
97
} // end anonymous namespace
@@ -111,7 +111,7 @@ namespace {
111
111
DAH () : DAE(ID) {}
112
112
113
113
bool ShouldHackArguments () const override { return true ; }
114
- bool CheckSyclKernels () const override { return false ; }
114
+ bool CheckSpirKernels () const override { return false ; }
115
115
};
116
116
117
117
} // end anonymous namespace
@@ -124,7 +124,7 @@ INITIALIZE_PASS(DAH, "deadarghaX0r",
124
124
125
125
namespace {
126
126
127
- // / DAESYCL - DeadArgumentElimination pass for SYCL kernel functions even
127
+ // / DAESYCL - DeadArgumentElimination pass for SPIR kernel functions even
128
128
// / if they are external.
129
129
struct DAESYCL : public DAE {
130
130
static char ID;
@@ -134,19 +134,21 @@ struct DAESYCL : public DAE {
134
134
}
135
135
136
136
StringRef getPassName () const override {
137
- return " Dead Argument Elimination for SYCL kernels" ;
137
+ return " Dead Argument Elimination for SPIR kernels in SYCL environment " ;
138
138
}
139
139
140
140
bool ShouldHackArguments () const override { return false ; }
141
- bool CheckSyclKernels () const override { return true ; }
141
+ bool CheckSpirKernels () const override { return true ; }
142
142
};
143
143
144
144
} // end anonymous namespace
145
145
146
146
char DAESYCL::ID = 0 ;
147
147
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 )
150
152
151
153
// / createDeadArgEliminationPass - This pass removes arguments from functions
152
154
// / which are not used by the body of the function.
@@ -573,12 +575,12 @@ void DeadArgumentEliminationPass::SurveyFunction(const Function &F) {
573
575
}
574
576
575
577
// 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 &&
579
581
StringRef (F.getParent ()->getTargetTriple ()).contains (" sycldevice" ) &&
580
582
F.getCallingConv () == CallingConv::SPIR_KERNEL;
581
- bool FuncIsLive = !F.hasLocalLinkage () && !FuncIsSyclKernel ;
583
+ bool FuncIsLive = !F.hasLocalLinkage () && !FuncIsSpirKernel ;
582
584
if (FuncIsLive && (!ShouldHackArguments || F.isIntrinsic ())) {
583
585
MarkLive (F);
584
586
return ;
@@ -768,10 +770,10 @@ void DeadArgumentEliminationPass::PropagateLiveness(const RetOrArg &RA) {
768
770
// false, false,
769
771
// // OMIT_TABLE_END
770
772
// };
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.
772
774
constexpr StringLiteral OMIT_TABLE_BEGIN (" // OMIT_TABLE_BEGIN" );
773
775
constexpr StringLiteral OMIT_TABLE_END (" // OMIT_TABLE_END" );
774
- static void updateIntegrationHeader (StringRef SyclKernelName ,
776
+ static void updateIntegrationHeader (StringRef SpirKernelName ,
775
777
const ArrayRef<bool > &ArgAlive) {
776
778
ErrorOr<std::unique_ptr<MemoryBuffer>> IntHeaderBuffer =
777
779
MemoryBuffer::getFile (IntegrationHeaderFileName);
@@ -796,14 +798,14 @@ static void updateIntegrationHeader(StringRef SyclKernelName,
796
798
797
799
StringRef OmitArgTable = IntHeader.slice (BeginRegionPos, EndRegionPos);
798
800
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 ))
801
803
report_fatal_error (
802
804
" Argument table not found in integration header for function '" +
803
- SyclKernelName + " '" );
805
+ SpirKernelName + " '" );
804
806
805
807
size_t BeginLinePos =
806
- OmitArgTable.find (SyclKernelName ) + SyclKernelName .size ();
808
+ OmitArgTable.find (SpirKernelName ) + SpirKernelName .size ();
807
809
size_t EndLinePos = OmitArgTable.find (" //" , BeginLinePos);
808
810
809
811
StringRef OmitArgLine = OmitArgTable.slice (BeginLinePos, EndLinePos);
@@ -873,7 +875,7 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
873
875
}
874
876
}
875
877
876
- if (CheckSyclKernels )
878
+ if (CheckSpirKernels )
877
879
updateIntegrationHeader (F->getName (), ArgAlive);
878
880
879
881
// Find out the new return value.
@@ -1193,7 +1195,7 @@ PreservedAnalyses DeadArgumentEliminationPass::run(Module &M,
1193
1195
ModuleAnalysisManager &) {
1194
1196
// Integration header file must be provided for
1195
1197
// DAE to work on SPIR kernels.
1196
- if (CheckSyclKernels && !IntegrationHeaderFileName.getNumOccurrences ())
1198
+ if (CheckSpirKernels && !IntegrationHeaderFileName.getNumOccurrences ())
1197
1199
return PreservedAnalyses::all ();
1198
1200
1199
1201
bool Changed = false ;
0 commit comments