diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index e510e10575026..59b6482bd4648 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -1081,6 +1081,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline( MPM.addPass(SYCLPropagateJointMatrixUsagePass()); // Lowers static/dynamic local memory builtin calls. MPM.addPass(SYCLLowerWGLocalMemoryPass()); + // Compile-time properties pass must create standard metadata as early + // as possible to make them available for other passes. + MPM.addPass(CompileTimePropertiesPass()); }); else if (LangOpts.SYCLIsHost && !LangOpts.SYCLESIMDBuildHostCode) PB.registerPipelineStartEPCallback( @@ -1242,9 +1245,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline( MPM.addPass(SPIRITTAnnotationsPass()); } - // Process properties and annotations - MPM.addPass(CompileTimePropertiesPass()); - // Record SYCL aspect names (this should come after propagating aspects // and before cleaning up metadata) MPM.addPass(RecordSYCLAspectNamesPass()); diff --git a/clang/test/CodeGenSYCL/kernel-early-optimization-pipeline.cpp b/clang/test/CodeGenSYCL/kernel-early-optimization-pipeline.cpp index d352f1bcca39a..1af3368350bed 100644 --- a/clang/test/CodeGenSYCL/kernel-early-optimization-pipeline.cpp +++ b/clang/test/CodeGenSYCL/kernel-early-optimization-pipeline.cpp @@ -9,6 +9,7 @@ // CHECK: SYCLPropagateAspectsUsagePass // CHECK: SYCLPropagateJointMatrixUsagePass // CHECK: SYCLLowerWGLocalMemoryPass +// CHECK: CompileTimePropertiesPass // CHECK: InferFunctionAttrsPass // CHECK: AlwaysInlinerPass // CHECK: ModuleInlinerWrapperPass @@ -17,7 +18,6 @@ // CHECK: SYCLMutatePrintfAddrspacePass // CHECK: SYCLPropagateAspectsUsagePass // CHECK: SYCLAddOptLevelAttributePass -// CHECK: CompileTimePropertiesPass // CHECK: RecordSYCLAspectNamesPass // CHECK: CleanupSYCLMetadataPass //