@@ -331,26 +331,34 @@ impl Step for Llvm {
331
331
// This flag makes sure `FileCheck` is copied in the final binaries directory.
332
332
cfg. define ( "LLVM_INSTALL_UTILS" , "ON" ) ;
333
333
334
- let mut cxxflags = vec ! [ ] ;
334
+ let mut cxxflags: Vec < String > = Vec :: new ( ) ;
335
335
if builder. config . llvm_profile_generate {
336
336
if std:: env:: var ( "LLVM_USE_CS_PGO" ) . is_ok ( ) {
337
- cfg. define ( "LLVM_BUILD_INSTRUMENTED" , "CSIR" ) ;
338
- if let Ok ( llvm_profile_dir) = std:: env:: var ( "LLVM_PROFILE_DIR" ) {
339
- cfg. define ( "LLVM_CSPROFILE_DATA_DIR" , llvm_profile_dir) ;
340
- }
337
+ //cfg.define("LLVM_BUILD_INSTRUMENTED", "CSIR");
338
+ cxxflags. push ( format ! (
339
+ "-fcs-profile-generate={}" ,
340
+ std:: env:: var( "LLVM_PROFILE_DIR" ) . unwrap( )
341
+ ) ) ;
342
+ //if let Ok(llvm_profile_dir) = std::env::var("LLVM_PROFILE_DIR") {
343
+ // cfg.define("LLVM_CSPROFILE_DATA_DIR", llvm_profile_dir);
344
+ //}
345
+ cxxflags. push ( "-mllvm" . to_string ( ) ) ;
346
+ cxxflags. push ( "-vp-counters-per-site=10" . to_string ( ) ) ;
341
347
} else {
342
- cfg. define ( "LLVM_BUILD_INSTRUMENTED" , "IR" ) ;
343
- if let Ok ( llvm_profile_dir) = std:: env:: var ( "LLVM_PROFILE_DIR" ) {
344
- cfg. define ( "LLVM_PROFILE_DATA_DIR" , llvm_profile_dir) ;
345
- }
348
+ //cfg.define("LLVM_BUILD_INSTRUMENTED", "IR");
349
+ //if let Ok(llvm_profile_dir) = std::env::var("LLVM_PROFILE_DIR") {
350
+ // cfg.define("LLVM_PROFILE_DATA_DIR", llvm_profile_dir);
351
+ //}
352
+ cxxflags. push ( format ! (
353
+ "-fprofile-generate={}" ,
354
+ std:: env:: var( "LLVM_PROFILE_DIR" ) . unwrap( )
355
+ ) ) ;
346
356
}
347
- cxxflags. push ( "-mllvm" ) ;
348
- cxxflags. push ( "-vp-counters-per-site=10" ) ;
349
357
cfg. define ( "LLVM_BUILD_RUNTIME" , "No" ) ;
350
358
}
351
359
if let Some ( path) = builder. config . llvm_profile_use . as_ref ( ) {
352
360
// cfg.define("LLVM_PROFDATA_FILE", &path);
353
- cxxflags. push ( & format ! ( "-fprofile-use={path}" ) ) ;
361
+ cxxflags. push ( format ! ( "-fprofile-use={path}" ) ) ;
354
362
}
355
363
if builder. config . llvm_bolt_profile_generate
356
364
|| builder. config . llvm_bolt_profile_use . is_some ( )
@@ -485,7 +493,14 @@ impl Step for Llvm {
485
493
cfg. define ( "LLVM_VERSION_SUFFIX" , suffix) ;
486
494
}
487
495
488
- configure_cmake ( builder, target, & mut cfg, true , ldflags, & [ ] ) ;
496
+ configure_cmake (
497
+ builder,
498
+ target,
499
+ & mut cfg,
500
+ true ,
501
+ ldflags,
502
+ & cxxflags. iter ( ) . map ( |s| s. as_str ( ) ) . collect :: < Vec < _ > > ( ) ,
503
+ ) ;
489
504
configure_llvm ( builder, target, & mut cfg) ;
490
505
491
506
for ( key, val) in & builder. config . llvm_build_config {
0 commit comments