r281910 - Remove InstructionCombining and its related pass from sample pgo passes as we can handle "invoke" correctly.
Author: dehao Date: Mon Sep 19 11:02:52 2016 New Revision: 281910 URL: http://llvm.org/viewvc/llvm-project?rev=281910&view=rev Log: Remove InstructionCombining and its related pass from sample pgo passes as we can handle "invoke" correctly. Summary: We previously relies on InstructionCombining pass to remove invoke instructions. Now that we can inline invoke instructions correctly, we do not need these passes any more. Reviewers: dnovillo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24730 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/pgo-sample.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=281910&r1=281909&r2=281910&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Sep 19 11:02:52 2016 @@ -149,17 +149,6 @@ static void addAddDiscriminatorsPass(con PM.add(createAddDiscriminatorsPass()); } -static void addCleanupPassesForSampleProfiler( -const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { - // instcombine is needed before sample profile annotation because it converts - // certain function calls to be inlinable. simplifycfg and sroa are needed - // before instcombine for necessary preparation. E.g. load store is eliminated - // properly so that instcombine will not introduce unecessary liverange. - PM.add(createCFGSimplificationPass()); - PM.add(createSROAPass()); - PM.add(createInstructionCombiningPass()); -} - static void addBoundsCheckingPass(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { PM.add(createBoundsCheckingPass()); @@ -464,8 +453,6 @@ void EmitAssemblyHelper::CreatePasses(le if (!CodeGenOpts.SampleProfileFile.empty()) { MPM.add(createPruneEHPass()); MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); -PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, - addCleanupPassesForSampleProfiler); } PMBuilder.populateFunctionPassManager(FPM); Modified: cfe/trunk/test/CodeGen/pgo-sample.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample.c?rev=281910&r1=281909&r2=281910&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample.c Mon Sep 19 11:02:52 2016 @@ -2,8 +2,5 @@ // // Ensure Pass PGOInstrumentationGenPass is invoked. // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -// CHECK: Simplify the CFG -// CHECK: SROA -// CHECK: Combine redundant instructions // CHECK: Remove unused exception handling info // CHECK: Sample profile pass ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r283564 - Update clang test to accomendate discriminator change in https://reviews.llvm.org/D25132
Author: dehao Date: Fri Oct 7 10:21:29 2016 New Revision: 283564 URL: http://llvm.org/viewvc/llvm-project?rev=283564&view=rev Log: Update clang test to accomendate discriminator change in https://reviews.llvm.org/D25132 Summary: https://reviews.llvm.org/D25132 added discriminator even add -g0. This leads to test fail which is addressed in thie patch. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25133 Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=283564&r1=283563&r2=283564&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Fri Oct 7 10:21:29 2016 @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple %itanium_abi_triple | FileCheck %s -// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s +// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - -triple %itanium_abi_triple | FileCheck %s +// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s int &src(); int *sink(); Modified: cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m?rev=283564&r1=283563&r2=283564&view=diff == --- cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m (original) +++ cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Fri Oct 7 10:21:29 2016 @@ -30,10 +30,11 @@ NSRect NSMakeRect(CGFloat x, CGFloat y, // CHECK: define {{.*}}_createBezierPathWithWidth // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]] // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]] - // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]] + // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC1:[0-9]+]] // CHECK: ret {{.*}} !dbg ![[ARC]] // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) return path; - // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) + // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+2]], scope: !{{.*}}) + // CHECK: ![[ARC1]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) } @end ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r292458 - Add -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection
On Fri, Aug 18, 2017 at 2:46 PM, Hans Wennborg wrote: > Should we mention this in the release notes? > Is the flag documented somewhere? > It's documented in the Options.td file, do you think there are other documents that need to be added/updated? Thanks, Dehao > > On Wed, Jan 18, 2017 at 4:44 PM, Dehao Chen via cfe-commits > wrote: > > Author: dehao > > Date: Wed Jan 18 18:44:21 2017 > > New Revision: 292458 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=292458&view=rev > > Log: > > Add -fdebug-info-for-profiling to emit more debug info for sample pgo > profile collection > > > > Summary: > > SamplePGO uses profile with debug info to collect profile. Unlike the > traditional debugging purpose, sample pgo needs more accurate debug info to > represent the profile. We add -femit-accurate-debug-info for this purpose. > It can be combined with all debugging modes (-g, -gmlt, etc). It makes sure > that the following pieces of info is always emitted: > > > > * start line of all subprograms > > * linkage name of all subprograms > > * standalone subprograms (functions that has neither inlined nor been > inlined) > > > > The impact on speccpu2006 binary size (size increase comparing with -g0 > binary, also includes data for -g binary, which does not change with this > patch): > > > >-gmlt(orig) -gmlt(patched) -g > > 433.milc 4.68% 5.40% 19.73% > > 444.namd 8.45% 8.93% 45.99% > > 447.dealII 97.43% 115.21%374.89% > > 450.soplex 27.75% 31.88% 126.04% > > 453.povray 21.81% 26.16% 92.03% > > 470.lbm0.60% 0.67% 1.96% > > 482.sphinx35.77% 6.47% 26.17% > > 400.perlbench 17.81% 19.43% 73.08% > > 401.bzip2 3.73% 3.92% 12.18% > > 403.gcc31.75% 34.48% 122.75% > > 429.mcf0.78% 0.88% 3.89% > > 445.gobmk 6.08% 7.92% 42.27% > > 456.hmmer 10.36% 11.25% 35.23% > > 458.sjeng 5.08% 5.42% 14.36% > > 462.libquantum 1.71% 1.96% 6.36% > > 464.h264ref15.61% 16.56% 43.92% > > 471.omnetpp11.93% 15.84% 60.09% > > 473.astar 3.11% 3.69% 14.18% > > 483.xalancbmk 56.29% 81.63% 353.22% > > geomean15.60% 18.30% 57.81% > > > > Debug info size change for -gmlt binary with this patch: > > > > 433.milc 13.46% > > 444.namd 5.35% > > 447.dealII 18.21% > > 450.soplex 14.68% > > 453.povray 19.65% > > 470.lbm6.03% > > 482.sphinx311.21% > > 400.perlbench 8.91% > > 401.bzip2 4.41% > > 403.gcc8.56% > > 429.mcf8.24% > > 445.gobmk 29.47% > > 456.hmmer 8.19% > > 458.sjeng 6.05% > > 462.libquantum 11.23% > > 464.h264ref5.93% > > 471.omnetpp31.89% > > 473.astar 16.20% > > 483.xalancbmk 44.62% > > geomean16.83% > > > > Reviewers: davidxl, andreadb, rob.lougher, dblaikie, echristo > > > > Reviewed By: dblaikie, echristo > > > > Subscribers: hfinkel, rob.lougher, andreadb, gbedwell, cfe-commits, > probinson, llvm-commits, mehdi_amini > > > > Differential Revision: https://reviews.llvm.org/D25435 > > > > Modified: > > cfe/trunk/include/clang/Driver/Options.td > > cfe/trunk/include/clang/Frontend/CodeGenOptions.def > > cfe/trunk/lib/CodeGen/BackendUtil.cpp > > cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > > cfe/trunk/lib/Driver/Tools.cpp > > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > > cfe/trunk/test/Driver/clang_f_opts.c > > > > Modified: cfe/trunk/include/clang/Driver/Options.td > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Driver/Options.td?rev=292458&r1=292457&r2=292458&view=diff > > > == > > --- cfe/trunk/include/clang/Driver/Options.td (original) > > +++ cfe/trunk/include/clang/Driver/Options.td Wed Jan 18 18:44:21 2017 > > @@ -516,6 +516,12 @@ def fprofile_sample_use_EQ : Joined<["-" > > HelpText<"Enable sample-based profile guided optimizations">; > > def fauto_profile_EQ : Joined<["-"], "fauto-profile=">, > > Alias; > > +def fdebug_info_for_profiling : Flag<["-"],
r311707 - Expose -mllvm -accurate-sample-profile to clang.
Author: dehao Date: Thu Aug 24 14:37:33 2017 New Revision: 311707 URL: http://llvm.org/viewvc/llvm-project?rev=311707&view=rev Log: Expose -mllvm -accurate-sample-profile to clang. Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20% Reviewers: davidxl, rsmith Reviewed By: davidxl, rsmith Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D37091 Added: cfe/trunk/test/CodeGen/profile-sample-accurate.c cfe/trunk/test/Integration/thinlto_profile_sample_accurate.c Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/Driver/clang_f_opts.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=311707&r1=311706&r2=311707&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 24 14:37:33 2017 @@ -637,12 +637,25 @@ def fno_profile_sample_use : Flag<["-"], def fprofile_sample_use_EQ : Joined<["-"], "fprofile-sample-use=">, Group, Flags<[DriverOption, CC1Option]>, HelpText<"Enable sample-based profile guided optimizations">; +def fprofile_sample_accurate : Flag<["-"], "fprofile-sample-accurate">, +Group, Flags<[DriverOption, CC1Option]>, +HelpText<"Specifies that the sample profile is accurate">, +DocBrief<[{Specifies that the sample profile is accurate. If the sample + profile is accurate, callsites without profile samples are marked + as cold. Otherwise, treat callsites without profile samples as if + we have no profile}]>; +def fno_profile_sample_accurate : Flag<["-"], "fno-profile-sample-accurate">, + Group, Flags<[DriverOption]>; def fauto_profile : Flag<["-"], "fauto-profile">, Group, Alias; def fno_auto_profile : Flag<["-"], "fno-auto-profile">, Group, Alias; def fauto_profile_EQ : Joined<["-"], "fauto-profile=">, Alias; +def fauto_profile_accurate : Flag<["-"], "fauto-profile-accurate">, +Group, Alias; +def fno_auto_profile_accurate : Flag<["-"], "fno-auto-profile-accurate">, +Group, Alias; def fdebug_info_for_profiling : Flag<["-"], "fdebug-info-for-profiling">, Group, Flags<[CC1Option]>, HelpText<"Emit extra debug info to make sample profile more accurate.">; Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=311707&r1=311706&r2=311707&view=diff == --- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original) +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Thu Aug 24 14:37:33 2017 @@ -183,6 +183,7 @@ CODEGENOPT(UnsafeFPMath , 1, 0) /// CODEGENOPT(UnwindTables , 1, 0) ///< Emit unwind tables. CODEGENOPT(VectorizeLoop , 1, 0) ///< Run loop vectorizer. CODEGENOPT(VectorizeSLP , 1, 0) ///< Run SLP vectorizer. +CODEGENOPT(ProfileSampleAccurate, 1, 0) ///< Sample profile is accurate. /// Attempt to use register sized accesses to bit-fields in structures, when /// possible. Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=311707&r1=311706&r2=311707&view=diff == --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Thu Aug 24 14:37:33 2017 @@ -838,6 +838,10 @@ void CodeGenFunction::StartFunction(Glob Fn->addFnAttr("no-jump-tables", llvm::toStringRef(CGM.getCodeGenOpts().NoUseJumpTables)); + // Add profile-sample-accurate value. + if (CGM.getCodeGenOpts().ProfileSampleAccurate) +Fn->addFnAttr("profile-sample-accurate"); + if (getLangOpts().OpenCL) { // Add metadata for a kernel function. if (const FunctionDecl *FD = dyn_cast_or_null(D)) Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=311707&r1=311706&r2=311707&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Aug 24 14:37:33 2017 @@ -2340,6 +2340,10 @@ void Clang::ConstructJob(Compilation &C, true)) CmdArgs.push_back("-fno-jump-tables"); + if (Args.hasFlag(options::OPT_fprofile_sample_accurate, +
r289675 - revert r289670 which breaks bot.
Author: dehao Date: Wed Dec 14 11:22:53 2016 New Revision: 289675 URL: http://llvm.org/viewvc/llvm-project?rev=289675&view=rev Log: revert r289670 which breaks bot. Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=289675&r1=289674&r2=289675&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Dec 14 11:22:53 2016 @@ -464,8 +464,10 @@ void EmitAssemblyHelper::CreatePasses(le if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; - if (!CodeGenOpts.SampleProfileFile.empty()) -PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile; + if (!CodeGenOpts.SampleProfileFile.empty()) { +MPM.add(createPruneEHPass()); +MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); + } PMBuilder.populateFunctionPassManager(FPM); PMBuilder.populateModulePassManager(MPM); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289715 - Create SampleProfileLoader pass in llvm instead of clang
Author: dehao Date: Wed Dec 14 15:41:04 2016 New Revision: 289715 URL: http://llvm.org/viewvc/llvm-project?rev=289715&view=rev Log: Create SampleProfileLoader pass in llvm instead of clang Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder. Reviewers: tejohnson, davidxl, dnovillo Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D27744 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=289715&r1=289714&r2=289715&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Dec 14 15:41:04 2016 @@ -464,10 +464,8 @@ void EmitAssemblyHelper::CreatePasses(le if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; - if (!CodeGenOpts.SampleProfileFile.empty()) { -MPM.add(createPruneEHPass()); -MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); - } + if (!CodeGenOpts.SampleProfileFile.empty()) +PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile; PMBuilder.populateFunctionPassManager(FPM); PMBuilder.populateModulePassManager(MPM); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r290919 - Add -plugin-opt=sample-profile for thinLTO build.
Author: dehao Date: Tue Jan 3 18:33:23 2017 New Revision: 290919 URL: http://llvm.org/viewvc/llvm-project?rev=290919&view=rev Log: Add -plugin-opt=sample-profile for thinLTO build. Summary: ThinLTO needs to pass down the sample profile file path to linker. Reviewers: tejohnson, davidxl, mehdi_amini Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D27832 Added: cfe/trunk/test/Driver/gold-lto-samplepgo.c Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=290919&r1=290918&r2=290919&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 3 18:33:23 2017 @@ -2235,6 +2235,15 @@ static void AddGoldPlugin(const ToolChai UseSeparateSections)) { CmdArgs.push_back("-plugin-opt=-data-sections"); } + + if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) { +StringRef FName = A->getValue(); +if (!llvm::sys::fs::exists(FName)) + D.Diag(diag::err_drv_no_such_file) << FName; +else + CmdArgs.push_back( + Args.MakeArgString(Twine("-plugin-opt=sample-profile=") + FName)); + } } /// This is a helper function for validating the optional refinement step Added: cfe/trunk/test/Driver/gold-lto-samplepgo.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/gold-lto-samplepgo.c?rev=290919&view=auto == --- cfe/trunk/test/Driver/gold-lto-samplepgo.c (added) +++ cfe/trunk/test/Driver/gold-lto-samplepgo.c Tue Jan 3 18:33:23 2017 @@ -0,0 +1,7 @@ +// RUN: touch %t.o +// +// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ +// RUN: -Wl,-plugin-opt=foo -O3 \ +// RUN: -fprofile-sample-use=%s \ +// RUN: | FileCheck %s +// CHECK: -plugin-opt=sample-profile= ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281509 - Convert finite to builtin
Author: dehao Date: Wed Sep 14 12:34:14 2016 New Revision: 281509 URL: http://llvm.org/viewvc/llvm-project?rev=281509&view=rev Log: Convert finite to builtin Summary: This patch converts finite/__finite to builtin functions so that it will be inlined by compiler. Reviewers: hfinkel, davidxl, efriedma Subscribers: efriedma, llvm-commits Differential Revision: https://reviews.llvm.org/D24483 Modified: cfe/trunk/include/clang/Basic/Builtins.def cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtins.c Modified: cfe/trunk/include/clang/Basic/Builtins.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=281509&r1=281508&r2=281509&view=diff == --- cfe/trunk/include/clang/Basic/Builtins.def (original) +++ cfe/trunk/include/clang/Basic/Builtins.def Wed Sep 14 12:34:14 2016 @@ -937,6 +937,14 @@ LIBBUILTIN(fabs, "dd", "fnc", "math.h", LIBBUILTIN(fabsf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fabsl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) +LIBBUILTIN(finite, "id", "fnc", "math.h", GNU_LANG) +LIBBUILTIN(finitef, "if", "fnc", "math.h", GNU_LANG) +LIBBUILTIN(finitel, "iLd", "fnc", "math.h", GNU_LANG) +// glibc's math.h generates calls to __finite +LIBBUILTIN(__finite, "id", "fnc", "math.h", ALL_LANGUAGES) +LIBBUILTIN(__finitef, "if", "fnc", "math.h", ALL_LANGUAGES) +LIBBUILTIN(__finitel, "iLd", "fnc", "math.h", ALL_LANGUAGES) + LIBBUILTIN(fmod, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmodf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmodl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=281509&r1=281508&r2=281509&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Sep 14 12:34:14 2016 @@ -903,6 +903,12 @@ RValue CodeGenFunction::EmitBuiltinExpr( return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(; } + case Builtin::BIfinite: + case Builtin::BI__finite: + case Builtin::BIfinitef: + case Builtin::BI__finitef: + case Builtin::BIfinitel: + case Builtin::BI__finitel: case Builtin::BI__builtin_isinf: case Builtin::BI__builtin_isfinite: { // isinf(x)--> fabs(x) == infinity Modified: cfe/trunk/test/CodeGen/builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=281509&r1=281508&r2=281509&view=diff == --- cfe/trunk/test/CodeGen/builtins.c (original) +++ cfe/trunk/test/CodeGen/builtins.c Wed Sep 14 12:34:14 2016 @@ -220,6 +220,10 @@ void test_float_builtins(float F, double // CHECK: call float @llvm.fabs.f32(float // CHECK: fcmp one float {{.*}}, 0x7FF0 + res = finite(D); + // CHECK: call double @llvm.fabs.f64(double + // CHECK: fcmp one double {{.*}}, 0x7FF0 + res = __builtin_isnormal(F); // CHECK: fcmp oeq float // CHECK: call float @llvm.fabs.f32(float ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298429 - Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.
Author: dehao Date: Tue Mar 21 14:55:46 2017 New Revision: 298429 URL: http://llvm.org/viewvc/llvm-project?rev=298429&view=rev Log: Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase. Summary: Because SamplePGO passes will be invoked twice in ThinLTO build: once at compile phase, the other at backend. We want to make sure the IR at the 2nd phase matches the hot part in pro file, thus we do not want to inline hot callsites in the first phase. Reviewers: tejohnson, eraman Reviewed By: tejohnson Subscribers: mehdi_amini, cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D31202 Added: cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=298429&r1=298428&r2=298429&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Mar 21 14:55:46 2017 @@ -318,8 +318,13 @@ void EmitAssemblyHelper::CreatePasses(le !CodeGenOpts.DisableLifetimeMarkers); PMBuilder.Inliner = createAlwaysInlinerLegacyPass(InsertLifetimeIntrinsics); } else { +// We do not want to inline hot callsites for SamplePGO module-summary build +// because profile annotation will happen again in ThinLTO backend, and we +// want the IR of the hot path to match the profile. PMBuilder.Inliner = createFunctionInliningPass( -CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize); +CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize, +(!CodeGenOpts.SampleProfileFile.empty() && + CodeGenOpts.EmitSummaryIndex)); } PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel; Added: cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof?rev=298429&view=auto == --- cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof (added) +++ cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof Tue Mar 21 14:55:46 2017 @@ -0,0 +1,2 @@ +bar:100:100 + 2: 2000 foo:2000 Added: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=298429&view=auto == --- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (added) +++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Tue Mar 21 14:55:46 2017 @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=INLINE +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=NOINLINE +// Checks if hot call is inlined by normal compile, but not inlined by +// thinlto compile. + +int baz(int); +int g; + +void foo(int n) { + for (int i = 0; i < n; i++) +g += baz(i); +} + +// INLINE-NOT: call{{.*}}foo +// NOINLINE: call{{.*}}foo +void bar(int n) { + for (int i = 0; i < n; i++) +foo(i); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298446 - Add support for -fno-auto-profile and -fno-profile-sample-use
Author: dehao Date: Tue Mar 21 16:40:53 2017 New Revision: 298446 URL: http://llvm.org/viewvc/llvm-project?rev=298446&view=rev Log: Add support for -fno-auto-profile and -fno-profile-sample-use Summary: We need to be able to disable samplepgo for specific files by supporting -fno-auto-profile and -fno-profile-sample-use Reviewers: davidxl, dnovillo, echristo Reviewed By: echristo Subscribers: echristo, cfe-commits Differential Revision: https://reviews.llvm.org/D31213 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp cfe/trunk/lib/Driver/ToolChains/CommonArgs.h cfe/trunk/test/Driver/clang_f_opts.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=298446&r1=298445&r2=298446&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Tue Mar 21 16:40:53 2017 @@ -613,9 +613,17 @@ def fno_gnu_inline_asm : Flag<["-"], "fn Flags<[DriverOption, CC1Option]>, HelpText<"Disable GNU style inline asm">; +def fprofile_sample_use : Flag<["-"], "fprofile-sample-use">, Group, +Flags<[CoreOption]>; +def fno_profile_sample_use : Flag<["-"], "fno-profile-sample-use">, Group, +Flags<[CoreOption]>; def fprofile_sample_use_EQ : Joined<["-"], "fprofile-sample-use=">, Group, Flags<[DriverOption, CC1Option]>, HelpText<"Enable sample-based profile guided optimizations">; +def fauto_profile : Flag<["-"], "fauto-profile">, Group, +Alias; +def fno_auto_profile : Flag<["-"], "fno-auto-profile">, Group, +Alias; def fauto_profile_EQ : Joined<["-"], "fauto-profile=">, Alias; def fdebug_info_for_profiling : Flag<["-"], "fdebug-info-for-profiling">, Group, Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=298446&r1=298445&r2=298446&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Mar 21 16:40:53 2017 @@ -3431,7 +3431,7 @@ void Clang::ConstructJob(Compilation &C, // Forward -f options with positive and negative forms; we translate // these by hand. - if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) { + if (Arg *A = getLastProfileSampleUseArg(Args)) { StringRef fname = A->getValue(); if (!llvm::sys::fs::exists(fname)) D.Diag(diag::err_drv_no_such_file) << fname; Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=298446&r1=298445&r2=298446&view=diff == --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Tue Mar 21 16:40:53 2017 @@ -407,7 +407,7 @@ void tools::AddGoldPlugin(const ToolChai CmdArgs.push_back("-plugin-opt=-data-sections"); } - if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) { + if (Arg *A = getLastProfileSampleUseArg(Args)) { StringRef FName = A->getValue(); if (!llvm::sys::fs::exists(FName)) D.Diag(diag::err_drv_no_such_file) << FName; @@ -673,6 +673,22 @@ Arg *tools::getLastProfileUseArg(const A return ProfileUseArg; } +Arg *tools::getLastProfileSampleUseArg(const ArgList &Args) { + auto *ProfileSampleUseArg = Args.getLastArg( + options::OPT_fprofile_sample_use, options::OPT_fprofile_sample_use_EQ, + options::OPT_fauto_profile, options::OPT_fauto_profile_EQ, + options::OPT_fno_profile_sample_use, options::OPT_fno_auto_profile); + + if (ProfileSampleUseArg && + (ProfileSampleUseArg->getOption().matches( + options::OPT_fno_profile_sample_use) || + ProfileSampleUseArg->getOption().matches(options::OPT_fno_auto_profile))) +return nullptr; + + return Args.getLastArg(options::OPT_fprofile_sample_use_EQ, + options::OPT_fauto_profile_EQ); +} + /// Parses the various -fpic/-fPIC/-fpie/-fPIE arguments. Then, /// smooshes them together with platform defaults, to decide whether /// this compile should be using PIC mode or not. Returns a tuple of Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.h?rev=298446&r1=298445&r2=298446&view=diff == --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.h (original) +++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.h Tue Mar 21 16:40:53 2017 @@ -63,6 +63,7 @@ void addOpenMPRuntime(llvm::opt::ArgStri const llvm::o
r298647 - Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase.
Author: dehao Date: Thu Mar 23 16:20:17 2017 New Revision: 298647 URL: http://llvm.org/viewvc/llvm-project?rev=298647&view=rev Log: Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase. Summary: This is the test added for https://reviews.llvm.org/D31217 Reviewers: tejohnson, mehdi_amini Reviewed By: tejohnson Subscribers: cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D31219 Modified: cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Modified: cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof?rev=298647&r1=298646&r2=298647&view=diff == --- cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof (original) +++ cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof Thu Mar 23 16:20:17 2017 @@ -1,2 +1,4 @@ bar:100:100 2: 2000 foo:2000 +icp:100:100 + 1: 1000 unroll:1000 Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=298647&r1=298646&r2=298647&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Thu Mar 23 16:20:17 2017 @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=INLINE -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=NOINLINE +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=O2 +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO // Checks if hot call is inlined by normal compile, but not inlined by // thinlto compile. @@ -11,9 +11,32 @@ void foo(int n) { g += baz(i); } -// INLINE-NOT: call{{.*}}foo -// NOINLINE: call{{.*}}foo +// O2-LABEL: define void @bar +// THINLTO-LABEL: define void @bar +// O2-NOT: call{{.*}}foo +// THINLTO: call{{.*}}foo void bar(int n) { for (int i = 0; i < n; i++) foo(i); } + +// Checks if loop unroll is invoked by normal compile, but not thinlto compile. +// O2-LABEL: define void @unroll +// THINLTO-LABEL: define void @unroll +// O2: call{{.*}}baz +// O2: call{{.*}}baz +// THINLTO: call{{.*}}baz +// THINLTO-NOT: call{{.*}}baz +void unroll() { + for (int i = 0; i < 2; i++) +baz(i); +} + +// Checks if icp is invoked by normal compile, but not thinlto compile. +// O2-LABEL: define void @icp +// THINLTO-LABEL: define void @icp +// O2: if.true.direct_targ +// ThinLTO-NOT: if.true.direct_targ +void icp(void (*p)()) { + p(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291774 - Pass -fprofile-sample-use to lto backends.
Author: dehao Date: Thu Jan 12 10:29:25 2017 New Revision: 291774 URL: http://llvm.org/viewvc/llvm-project?rev=291774&view=rev Log: Pass -fprofile-sample-use to lto backends. Summary: LTO backend will not invoke SampleProfileLoader pass even if -fprofile-sample-use is specified. This patch passes the flag down so that pass manager can add the SampleProfileLoader pass correctly. Reviewers: mehdi_amini, tejohnson Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28588 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/thinlto_backend.ll Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=291774&r1=291773&r2=291774&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jan 12 10:29:25 2017 @@ -862,7 +862,8 @@ void EmitAssemblyHelper::EmitAssemblyWit } static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M, - std::unique_ptr OS) { + std::unique_ptr OS, + std::string SampleProfile) { StringMap> ModuleToDefinedGVSummaries; CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); @@ -930,6 +931,7 @@ static void runThinLTOBackend(ModuleSumm return llvm::make_unique(std::move(OS)); }; lto::Config Conf; + Conf.SampleProfile = SampleProfile; if (Error E = thinBackend( Conf, 0, AddStream, *M, *CombinedIndex, ImportList, ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) { @@ -965,7 +967,8 @@ void clang::EmitBackendOutput(Diagnostic // of an error). bool DoThinLTOBackend = CombinedIndex != nullptr; if (DoThinLTOBackend) { - runThinLTOBackend(CombinedIndex.get(), M, std::move(OS)); + runThinLTOBackend(CombinedIndex.get(), M, std::move(OS), +CGOpts.SampleProfileFile); return; } } Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto_backend.ll?rev=291774&r1=291773&r2=291774&view=diff == --- cfe/trunk/test/CodeGen/thinlto_backend.ll (original) +++ cfe/trunk/test/CodeGen/thinlto_backend.ll Thu Jan 12 10:29:25 2017 @@ -8,6 +8,10 @@ ; RUN: not %clang_cc1 -O2 -o %t1.o -x c %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING ; CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' +; Ensure sample profile pass are passed to backend +; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc -fprofile-sample-use=%S/Inputs/pgo-sample.prof -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-SAMPLEPGO +; CHECK-SAMPLEPGO: Sample profile pass + ; Ensure we get expected error for missing index file ; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR1 ; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291775 - Revert r291774 which caused buildbot failure.
Author: dehao Date: Thu Jan 12 10:56:18 2017 New Revision: 291775 URL: http://llvm.org/viewvc/llvm-project?rev=291775&view=rev Log: Revert r291774 which caused buildbot failure. Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/thinlto_backend.ll Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=291775&r1=291774&r2=291775&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jan 12 10:56:18 2017 @@ -862,8 +862,7 @@ void EmitAssemblyHelper::EmitAssemblyWit } static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M, - std::unique_ptr OS, - std::string SampleProfile) { + std::unique_ptr OS) { StringMap> ModuleToDefinedGVSummaries; CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); @@ -931,7 +930,6 @@ static void runThinLTOBackend(ModuleSumm return llvm::make_unique(std::move(OS)); }; lto::Config Conf; - Conf.SampleProfile = SampleProfile; if (Error E = thinBackend( Conf, 0, AddStream, *M, *CombinedIndex, ImportList, ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) { @@ -967,8 +965,7 @@ void clang::EmitBackendOutput(Diagnostic // of an error). bool DoThinLTOBackend = CombinedIndex != nullptr; if (DoThinLTOBackend) { - runThinLTOBackend(CombinedIndex.get(), M, std::move(OS), -CGOpts.SampleProfileFile); + runThinLTOBackend(CombinedIndex.get(), M, std::move(OS)); return; } } Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto_backend.ll?rev=291775&r1=291774&r2=291775&view=diff == --- cfe/trunk/test/CodeGen/thinlto_backend.ll (original) +++ cfe/trunk/test/CodeGen/thinlto_backend.ll Thu Jan 12 10:56:18 2017 @@ -8,10 +8,6 @@ ; RUN: not %clang_cc1 -O2 -o %t1.o -x c %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING ; CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' -; Ensure sample profile pass are passed to backend -; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc -fprofile-sample-use=%S/Inputs/pgo-sample.prof -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-SAMPLEPGO -; CHECK-SAMPLEPGO: Sample profile pass - ; Ensure we get expected error for missing index file ; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR1 ; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291870 - Pass -fprofile-sample-use to lto backends.
Author: dehao Date: Thu Jan 12 18:51:55 2017 New Revision: 291870 URL: http://llvm.org/viewvc/llvm-project?rev=291870&view=rev Log: Pass -fprofile-sample-use to lto backends. Summary: LTO backend will not invoke SampleProfileLoader pass even if -fprofile-sample-use is specified. This patch passes the flag down so that pass manager can add the SampleProfileLoader pass correctly. Reviewers: mehdi_amini, tejohnson Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28588 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/thinlto_backend.ll Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=291870&r1=291869&r2=291870&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jan 12 18:51:55 2017 @@ -862,7 +862,8 @@ void EmitAssemblyHelper::EmitAssemblyWit } static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M, - std::unique_ptr OS) { + std::unique_ptr OS, + std::string SampleProfile) { StringMap> ModuleToDefinedGVSummaries; CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); @@ -930,6 +931,7 @@ static void runThinLTOBackend(ModuleSumm return llvm::make_unique(std::move(OS)); }; lto::Config Conf; + Conf.SampleProfile = SampleProfile; if (Error E = thinBackend( Conf, 0, AddStream, *M, *CombinedIndex, ImportList, ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) { @@ -965,7 +967,8 @@ void clang::EmitBackendOutput(Diagnostic // of an error). bool DoThinLTOBackend = CombinedIndex != nullptr; if (DoThinLTOBackend) { - runThinLTOBackend(CombinedIndex.get(), M, std::move(OS)); + runThinLTOBackend(CombinedIndex.get(), M, std::move(OS), +CGOpts.SampleProfileFile); return; } } Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto_backend.ll?rev=291870&r1=291869&r2=291870&view=diff == --- cfe/trunk/test/CodeGen/thinlto_backend.ll (original) +++ cfe/trunk/test/CodeGen/thinlto_backend.ll Thu Jan 12 18:51:55 2017 @@ -8,6 +8,10 @@ ; RUN: not %clang_cc1 -O2 -o %t1.o -x c %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING ; CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' +; Ensure sample profile pass are passed to backend +; RUN: %clang_cc1 -emit-obj -O2 -o %t5.o -x ir %t1.o -fthinlto-index=%t.thinlto.bc -fprofile-sample-use=%S/Inputs/pgo-sample.prof -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-SAMPLEPGO +; CHECK-SAMPLEPGO: Sample profile pass + ; Ensure we get expected error for missing index file ; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR1 ; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291874 - Temporarily revert the test change in 291870, which is broken in certain buildbots.
Author: dehao Date: Thu Jan 12 19:09:43 2017 New Revision: 291874 URL: http://llvm.org/viewvc/llvm-project?rev=291874&view=rev Log: Temporarily revert the test change in 291870, which is broken in certain buildbots. Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto_backend.ll?rev=291874&r1=291873&r2=291874&view=diff == --- cfe/trunk/test/CodeGen/thinlto_backend.ll (original) +++ cfe/trunk/test/CodeGen/thinlto_backend.ll Thu Jan 12 19:09:43 2017 @@ -8,10 +8,6 @@ ; RUN: not %clang_cc1 -O2 -o %t1.o -x c %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING ; CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' -; Ensure sample profile pass are passed to backend -; RUN: %clang_cc1 -emit-obj -O2 -o %t5.o -x ir %t1.o -fthinlto-index=%t.thinlto.bc -fprofile-sample-use=%S/Inputs/pgo-sample.prof -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-SAMPLEPGO -; CHECK-SAMPLEPGO: Sample profile pass - ; Ensure we get expected error for missing index file ; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR1 ; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D28588: Pass -fprofile-sample-use to lto backends.
On Thu, Jan 12, 2017 at 3:27 PM, Teresa Johnson via Phabricator < revi...@reviews.llvm.org> wrote: > tejohnson added a comment. > > In https://reviews.llvm.org/D28588#644489, @danielcdh wrote: > > > Thanks for the prompt response. > > > > But looks like several other tests also has "-mllvm > -debug-pass=Structure" in their tests: > > > > tools/clang/test/CodeGen/pgo-instrumentation.c > > test/CodeGen/Generic/llc-start-stop.ll > > > > I just verified that if I cmake with -DCMAKE_BUILD_TYPE=Release, it > still passes locally. > > > Hmm, maybe that flavor of -debug output is enabled with NDEBUG then. I'm > not really sure unfortunately. > > I don't even see an error message for the second one, do you? Just an > error code. > >From the first buildbot failure (windows), looks like it's not just lack of output, but also the compile command failed: note: command had no output on stdout or stderr error: command failed with exit status: 1 But it did not provide why it exits non-zero. Dehao > > > Thanks, > > Dehao > > > > > https://reviews.llvm.org/D28588 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292458 - Add -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection
Author: dehao Date: Wed Jan 18 18:44:21 2017 New Revision: 292458 URL: http://llvm.org/viewvc/llvm-project?rev=292458&view=rev Log: Add -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection Summary: SamplePGO uses profile with debug info to collect profile. Unlike the traditional debugging purpose, sample pgo needs more accurate debug info to represent the profile. We add -femit-accurate-debug-info for this purpose. It can be combined with all debugging modes (-g, -gmlt, etc). It makes sure that the following pieces of info is always emitted: * start line of all subprograms * linkage name of all subprograms * standalone subprograms (functions that has neither inlined nor been inlined) The impact on speccpu2006 binary size (size increase comparing with -g0 binary, also includes data for -g binary, which does not change with this patch): -gmlt(orig) -gmlt(patched) -g 433.milc 4.68% 5.40% 19.73% 444.namd 8.45% 8.93% 45.99% 447.dealII 97.43% 115.21%374.89% 450.soplex 27.75% 31.88% 126.04% 453.povray 21.81% 26.16% 92.03% 470.lbm0.60% 0.67% 1.96% 482.sphinx35.77% 6.47% 26.17% 400.perlbench 17.81% 19.43% 73.08% 401.bzip2 3.73% 3.92% 12.18% 403.gcc31.75% 34.48% 122.75% 429.mcf0.78% 0.88% 3.89% 445.gobmk 6.08% 7.92% 42.27% 456.hmmer 10.36% 11.25% 35.23% 458.sjeng 5.08% 5.42% 14.36% 462.libquantum 1.71% 1.96% 6.36% 464.h264ref15.61% 16.56% 43.92% 471.omnetpp11.93% 15.84% 60.09% 473.astar 3.11% 3.69% 14.18% 483.xalancbmk 56.29% 81.63% 353.22% geomean15.60% 18.30% 57.81% Debug info size change for -gmlt binary with this patch: 433.milc 13.46% 444.namd 5.35% 447.dealII 18.21% 450.soplex 14.68% 453.povray 19.65% 470.lbm6.03% 482.sphinx311.21% 400.perlbench 8.91% 401.bzip2 4.41% 403.gcc8.56% 429.mcf8.24% 445.gobmk 29.47% 456.hmmer 8.19% 458.sjeng 6.05% 462.libquantum 11.23% 464.h264ref5.93% 471.omnetpp31.89% 473.astar 16.20% 483.xalancbmk 44.62% geomean16.83% Reviewers: davidxl, andreadb, rob.lougher, dblaikie, echristo Reviewed By: dblaikie, echristo Subscribers: hfinkel, rob.lougher, andreadb, gbedwell, cfe-commits, probinson, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D25435 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/Driver/clang_f_opts.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=292458&r1=292457&r2=292458&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Wed Jan 18 18:44:21 2017 @@ -516,6 +516,12 @@ def fprofile_sample_use_EQ : Joined<["-" HelpText<"Enable sample-based profile guided optimizations">; def fauto_profile_EQ : Joined<["-"], "fauto-profile=">, Alias; +def fdebug_info_for_profiling : Flag<["-"], "fdebug-info-for-profiling">, Group, +Flags<[CC1Option]>, +HelpText<"Emit extra debug info to make sample profile more accurate.">; +def fno_debug_info_for_profiling : Flag<["-"], "fno-debug-info-for-profiling">, Group, +Flags<[DriverOption]>, +HelpText<"Do not emit extra debug info for sample profiler.">; def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">, Group, Flags<[CoreOption]>, HelpText<"Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">; Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=292458&r1=292457&r2=292458&view=diff == --- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original) +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Wed Jan 18 18:44:21 2017 @@ -258,6 +258,9 @@ CODEGENOPT(PIECopyRelocations, 1, 0) /// paths that reach the end of a function without executing a required return. CODEGENOPT(StrictReturn, 1, 1) +/// Whether emit extra debug info for sample pgo profile collection. +CODEGENOPT(DebugInfoForProfiling, 1, 0) + #undef CODEGENOPT #undef ENUM_CODEGENOPT #undef VALUE_CODEGENOPT Modified:
r293834 - Change debug-info-for-profiling from a TargetOption to a function attribute.
Author: dehao Date: Wed Feb 1 16:45:21 2017 New Revision: 293834 URL: http://llvm.org/viewvc/llvm-project?rev=293834&view=rev Log: Change debug-info-for-profiling from a TargetOption to a function attribute. Summary: cfe change for https://reviews.llvm.org/D29203 Reviewers: echristo, dblaikie Reviewed By: dblaikie Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D29205 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=293834&r1=293833&r2=293834&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Feb 1 16:45:21 2017 @@ -568,7 +568,6 @@ void EmitAssemblyHelper::CreateTargetMac Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS; Options.CompressDebugSections = CodeGenOpts.CompressDebugSections; Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations; - Options.DebugInfoForProfiling = CodeGenOpts.DebugInfoForProfiling; // Set EABI version. Options.EABIVersion = llvm::StringSwitch(TargetOpts.EABIVersion) Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=293834&r1=293833&r2=293834&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Feb 1 16:45:21 2017 @@ -509,7 +509,8 @@ void CGDebugInfo::CreateCompileUnit() { Checksum), Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */, - CGM.getCodeGenOpts().SplitDwarfInlining); + CGM.getCodeGenOpts().SplitDwarfInlining, + CGM.getCodeGenOpts().DebugInfoForProfiling); } llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r306430 - Update test for enabling ICP for AutoFDO.
Author: dehao Date: Tue Jun 27 10:23:42 2017 New Revision: 306430 URL: http://llvm.org/viewvc/llvm-project?rev=306430&view=rev Log: Update test for enabling ICP for AutoFDO. Summary: This is the test update patch for https://reviews.llvm.org/D34662 Reviewers: davidxl Reviewed By: davidxl Subscribers: cfe-commits, sanjoy, mehdi_amini, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D34663 Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=306430&r1=306429&r2=306430&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Tue Jun 27 10:23:42 2017 @@ -32,10 +32,10 @@ void unroll() { baz(i); } -// Check that icp is not invoked (both -O2 and ThinLTO). +// Check that icp is not invoked for ThinLTO, but invoked for -O2. // O2-LABEL: define void @icp // THINLTO-LABEL: define void @icp -// O2-NOT: if.true.direct_targ +// O2: if.true.direct_targ // ThinLTO-NOT: if.true.direct_targ void icp(void (*p)()) { p(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r306434 - Update the test comment to clarify the intention of the test.
Author: dehao Date: Tue Jun 27 10:45:40 2017 New Revision: 306434 URL: http://llvm.org/viewvc/llvm-project?rev=306434&view=rev Log: Update the test comment to clarify the intention of the test. Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=306434&r1=306433&r2=306434&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Tue Jun 27 10:45:40 2017 @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=O2 +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO // Checks if hot call is inlined by normal compile, but not inlined by // thinlto compile. @@ -11,9 +11,9 @@ void foo(int n) { g += baz(i); } -// O2-LABEL: define void @bar +// SAMPLEPGO-LABEL: define void @bar // THINLTO-LABEL: define void @bar -// O2-NOT: call{{.*}}foo +// SAMPLEPGO-NOT: call{{.*}}foo // THINLTO: call{{.*}}foo void bar(int n) { for (int i = 0; i < n; i++) @@ -21,10 +21,10 @@ void bar(int n) { } // Checks if loop unroll is invoked by normal compile, but not thinlto compile. -// O2-LABEL: define void @unroll +// SAMPLEPGO-LABEL: define void @unroll // THINLTO-LABEL: define void @unroll -// O2: call{{.*}}baz -// O2: call{{.*}}baz +// SAMPLEPGO: call{{.*}}baz +// SAMPLEPGO: call{{.*}}baz // THINLTO: call{{.*}}baz // THINLTO-NOT: call{{.*}}baz void unroll() { @@ -32,10 +32,10 @@ void unroll() { baz(i); } -// Check that icp is not invoked for ThinLTO, but invoked for -O2. -// O2-LABEL: define void @icp +// Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo. +// SAMPLEPGO-LABEL: define void @icp // THINLTO-LABEL: define void @icp -// O2: if.true.direct_targ +// SAMPLEPGO: if.true.direct_targ // ThinLTO-NOT: if.true.direct_targ void icp(void (*p)()) { p(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r306764 - [PM] Add support for sample PGO in the new pass manager (clang-side)
Author: dehao Date: Thu Jun 29 16:33:13 2017 New Revision: 306764 URL: http://llvm.org/viewvc/llvm-project?rev=306764&view=rev Log: [PM] Add support for sample PGO in the new pass manager (clang-side) Summary: This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked. Reviewers: chandlerc, davidxl, davide, tejohnson Reviewed By: chandlerc, tejohnson Subscribers: tejohnson, sanjoy, mehdi_amini, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D34721 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=306764&r1=306763&r2=306764&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jun 29 16:33:13 2017 @@ -857,11 +857,15 @@ void EmitAssemblyHelper::EmitAssemblyWit if (CodeGenOpts.hasProfileIRUse()) PGOOpt.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath; + if (!CodeGenOpts.SampleProfileFile.empty()) +PGOOpt.SampleProfileFile = CodeGenOpts.SampleProfileFile; + // Only pass a PGO options struct if -fprofile-generate or // -fprofile-use were passed on the cmdline. PassBuilder PB(TM.get(), (PGOOpt.RunProfileGen || - !PGOOpt.ProfileUseFile.empty()) ? + !PGOOpt.ProfileUseFile.empty() || + !PGOOpt.SampleProfileFile.empty()) ? Optional(PGOOpt) : None); LoopAnalysisManager LAM; Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=306764&r1=306763&r2=306764&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Thu Jun 29 16:33:13 2017 @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO +// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO +// FIXME: Run the following command once LTOPreLinkDefaultPipeline is +//customized. +// %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO // Checks if hot call is inlined by normal compile, but not inlined by // thinlto compile. @@ -36,7 +40,9 @@ void unroll() { // SAMPLEPGO-LABEL: define void @icp // THINLTO-LABEL: define void @icp // SAMPLEPGO: if.true.direct_targ -// ThinLTO-NOT: if.true.direct_targ +// FIXME: the following condition needs to be reversed once +//LTOPreLinkDefaultPipeline is customized. +// THINLTO-NOT: if.true.direct_targ void icp(void (*p)()) { p(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r307438 - Enable the new PM + SamlePGO + ThinLTO testing.
Author: dehao Date: Fri Jul 7 13:53:17 2017 New Revision: 307438 URL: http://llvm.org/viewvc/llvm-project?rev=307438&view=rev Log: Enable the new PM + SamlePGO + ThinLTO testing. Summary: This patch should be enabled after https://reviews.llvm.org/D34895 Reviewers: chandlerc, tejohnson, davidxl Reviewed By: tejohnson Subscribers: sanjoy, mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D34896 Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=307438&r1=307437&r2=307438&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Fri Jul 7 13:53:17 2017 @@ -1,9 +1,7 @@ // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO // RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO -// FIXME: Run the following command once LTOPreLinkDefaultPipeline is -//customized. -// %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO +// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO // Checks if hot call is inlined by normal compile, but not inlined by // thinlto compile. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r307445 - Add sample PGO integration test to cover profile annotation and inlining.
Author: dehao Date: Fri Jul 7 15:01:47 2017 New Revision: 307445 URL: http://llvm.org/viewvc/llvm-project?rev=307445&view=rev Log: Add sample PGO integration test to cover profile annotation and inlining. Summary: The patch makes the integration test cover major sample PGO components. Reviewers: davidxl Reviewed By: davidxl Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D34725 Modified: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof cfe/trunk/test/CodeGen/pgo-sample.c Modified: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof?rev=307445&r1=307444&r2=307445&view=diff == --- cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof (original) +++ cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof Fri Jul 7 15:01:47 2017 @@ -1,2 +1,7 @@ -bar:100:100 - 1: 2000 +bar:1000:1000 + 1: 1000 + 2: 0 +foo:1000:1000 + 1:bar:1000 + 1: 1000 + 2: 1000 Modified: cfe/trunk/test/CodeGen/pgo-sample.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample.c?rev=307445&r1=307444&r2=307445&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample.c Fri Jul 7 15:01:47 2017 @@ -1,6 +1,34 @@ // Test if PGO sample use passes are invoked. // -// Ensure Pass PGOInstrumentationGenPass is invoked. -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -// CHECK: Remove unused exception handling info -// CHECK: Sample profile pass +// Ensure Pass SampleProfileLoader is invoked. +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=STRUCTURE +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -mllvm -inline-threshold=0 -emit-llvm -o - 2>&1 | FileCheck %s +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -mllvm -inline-threshold=0 -emit-llvm -fexperimental-new-pass-manager -o - 2>&1 | FileCheck %s +// STRUCTURE: Remove unused exception handling info +// STRUCTURE: Sample profile pass + +void baz(); + +// CHECK-LABEL: @callee( +void callee(int t) { + for (int i = 0; i < t; i++) +baz(); +} + +// CHECK-LABEL: @bar( +// cold call to callee should not be inlined. +// CHECK: call void @callee +void bar(int x) { + if (x < 100) +callee(x); +} + +// CHECK-LABEL: @foo( +// bar should be early-inlined because it is hot inline instance in profile. +// callee should be inlined because it is hot callsite in the inline instance +// of foo:bar. +// CHECK-NOT: call void @callee +// CHECK-NOT: call void @bar +void foo(int x) { + bar(x); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r307449 - Revert r307445 as it breaks on certain platforms.
Author: dehao Date: Fri Jul 7 15:40:37 2017 New Revision: 307449 URL: http://llvm.org/viewvc/llvm-project?rev=307449&view=rev Log: Revert r307445 as it breaks on certain platforms. Modified: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof cfe/trunk/test/CodeGen/pgo-sample.c Modified: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof?rev=307449&r1=307448&r2=307449&view=diff == --- cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof (original) +++ cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof Fri Jul 7 15:40:37 2017 @@ -1,7 +1,2 @@ -bar:1000:1000 - 1: 1000 - 2: 0 -foo:1000:1000 - 1:bar:1000 - 1: 1000 - 2: 1000 +bar:100:100 + 1: 2000 Modified: cfe/trunk/test/CodeGen/pgo-sample.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample.c?rev=307449&r1=307448&r2=307449&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample.c Fri Jul 7 15:40:37 2017 @@ -1,34 +1,6 @@ // Test if PGO sample use passes are invoked. // -// Ensure Pass SampleProfileLoader is invoked. -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=STRUCTURE -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -mllvm -inline-threshold=0 -emit-llvm -o - 2>&1 | FileCheck %s -// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -mllvm -inline-threshold=0 -emit-llvm -fexperimental-new-pass-manager -o - 2>&1 | FileCheck %s -// STRUCTURE: Remove unused exception handling info -// STRUCTURE: Sample profile pass - -void baz(); - -// CHECK-LABEL: @callee( -void callee(int t) { - for (int i = 0; i < t; i++) -baz(); -} - -// CHECK-LABEL: @bar( -// cold call to callee should not be inlined. -// CHECK: call void @callee -void bar(int x) { - if (x < 100) -callee(x); -} - -// CHECK-LABEL: @foo( -// bar should be early-inlined because it is hot inline instance in profile. -// callee should be inlined because it is hot callsite in the inline instance -// of foo:bar. -// CHECK-NOT: call void @callee -// CHECK-NOT: call void @bar -void foo(int x) { - bar(x); -} +// Ensure Pass PGOInstrumentationGenPass is invoked. +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s +// CHECK: Remove unused exception handling info +// CHECK: Sample profile pass ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r307584 - Use DenseMap instead std::map for GVSummaryMapTy
Author: dehao Date: Mon Jul 10 13:31:37 2017 New Revision: 307584 URL: http://llvm.org/viewvc/llvm-project?rev=307584&view=rev Log: Use DenseMap instead std::map for GVSummaryMapTy Summary: Frontend change for https://reviews.llvm.org/D35148 Reviewers: tejohnson Reviewed By: tejohnson Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D35153 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=307584&r1=307583&r2=307584&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Jul 10 13:31:37 2017 @@ -998,7 +998,7 @@ static void runThinLTOBackend(ModuleSumm std::unique_ptr OS, std::string SampleProfile, BackendAction Action) { - StringMap> + StringMap> ModuleToDefinedGVSummaries; CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D34896: Enable the new PM + SamlePGO + ThinLTO testing.
This test was originally added in https://reviews.llvm.org/D34721 with clang change. It's kind of dup of the previous test (-check-prefix=SAMPLEPGO) in terms of testing the clang bits. But we want to make sure the new PM has the expected behavior. I guess it would be acceptable to remove one of them, but I'd prefer to remove the one with legacy PM. Let me know if you think I should do that. Thanks, Dehao On Mon, Jul 10, 2017 at 9:45 AM, David Blaikie wrote: > Does this test any code in Clang? (given the test is being committed without > any change in Clang, I'm guessing maybe not) - perhaps this test doesn't > belong in Clang's test suite? > > Looks like changes/functionality in LTOPreLinkDefaultPipeline are tested in > test/Other/new-pm-thinlto-defaults.ll at least? > > On Fri, Jun 30, 2017 at 10:05 AM Dehao Chen via Phabricator via cfe-commits > wrote: >> >> danielcdh created this revision. >> Herald added subscribers: eraman, inglorion, mehdi_amini, sanjoy. >> >> This patch should be enabled after https://reviews.llvm.org/D34895 >> >> >> https://reviews.llvm.org/D34896 >> >> Files: >> test/CodeGen/pgo-sample-thinlto-summary.c >> >> >> Index: test/CodeGen/pgo-sample-thinlto-summary.c >> === >> --- test/CodeGen/pgo-sample-thinlto-summary.c >> +++ test/CodeGen/pgo-sample-thinlto-summary.c >> @@ -1,9 +1,7 @@ >> // RUN: %clang_cc1 -O2 >> -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm >> -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO >> // RUN: %clang_cc1 -O2 >> -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm >> -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO >> // RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager >> -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm >> -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO >> -// FIXME: Run the following command once LTOPreLinkDefaultPipeline is >> -//customized. >> -// %clang_cc1 -O2 -fexperimental-new-pass-manager >> -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm >> -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO >> +// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager >> -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm >> -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO >> // Checks if hot call is inlined by normal compile, but not inlined by >> // thinlto compile. >> >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r309282 - Make new PM honor -fdebug-info-for-profiling (clang side)
Author: dehao Date: Thu Jul 27 08:29:53 2017 New Revision: 309282 URL: http://llvm.org/viewvc/llvm-project?rev=309282&view=rev Log: Make new PM honor -fdebug-info-for-profiling (clang side) Summary: The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling. Reviewers: chandlerc, davidxl Reviewed By: chandlerc Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D35746 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=309282&r1=309281&r2=309282&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jul 27 08:29:53 2017 @@ -840,28 +840,27 @@ void EmitAssemblyHelper::EmitAssemblyWit return; TheModule->setDataLayout(TM->createDataLayout()); - PGOOptions PGOOpt; + Optional PGOOpt; - // -fprofile-generate. - PGOOpt.RunProfileGen = CodeGenOpts.hasProfileIRInstr(); - if (PGOOpt.RunProfileGen) -PGOOpt.ProfileGenFile = CodeGenOpts.InstrProfileOutput.empty() ? - DefaultProfileGenName : CodeGenOpts.InstrProfileOutput; + if (CodeGenOpts.hasProfileIRInstr()) +// -fprofile-generate. +PGOOpt = PGOOptions(CodeGenOpts.InstrProfileOutput.empty() +? DefaultProfileGenName +: CodeGenOpts.InstrProfileOutput, +"", "", true, CodeGenOpts.DebugInfoForProfiling); + else if (CodeGenOpts.hasProfileIRUse()) +// -fprofile-use. +PGOOpt = PGOOptions("", CodeGenOpts.ProfileInstrumentUsePath, "", false, +CodeGenOpts.DebugInfoForProfiling); + else if (!CodeGenOpts.SampleProfileFile.empty()) +// -fprofile-sample-use +PGOOpt = PGOOptions("", "", CodeGenOpts.SampleProfileFile, false, +CodeGenOpts.DebugInfoForProfiling); + else if (CodeGenOpts.DebugInfoForProfiling) +// -fdebug-info-for-profiling +PGOOpt = PGOOptions("", "", "", false, true); - // -fprofile-use. - if (CodeGenOpts.hasProfileIRUse()) -PGOOpt.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath; - - if (!CodeGenOpts.SampleProfileFile.empty()) -PGOOpt.SampleProfileFile = CodeGenOpts.SampleProfileFile; - - // Only pass a PGO options struct if -fprofile-generate or - // -fprofile-use were passed on the cmdline. - PassBuilder PB(TM.get(), -(PGOOpt.RunProfileGen || - !PGOOpt.ProfileUseFile.empty() || - !PGOOpt.SampleProfileFile.empty()) ? -Optional(PGOOpt) : None); + PassBuilder PB(TM.get(), PGOOpt); LoopAnalysisManager LAM; FunctionAnalysisManager FAM; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r295764 - Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true
Author: dehao Date: Tue Feb 21 14:36:21 2017 New Revision: 295764 URL: http://llvm.org/viewvc/llvm-project?rev=295764&view=rev Log: Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true Summary: AddDiscriminator pass is only useful for sample pgo. This patch restricts AddDiscriminator to -fdebug-info-for-profiling so that it does not introduce unecessary debug size increases for non-sample-pgo builds. Reviewers: dblaikie, aprantl Reviewed By: dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30220 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=295764&r1=295763&r2=295764&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Feb 21 14:36:21 2017 @@ -339,8 +339,10 @@ void EmitAssemblyHelper::CreatePasses(le if (TM) TM->adjustPassManager(PMBuilder); - PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, - addAddDiscriminatorsPass); + if (CodeGenOpts.DebugInfoForProfiling || + !CodeGenOpts.SampleProfileFile.empty()) +PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, + addAddDiscriminatorsPass); // In ObjC ARC mode, add the main ARC optimization passes. if (LangOpts.ObjCAutoRefCount) { Modified: cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m?rev=295764&r1=295763&r2=295764&view=diff == --- cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m (original) +++ cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Tue Feb 21 14:36:21 2017 @@ -30,11 +30,10 @@ NSRect NSMakeRect(CGFloat x, CGFloat y, // CHECK: define {{.*}}_createBezierPathWithWidth // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]] // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]] - // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC1:[0-9]+]] + // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]] // CHECK: ret {{.*}} !dbg ![[ARC]] // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) return path; - // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+2]], scope: !{{.*}}) - // CHECK: ![[ARC1]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) + // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) } @end ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289670 - Create SampleProfileLoader pass in llvm instead of clang
Author: dehao Date: Wed Dec 14 10:49:34 2016 New Revision: 289670 URL: http://llvm.org/viewvc/llvm-project?rev=289670&view=rev Log: Create SampleProfileLoader pass in llvm instead of clang Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder. Reviewers: tejohnson, davidxl, dnovillo Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D27744 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=289670&r1=289669&r2=289670&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Dec 14 10:49:34 2016 @@ -464,10 +464,8 @@ void EmitAssemblyHelper::CreatePasses(le if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; - if (!CodeGenOpts.SampleProfileFile.empty()) { -MPM.add(createPruneEHPass()); -MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); - } + if (!CodeGenOpts.SampleProfileFile.empty()) +PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile; PMBuilder.populateFunctionPassManager(FPM); PMBuilder.populateModulePassManager(MPM); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r302966 - Remove unused tracking of owning module for MacroInfo objects.
Could you give some context on how r302938 is related to this? Thanks, Dehao On Wed, May 17, 2017 at 11:14 PM, Vitaly Buka wrote: > +Dehao Chen > it started from r302938 > > On Wed, May 17, 2017 at 8:09 PM Jordan Rose via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Thanks, this is helpful! >> >> >> On May 16, 2017, at 12:26, Richard Smith wrote: >> >> On 15 May 2017 at 10:28, Jordan Rose via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Hi, Richard. Swift was using this information in order to put imported >>> macros in a particular context. It wouldn't surprise me to hear that we >>> were doing it wrong, and that there's a better way to go from a macro back >>> to a module, but is there a recommended replacement? >>> >> >> The recommended way to connect macros to modules is via the ModuleMacro >> objects, which represent a macro exported from a module. You can query the >> exported macro for a (module, identifier) pair with >> Preprocessor::getModuleMacro, or walk the ModuleMacro graph for an >> identifier by starting from Preprocessor::getLeafModuleMacros. >> >> If you alternatively want to know the set of macros that would be visible >> with a given set of imports, after setting up that state you can walk the >> range produced by Preprocessor::macros(true) and query >> getActiveModuleMacros on each MacroState. >> >> If you want to know "what is the set of macros exported directly by this >> module?", we don't have a prebuilt mechanism for that, since no in-tree >> client wants that information, but one way would be to walk macros(true) >> and query getModuleMacro(module, identifier) on each one. >> >> Thanks, >>> Jordan >>> >>> >>> > On May 12, 2017, at 16:40, Richard Smith via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> > >>> > Author: rsmith >>> > Date: Fri May 12 18:40:52 2017 >>> > New Revision: 302966 >>> > >>> > URL: http://llvm.org/viewvc/llvm-project?rev=302966&view=rev >>> > Log: >>> > Remove unused tracking of owning module for MacroInfo objects. >>> > >>> > Modified: >>> >cfe/trunk/include/clang/Lex/MacroInfo.h >>> >cfe/trunk/include/clang/Lex/Preprocessor.h >>> >cfe/trunk/lib/Lex/MacroInfo.cpp >>> >cfe/trunk/lib/Lex/PPDirectives.cpp >>> >cfe/trunk/lib/Lex/Preprocessor.cpp >>> >cfe/trunk/lib/Serialization/ASTReader.cpp >>> >cfe/trunk/lib/Serialization/ASTWriter.cpp >>> > >>> > Modified: cfe/trunk/include/clang/Lex/MacroInfo.h >>> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ >>> clang/Lex/MacroInfo.h?rev=302966&r1=302965&r2=302966&view=diff >>> > >>> == >>> > --- cfe/trunk/include/clang/Lex/MacroInfo.h (original) >>> > +++ cfe/trunk/include/clang/Lex/MacroInfo.h Fri May 12 18:40:52 2017 >>> > @@ -105,9 +105,6 @@ class MacroInfo { >>> > /// \brief Must warn if the macro is unused at the end of >>> translation unit. >>> > bool IsWarnIfUnused : 1; >>> > >>> > - /// \brief Whether this macro info was loaded from an AST file. >>> > - bool FromASTFile : 1; >>> > - >>> > /// \brief Whether this macro was used as header guard. >>> > bool UsedForHeaderGuard : 1; >>> > >>> > @@ -264,34 +261,16 @@ public: >>> > IsDisabled = true; >>> > } >>> > >>> > - /// \brief Determine whether this macro info came from an AST file >>> (such as >>> > - /// a precompiled header or module) rather than having been parsed. >>> > - bool isFromASTFile() const { return FromASTFile; } >>> > - >>> > /// \brief Determine whether this macro was used for a header guard. >>> > bool isUsedForHeaderGuard() const { return UsedForHeaderGuard; } >>> > >>> > void setUsedForHeaderGuard(bool Val) { UsedForHeaderGuard = Val; } >>> > >>> > - /// \brief Retrieve the global ID of the module that owns this >>> particular >>> > - /// macro info. >>> > - unsigned getOwningModuleID() const { >>> > -if (isFromASTFile()) >>> > - return *(const unsigned *)(this + 1); >>> > - >>> > -return 0; >>> > - } >>> > - >>> > void dump() const; >>> > >>> > private: >>> > unsigned getDefinitionLengthSlow(const SourceManager &SM) const; >>> > >>> > - void setOwningModuleID(unsigned ID) { >>> > -assert(isFromASTFile()); >>> > -*(unsigned *)(this + 1) = ID; >>> > - } >>> > - >>> > friend class Preprocessor; >>> > }; >>> > >>> > >>> > Modified: cfe/trunk/include/clang/Lex/Preprocessor.h >>> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ >>> clang/Lex/Preprocessor.h?rev=302966&r1=302965&r2=302966&view=diff >>> > >>> == >>> > --- cfe/trunk/include/clang/Lex/Preprocessor.h (original) >>> > +++ cfe/trunk/include/clang/Lex/Preprocessor.h Fri May 12 18:40:52 >>> 2017 >>> > @@ -644,14 +644,6 @@ class Preprocessor { >>> > /// of that list. >>> > MacroInfoChain *MIChainHead; >>> > >>> > - struct DeserializedMacroInfoChain { >>> > -MacroInfo MI; >>> > -
Re: r302966 - Remove unused tracking of owning module for MacroInfo objects.
What's the issue? Build breaking? Performance regression? It's not clear from the limit info in this thread... Dehao On Thu, May 18, 2017 at 1:02 PM, Vitaly Buka wrote: > Local build: r302937 no issue, r302938 has issue. > > On Thu, May 18, 2017 at 7:23 AM Dehao Chen wrote: > >> Could you give some context on how r302938 is related to this? >> >> Thanks, >> Dehao >> >> On Wed, May 17, 2017 at 11:14 PM, Vitaly Buka >> wrote: >> >>> +Dehao Chen >>> it started from r302938 >>> >>> On Wed, May 17, 2017 at 8:09 PM Jordan Rose via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> Thanks, this is helpful! On May 16, 2017, at 12:26, Richard Smith wrote: On 15 May 2017 at 10:28, Jordan Rose via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Hi, Richard. Swift was using this information in order to put imported > macros in a particular context. It wouldn't surprise me to hear that we > were doing it wrong, and that there's a better way to go from a macro back > to a module, but is there a recommended replacement? > The recommended way to connect macros to modules is via the ModuleMacro objects, which represent a macro exported from a module. You can query the exported macro for a (module, identifier) pair with Preprocessor::getModuleMacro, or walk the ModuleMacro graph for an identifier by starting from Preprocessor::getLeafModuleMacros. If you alternatively want to know the set of macros that would be visible with a given set of imports, after setting up that state you can walk the range produced by Preprocessor::macros(true) and query getActiveModuleMacros on each MacroState. If you want to know "what is the set of macros exported directly by this module?", we don't have a prebuilt mechanism for that, since no in-tree client wants that information, but one way would be to walk macros(true) and query getModuleMacro(module, identifier) on each one. Thanks, > Jordan > > > > On May 12, 2017, at 16:40, Richard Smith via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > > Author: rsmith > > Date: Fri May 12 18:40:52 2017 > > New Revision: 302966 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=302966&view=rev > > Log: > > Remove unused tracking of owning module for MacroInfo objects. > > > > Modified: > >cfe/trunk/include/clang/Lex/MacroInfo.h > >cfe/trunk/include/clang/Lex/Preprocessor.h > >cfe/trunk/lib/Lex/MacroInfo.cpp > >cfe/trunk/lib/Lex/PPDirectives.cpp > >cfe/trunk/lib/Lex/Preprocessor.cpp > >cfe/trunk/lib/Serialization/ASTReader.cpp > >cfe/trunk/lib/Serialization/ASTWriter.cpp > > > > Modified: cfe/trunk/include/clang/Lex/MacroInfo.h > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Lex/MacroInfo.h?rev=302966&r1=302965&r2=302966&view=diff > > > == > > --- cfe/trunk/include/clang/Lex/MacroInfo.h (original) > > +++ cfe/trunk/include/clang/Lex/MacroInfo.h Fri May 12 18:40:52 2017 > > @@ -105,9 +105,6 @@ class MacroInfo { > > /// \brief Must warn if the macro is unused at the end of > translation unit. > > bool IsWarnIfUnused : 1; > > > > - /// \brief Whether this macro info was loaded from an AST file. > > - bool FromASTFile : 1; > > - > > /// \brief Whether this macro was used as header guard. > > bool UsedForHeaderGuard : 1; > > > > @@ -264,34 +261,16 @@ public: > > IsDisabled = true; > > } > > > > - /// \brief Determine whether this macro info came from an AST > file (such as > > - /// a precompiled header or module) rather than having been > parsed. > > - bool isFromASTFile() const { return FromASTFile; } > > - > > /// \brief Determine whether this macro was used for a header > guard. > > bool isUsedForHeaderGuard() const { return UsedForHeaderGuard; } > > > > void setUsedForHeaderGuard(bool Val) { UsedForHeaderGuard = Val; } > > > > - /// \brief Retrieve the global ID of the module that owns this > particular > > - /// macro info. > > - unsigned getOwningModuleID() const { > > -if (isFromASTFile()) > > - return *(const unsigned *)(this + 1); > > - > > -return 0; > > - } > > - > > void dump() const; > > > > private: > > unsigned getDefinitionLengthSlow(const SourceManager &SM) const; > > > > - void setOwningModuleID(unsigned ID) { > > -assert(isFromASTFile()); > > -*(unsigned *)(this + 1) = ID; > > - } > > - > > friend class Preprocessor; > > }; > > > > > > Modified: cfe/trunk/include/clang/Lex/Preprocessor.h > > URL: http://l
Re: r302966 - Remove unused tracking of owning module for MacroInfo objects.
My understanding is that r302938 makes clang generate incorrect code (clang itself), which lead to unexpected clang behavior. Is it correct? If yes, how can I reproduce this issue so that I can try to triage/fix the problem? Thanks, Dehao On Thu, May 18, 2017 at 1:22 PM, Richard Smith wrote: > On 18 May 2017 1:19 pm, "Richard Smith" wrote: > > On 18 May 2017 1:14 pm, "Dehao Chen" wrote: > > What's the issue? Build breaking? Performance regression? It's not clear > from the limit info in this thread... > > > r302938 introduced or exposed a miscompile that causes a stage2 msan build > of Clang to misbehave: > > > To be fair, we don't know for sure that it's a miscompile. This code works > with older clang and with other compilers and is clean under the > sanitizers, but it might still be that there's some UB here. > > http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux- > bootstrap/builds/1349/steps/check-clang%20msan/logs/stdio > > From my post to another branch of this thread: > > I grabbed a clang binary from the build bot and have been trying to figure > out what's gone wrong. So far it looks like the msan-enabled stage1 > miscompiled some part of clang's lib/Lex/TokenLexer.cpp (but I'm not sure > of that). It *looks* like TokenLexer::ExpandFunctionArguments is > corrupting the Flags member of the token, somewhere around the "if > (!VaArgsPseudoPaste)" block. I see what looks like a Token::Flags value of > 0x2150, which is garbage: the highest assigned flag is 0x400. > > Dehao > > On Thu, May 18, 2017 at 1:02 PM, Vitaly Buka > wrote: > >> Local build: r302937 no issue, r302938 has issue. >> >> On Thu, May 18, 2017 at 7:23 AM Dehao Chen wrote: >> >>> Could you give some context on how r302938 is related to this? >>> >>> Thanks, >>> Dehao >>> >>> On Wed, May 17, 2017 at 11:14 PM, Vitaly Buka >>> wrote: >>> +Dehao Chen it started from r302938 On Wed, May 17, 2017 at 8:09 PM Jordan Rose via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Thanks, this is helpful! > > > On May 16, 2017, at 12:26, Richard Smith > wrote: > > On 15 May 2017 at 10:28, Jordan Rose via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Hi, Richard. Swift was using this information in order to put >> imported macros in a particular context. It wouldn't surprise me to hear >> that we were doing it wrong, and that there's a better way to go from a >> macro back to a module, but is there a recommended replacement? >> > > The recommended way to connect macros to modules is via the > ModuleMacro objects, which represent a macro exported from a module. You > can query the exported macro for a (module, identifier) pair with > Preprocessor::getModuleMacro, or walk the ModuleMacro graph for an > identifier by starting from Preprocessor::getLeafModuleMacros. > > If you alternatively want to know the set of macros that would be > visible with a given set of imports, after setting up that state you can > walk the range produced by Preprocessor::macros(true) and query > getActiveModuleMacros on each MacroState. > > If you want to know "what is the set of macros exported directly by > this module?", we don't have a prebuilt mechanism for that, since no > in-tree client wants that information, but one way would be to walk > macros(true) and query getModuleMacro(module, identifier) on each one. > > Thanks, >> Jordan >> >> >> > On May 12, 2017, at 16:40, Richard Smith via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> > >> > Author: rsmith >> > Date: Fri May 12 18:40:52 2017 >> > New Revision: 302966 >> > >> > URL: http://llvm.org/viewvc/llvm-project?rev=302966&view=rev >> > Log: >> > Remove unused tracking of owning module for MacroInfo objects. >> > >> > Modified: >> >cfe/trunk/include/clang/Lex/MacroInfo.h >> >cfe/trunk/include/clang/Lex/Preprocessor.h >> >cfe/trunk/lib/Lex/MacroInfo.cpp >> >cfe/trunk/lib/Lex/PPDirectives.cpp >> >cfe/trunk/lib/Lex/Preprocessor.cpp >> >cfe/trunk/lib/Serialization/ASTReader.cpp >> >cfe/trunk/lib/Serialization/ASTWriter.cpp >> > >> > Modified: cfe/trunk/include/clang/Lex/MacroInfo.h >> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ >> Lex/MacroInfo.h?rev=302966&r1=302965&r2=302966&view=diff >> > >> == >> > --- cfe/trunk/include/clang/Lex/MacroInfo.h (original) >> > +++ cfe/trunk/include/clang/Lex/MacroInfo.h Fri May 12 18:40:52 >> 2017 >> > @@ -105,9 +105,6 @@ class MacroInfo { >> > /// \brief Must warn if the macro is unused at the end of >> translation unit. >> > bool IsWarnIfUnused : 1; >> > >> > - /// \brief Whether this macro info was loaded from an AS
r248869 - Fix the sample profile format that breaks in test http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/505
Author: dehao Date: Tue Sep 29 20:03:10 2015 New Revision: 248869 URL: http://llvm.org/viewvc/llvm-project?rev=248869&view=rev Log: Fix the sample profile format that breaks in test http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/505 http://reviews.llvm.org/D13145 Modified: cfe/trunk/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof Modified: cfe/trunk/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof?rev=248869&r1=248868&r2=248869&view=diff == --- cfe/trunk/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof (original) +++ cfe/trunk/test/Frontend/Inputs/profile-sample-use-loc-tracking.prof Tue Sep 29 20:03:10 2015 @@ -1,2 +1,2 @@ bar:100:100 -1: 2000 + 1: 2000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r251691 - Update debug-info-scope test to remove "FIXME", which is fixed in r251689
Author: dehao Date: Fri Oct 30 00:08:43 2015 New Revision: 251691 URL: http://llvm.org/viewvc/llvm-project?rev=251691&view=rev Log: Update debug-info-scope test to remove "FIXME", which is fixed in r251689 Modified: cfe/trunk/test/CodeGen/debug-info-scope.c Modified: cfe/trunk/test/CodeGen/debug-info-scope.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=251691&r1=251690&r2=251691&view=diff == --- cfe/trunk/test/CodeGen/debug-info-scope.c (original) +++ cfe/trunk/test/CodeGen/debug-info-scope.c Fri Oct 30 00:08:43 2015 @@ -8,10 +8,6 @@ int main() { // CHECK: !DILocalVariable(name: "i" // CHECK-NEXT: !DILexicalBlock( -// FIXME: Looks like we don't actually need both these lexical blocks (disc 2 -// just refers to disc 1, nothing actually uses disc 2). -// GMLT-NOT: !DILexicalBlock -// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 2) // GMLT-NOT: !DILexicalBlock // GMLT: !DILexicalBlockFile({{.*}}, discriminator: 1) // Make sure we don't have any more lexical blocks because we don't need them in ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271010 - Add instcombine pass if sampleprofile pass is enabled.
Author: dehao Date: Fri May 27 11:14:35 2016 New Revision: 271010 URL: http://llvm.org/viewvc/llvm-project?rev=271010&view=rev Log: Add instcombine pass if sampleprofile pass is enabled. Summary: Sample profile pass need to have instcombine pass. A related change is http://reviews.llvm.org/D17742. But we should not explicitly add dependency between to non-analysis passes. So we add the dependency here. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20502 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=271010&r1=271009&r2=271010&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri May 27 11:14:35 2016 @@ -178,6 +178,11 @@ static void addAddDiscriminatorsPass(con PM.add(createAddDiscriminatorsPass()); } +static void addInstructionCombiningPass(const PassManagerBuilder &Builder, +legacy::PassManagerBase &PM) { + PM.add(createInstructionCombiningPass()); +} + static void addBoundsCheckingPass(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { PM.add(createBoundsCheckingPass()); @@ -441,7 +446,6 @@ void EmitAssemblyHelper::CreatePasses(Mo legacy::FunctionPassManager *FPM = getPerFunctionPasses(); if (CodeGenOpts.VerifyModule) FPM->add(createVerifierPass()); - PMBuilder.populateFunctionPassManager(*FPM); // Set up the per-module pass manager. if (!CodeGenOpts.RewriteMapFiles.empty()) @@ -480,9 +484,13 @@ void EmitAssemblyHelper::CreatePasses(Mo if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; - if (!CodeGenOpts.SampleProfileFile.empty()) + if (!CodeGenOpts.SampleProfileFile.empty()) { MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); +PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, + addInstructionCombiningPass); + } + PMBuilder.populateFunctionPassManager(*FPM); PMBuilder.populateModulePassManager(*MPM); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r273298 - Invoke PruneEH pass before Sample Profile pass.
Author: dehao Date: Tue Jun 21 14:16:41 2016 New Revision: 273298 URL: http://llvm.org/viewvc/llvm-project?rev=273298&view=rev Log: Invoke PruneEH pass before Sample Profile pass. Summary: We need to call PruneEH pass before AutoFDO pass so that some EH-related calls can get inlined in Sample Profile pass. Reviewers: davidxl, dnovillo Subscribers: junbuml, llvm-commits Differential Revision: http://reviews.llvm.org/D21197 Added: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof cfe/trunk/test/CodeGen/pgo-sample.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=273298&r1=273297&r2=273298&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Jun 21 14:16:41 2016 @@ -488,6 +488,7 @@ void EmitAssemblyHelper::CreatePasses(Mo PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; if (!CodeGenOpts.SampleProfileFile.empty()) { +MPM->add(createPruneEHPass()); MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, addInstructionCombiningPass); Added: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof?rev=273298&view=auto == --- cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof (added) +++ cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof Tue Jun 21 14:16:41 2016 @@ -0,0 +1,2 @@ +bar:100:100 + 1: 2000 Added: cfe/trunk/test/CodeGen/pgo-sample.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample.c?rev=273298&view=auto == --- cfe/trunk/test/CodeGen/pgo-sample.c (added) +++ cfe/trunk/test/CodeGen/pgo-sample.c Tue Jun 21 14:16:41 2016 @@ -0,0 +1,6 @@ +// Test if PGO sample use passes are invoked. +// +// Ensure Pass PGOInstrumentationGenPass is invoked. +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s +// CHECK: Remove unused exception handling info +// CHECK: Sample profile pass ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r273606 - Invoke simplifycfg and sroa before instcombine.
Author: dehao Date: Thu Jun 23 15:13:10 2016 New Revision: 273606 URL: http://llvm.org/viewvc/llvm-project?rev=273606&view=rev Log: Invoke simplifycfg and sroa before instcombine. Summary: InstCombine needs to be performed after simplifycfg and sroa, otherwise it may make bad optimization decisions. Reviewers: davidxl, wmi, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21568 Added: cfe/trunk/test/CodeGen/pgo-sample-preparation.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CodeGen/pgo-sample.c Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=273606&r1=273605&r2=273606&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jun 23 15:13:10 2016 @@ -178,8 +178,14 @@ static void addAddDiscriminatorsPass(con PM.add(createAddDiscriminatorsPass()); } -static void addInstructionCombiningPass(const PassManagerBuilder &Builder, -legacy::PassManagerBase &PM) { +static void addCleanupPassesForSampleProfiler( +const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { + // instcombine is needed before sample profile annotation because it converts + // certain function calls to be inlinable. simplifycfg and sroa are needed + // before instcombine for necessary preparation. E.g. load store is eliminated + // properly so that instcombine will not introduce unecessary liverange. + PM.add(createCFGSimplificationPass()); + PM.add(createSROAPass()); PM.add(createInstructionCombiningPass()); } @@ -492,7 +498,7 @@ void EmitAssemblyHelper::CreatePasses(Mo MPM->add(createPruneEHPass()); MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, - addInstructionCombiningPass); + addCleanupPassesForSampleProfiler); } PMBuilder.populateFunctionPassManager(*FPM); Added: cfe/trunk/test/CodeGen/pgo-sample-preparation.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-preparation.c?rev=273606&view=auto == --- cfe/trunk/test/CodeGen/pgo-sample-preparation.c (added) +++ cfe/trunk/test/CodeGen/pgo-sample-preparation.c Thu Jun 23 15:13:10 2016 @@ -0,0 +1,16 @@ +// Test if PGO sample use preparation passes are executed correctly. +// +// Ensure that instcombine is executed after simplifycfg and sroa so that +// "a < 255" will not be converted to a * 256 < 255 * 256. +// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -emit-llvm -o - 2>&1 | FileCheck %s + +void bar(int); +void foo(int x, int y, int z) { + int m; + for (m = 0; m < x ; m++) { +int a = (((y >> 8) & 0xff) * z) / 256; +bar(a < 255 ? a : 255); + } +} + +// CHECK-NOT: icmp slt i32 %mul, 65280 Modified: cfe/trunk/test/CodeGen/pgo-sample.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample.c?rev=273606&r1=273605&r2=273606&view=diff == --- cfe/trunk/test/CodeGen/pgo-sample.c (original) +++ cfe/trunk/test/CodeGen/pgo-sample.c Thu Jun 23 15:13:10 2016 @@ -2,5 +2,8 @@ // // Ensure Pass PGOInstrumentationGenPass is invoked. // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s +// CHECK: Simplify the CFG +// CHECK: SROA +// CHECK: Combine redundant instructions // CHECK: Remove unused exception handling info // CHECK: Sample profile pass ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r253595 - Update clang tests to accomendate discriminator changes.
Author: dehao Date: Thu Nov 19 13:53:16 2015 New Revision: 253595 URL: http://llvm.org/viewvc/llvm-project?rev=253595&view=rev Log: Update clang tests to accomendate discriminator changes. Summary: The discriminator change in http://reviews.llvm.org/D14738 will fail these clang tests. Update the test to accomendate the discriminator change. Reviewers: dblaikie, davidxl, dnovillo Differential Revision: http://reviews.llvm.org/D14836 Modified: cfe/trunk/test/CodeGen/debug-info-scope.c cfe/trunk/test/CodeGenObjC/arc-linetable.m Modified: cfe/trunk/test/CodeGen/debug-info-scope.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=253595&r1=253594&r2=253595&view=diff == --- cfe/trunk/test/CodeGen/debug-info-scope.c (original) +++ cfe/trunk/test/CodeGen/debug-info-scope.c Thu Nov 19 13:53:16 2015 @@ -10,6 +10,7 @@ int main() { // GMLT-NOT: !DILexicalBlock // GMLT: !DILexicalBlockFile({{.*}}, discriminator: 1) +// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 2) // Make sure we don't have any more lexical blocks because we don't need them in // -gmlt. // GMLT-NOT: !DILexicalBlock Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=253595&r1=253594&r2=253595&view=diff == --- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original) +++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Thu Nov 19 13:53:16 2015 @@ -34,9 +34,9 @@ // CHECK: define {{.*}}testCleanupVoid // CHECK: icmp ne {{.*}}!dbg ![[SKIP1:[0-9]+]] -// CHECK: store i32 0, i32* {{.*}}, !dbg ![[RET8:[0-9]+]] +// CHECK: store i32 0, i32* {{.*}}, !dbg ![[STORE8:[0-9]+]] // CHECK: @objc_storeStrong{{.*}}, !dbg ![[ARC8:[0-9]+]] -// CHECK: ret {{.*}} !dbg ![[RET8]] +// CHECK: ret {{.*}} !dbg ![[RET8:[0-9]+]] typedef signed char BOOL; @@ -112,8 +112,9 @@ typedef signed char BOOL; [delegate testVoid :s]; } } - // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+2]], scope: - // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+1]], scope: + // CHECK: ![[STORE8]] = !DILocation(line: [[@LINE+3]], scope: + // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+2]], scope: + // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+1]], scope: } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r253595 - Update clang tests to accomendate discriminator changes.
Yes, as discriminator is a backend pass, it should *not* affect frontend tests. On Thu, Nov 19, 2015 at 12:36 PM, David Blaikie wrote: > > > On Thu, Nov 19, 2015 at 11:53 AM, Dehao Chen via cfe-commits > wrote: >> >> Author: dehao >> Date: Thu Nov 19 13:53:16 2015 >> New Revision: 253595 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=253595&view=rev >> Log: >> Update clang tests to accomendate discriminator changes. >> >> Summary: The discriminator change in http://reviews.llvm.org/D14738 will >> fail these clang tests. Update the test to accomendate the discriminator >> change. > > > Do these tests need to be testing discriminators in the frontend? Could we > just -mllvm -disable-llvm-optzns on these tests? (can the functionality be > wholely tested in LLVM, I assume so if it's phrased as an LLVM > transformation pass?) > >> >> >> Reviewers: dblaikie, davidxl, dnovillo >> >> Differential Revision: http://reviews.llvm.org/D14836 >> >> Modified: >> cfe/trunk/test/CodeGen/debug-info-scope.c >> cfe/trunk/test/CodeGenObjC/arc-linetable.m >> >> Modified: cfe/trunk/test/CodeGen/debug-info-scope.c >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=253595&r1=253594&r2=253595&view=diff >> >> == >> --- cfe/trunk/test/CodeGen/debug-info-scope.c (original) >> +++ cfe/trunk/test/CodeGen/debug-info-scope.c Thu Nov 19 13:53:16 2015 >> @@ -10,6 +10,7 @@ int main() { >> >> // GMLT-NOT: !DILexicalBlock >> // GMLT: !DILexicalBlockFile({{.*}}, discriminator: 1) >> +// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 2) >> // Make sure we don't have any more lexical blocks because we don't need >> them in >> // -gmlt. >> // GMLT-NOT: !DILexicalBlock >> >> Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=253595&r1=253594&r2=253595&view=diff >> >> == >> --- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original) >> +++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Thu Nov 19 13:53:16 2015 >> @@ -34,9 +34,9 @@ >> >> // CHECK: define {{.*}}testCleanupVoid >> // CHECK: icmp ne {{.*}}!dbg ![[SKIP1:[0-9]+]] >> -// CHECK: store i32 0, i32* {{.*}}, !dbg ![[RET8:[0-9]+]] >> +// CHECK: store i32 0, i32* {{.*}}, !dbg ![[STORE8:[0-9]+]] >> // CHECK: @objc_storeStrong{{.*}}, !dbg ![[ARC8:[0-9]+]] >> -// CHECK: ret {{.*}} !dbg ![[RET8]] >> +// CHECK: ret {{.*}} !dbg ![[RET8:[0-9]+]] >> >> typedef signed char BOOL; >> >> @@ -112,8 +112,9 @@ typedef signed char BOOL; >>[delegate testVoid :s]; >> } >>} >> - // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+2]], scope: >> - // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+1]], scope: >> + // CHECK: ![[STORE8]] = !DILocation(line: [[@LINE+3]], scope: >> + // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+2]], scope: >> + // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+1]], scope: >> } >> >> >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14848: Add -disable-llvm-passes for frontend debug info tests.
danielcdh marked an inline comment as done. danielcdh added a comment. http://reviews.llvm.org/D14848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r253686 - Add -disable-llvm-passes for frontend debug info tests.
Author: dehao Date: Fri Nov 20 12:29:01 2015 New Revision: 253686 URL: http://llvm.org/viewvc/llvm-project?rev=253686&view=rev Log: Add -disable-llvm-passes for frontend debug info tests. Summary: The frontend debuginfo tests should not invoke llvm passes which includes add-discriminators that will change the debug info generated by FE. Reviewers: dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14848 Modified: cfe/trunk/test/CodeGen/debug-info-scope.c cfe/trunk/test/CodeGenObjC/arc-linetable.m Modified: cfe/trunk/test/CodeGen/debug-info-scope.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=253686&r1=253685&r2=253686&view=diff == --- cfe/trunk/test/CodeGen/debug-info-scope.c (original) +++ cfe/trunk/test/CodeGen/debug-info-scope.c Fri Nov 20 12:29:01 2015 @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=limited -emit-llvm < %s | FileCheck %s -// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-tables-only -emit-llvm < %s | FileCheck --check-prefix=GMLT %s +// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=limited -disable-llvm-passes -emit-llvm < %s | FileCheck %s +// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-tables-only -disable-llvm-passes -emit-llvm < %s | FileCheck --check-prefix=GMLT %s // Two variables with same name in separate scope. // Radar 8330217. int main() { @@ -8,9 +8,6 @@ int main() { // CHECK: !DILocalVariable(name: "i" // CHECK-NEXT: !DILexicalBlock( -// GMLT-NOT: !DILexicalBlock -// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 1) -// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 2) // Make sure we don't have any more lexical blocks because we don't need them in // -gmlt. // GMLT-NOT: !DILexicalBlock Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=253686&r1=253685&r2=253686&view=diff == --- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original) +++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Fri Nov 20 12:29:01 2015 @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -fblocks -fobjc-arc -debug-info-kind=standalone -dwarf-version=4 -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -fblocks -fobjc-arc -debug-info-kind=standalone -dwarf-version=4 -disable-llvm-passes -triple x86_64-apple-darwin10 %s -o - | FileCheck %s // Legend: EXP = Return expression, RET = ret instruction @@ -34,9 +34,9 @@ // CHECK: define {{.*}}testCleanupVoid // CHECK: icmp ne {{.*}}!dbg ![[SKIP1:[0-9]+]] -// CHECK: store i32 0, i32* {{.*}}, !dbg ![[STORE8:[0-9]+]] -// CHECK: @objc_storeStrong{{.*}}, !dbg ![[ARC8:[0-9]+]] -// CHECK: ret {{.*}} !dbg ![[RET8:[0-9]+]] +// CHECK: store i32 0, i32* {{.*}}, !dbg ![[RET8:[0-9]+]] +// CHECK: @objc_storeStrong{{.*}}, !dbg ![[RET8]] +// CHECK: ret {{.*}} !dbg ![[RET8]] typedef signed char BOOL; @@ -112,8 +112,6 @@ typedef signed char BOOL; [delegate testVoid :s]; } } - // CHECK: ![[STORE8]] = !DILocation(line: [[@LINE+3]], scope: - // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+2]], scope: // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+1]], scope: } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits