@@ -1838,34 +1838,55 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
18381838 if (const Arg *arg = args.getLastArgNoClaim (OPT_call_graph_profile_sort))
18391839 error (firstArgStr + " is incompatible with " + arg->getSpelling ());
18401840 };
1841+ if (args.hasArg (OPT_irpgo_profile_sort) ||
1842+ args.hasArg (OPT_irpgo_profile_sort_eq))
1843+ warn (" --irpgo-profile-sort is deprecated. Please use "
1844+ " --bp-startup-sort=function" );
1845+ if (const Arg *arg = args.getLastArg (OPT_irpgo_profile_eq))
1846+ config->irpgoProfilePath = arg->getValue ();
1847+
18411848 if (const Arg *arg = args.getLastArg (OPT_irpgo_profile_sort)) {
1842- config->irpgoProfileSortProfilePath = arg->getValue ();
1849+ config->irpgoProfilePath = arg->getValue ();
1850+ config->bpStartupFunctionSort = true ;
18431851 IncompatWithCGSort (arg->getSpelling ());
18441852 }
1845- config->compressionSortStartupFunctions =
1846- args.hasFlag (OPT_compression_sort_startup_functions,
1847- OPT_no_compression_sort_startup_functions, false );
1848- if (config->irpgoProfileSortProfilePath .empty () &&
1849- config->compressionSortStartupFunctions )
1850- error (" --compression-sort-startup-functions must be used with "
1851- " --irpgo-profile-sort" );
1852- if (const Arg *arg = args.getLastArg (OPT_compression_sort)) {
1853+ config->bpCompressionSortStartupFunctions =
1854+ args.hasFlag (OPT_bp_compression_sort_startup_functions,
1855+ OPT_no_bp_compression_sort_startup_functions, false );
1856+ if (const Arg *arg = args.getLastArg (OPT_bp_startup_sort)) {
1857+ StringRef startupSortStr = arg->getValue ();
1858+ if (startupSortStr == " function" ) {
1859+ config->bpStartupFunctionSort = true ;
1860+ } else if (startupSortStr != " none" ) {
1861+ error (" unknown value `" + startupSortStr + " ` for " + arg->getSpelling ());
1862+ }
1863+ if (startupSortStr != " none" )
1864+ IncompatWithCGSort (arg->getSpelling ());
1865+ }
1866+ if (!config->bpStartupFunctionSort &&
1867+ config->bpCompressionSortStartupFunctions )
1868+ error (" --bp-compression-sort-startup-functions must be used with "
1869+ " --bp-startup-sort=function" );
1870+ if (config->irpgoProfilePath .empty () && config->bpStartupFunctionSort )
1871+ error (" --bp-startup-sort=function must be used with "
1872+ " --irpgo-profile" );
1873+ if (const Arg *arg = args.getLastArg (OPT_bp_compression_sort)) {
18531874 StringRef compressionSortStr = arg->getValue ();
18541875 if (compressionSortStr == " function" ) {
1855- config->functionOrderForCompression = true ;
1876+ config->bpFunctionOrderForCompression = true ;
18561877 } else if (compressionSortStr == " data" ) {
1857- config->dataOrderForCompression = true ;
1878+ config->bpDataOrderForCompression = true ;
18581879 } else if (compressionSortStr == " both" ) {
1859- config->functionOrderForCompression = true ;
1860- config->dataOrderForCompression = true ;
1880+ config->bpFunctionOrderForCompression = true ;
1881+ config->bpDataOrderForCompression = true ;
18611882 } else if (compressionSortStr != " none" ) {
18621883 error (" unknown value `" + compressionSortStr + " ` for " +
18631884 arg->getSpelling ());
18641885 }
18651886 if (compressionSortStr != " none" )
18661887 IncompatWithCGSort (arg->getSpelling ());
18671888 }
1868- config->verboseBpSectionOrderer = args.hasArg (OPT_verbose_bp_section_orderer);
1889+ config->bpVerboseSectionOrderer = args.hasArg (OPT_verbose_bp_section_orderer);
18691890
18701891 for (const Arg *arg : args.filtered (OPT_alias)) {
18711892 config->aliasedSymbols .push_back (
0 commit comments