@@ -860,6 +860,16 @@ void EmitAssemblyHelper::CreatePasses(legacy::PassManager &MPM,
860
860
861
861
PMBuilder.populateFunctionPassManager (FPM);
862
862
PMBuilder.populateModulePassManager (MPM);
863
+
864
+ if (LangOpts.SYCLIsDevice ) {
865
+ // Eliminate dead arguments from SPIR kernels in SYCL environment.
866
+ // Run DAE when LLVM optimizations are applied as well.
867
+ if (LangOpts.EnableDAEInSpirKernels )
868
+ MPM.add (createDeadArgEliminationSYCLPass ());
869
+
870
+ // Allocate static local memory in SYCL kernel scope for each allocation call.
871
+ MPM.add (createSYCLLowerWGLocalMemoryLegacyPass ());
872
+ }
863
873
}
864
874
865
875
static void setCommandLineOpts (const CodeGenOptions &CodeGenOpts) {
@@ -973,12 +983,6 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
973
983
974
984
std::unique_ptr<llvm::ToolOutputFile> ThinLinkOS, DwoOS;
975
985
976
- // Eliminate dead arguments from SPIR kernels in SYCL environment.
977
- // Run DAE when LLVM optimizations are applied as well.
978
- if (LangOpts.SYCLIsDevice && !CodeGenOpts.DisableLLVMPasses &&
979
- LangOpts.EnableDAEInSpirKernels )
980
- PerModulePasses.add (createDeadArgEliminationSYCLPass ());
981
-
982
986
// Add SPIRITTAnnotations pass to the pass manager if
983
987
// -fsycl-instrument-device-code option was passed. This option can be
984
988
// used only with spir triple.
@@ -989,16 +993,6 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
989
993
PerModulePasses.add (createSPIRITTAnnotationsPass ());
990
994
}
991
995
992
- // Allocate static local memory in SYCL kernel scope for each allocation call.
993
- if (LangOpts.SYCLIsDevice ) {
994
- // Group local memory pass depends on inlining. Turn it on even in case if
995
- // all llvm passes or SYCL early optimizations are disabled.
996
- // FIXME: Remove this workaround when dependency on inlining is eliminated.
997
- if (CodeGenOpts.DisableLLVMPasses )
998
- PerModulePasses.add (createAlwaysInlinerLegacyPass (false ));
999
- PerModulePasses.add (createSYCLLowerWGLocalMemoryLegacyPass ());
1000
- }
1001
-
1002
996
switch (Action) {
1003
997
case Backend_EmitNothing:
1004
998
break ;
0 commit comments