[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

2017-08-23 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added a subscriber: sanjoy. With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20% https://reviews.llvm.org/D37091 Files: include/clang/Driver/Options.td lib

[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

2017-08-23 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 112496. danielcdh added a comment. add document and test https://reviews.llvm.org/D37091 Files: docs/ClangCommandLineReference.rst include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/clang_f_opts.c Index: test/Driver/clan

[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

2017-08-24 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 112574. danielcdh marked 2 inline comments as done. danielcdh added a comment. updated the patch to put it into function attribute so that it works with ThinLTO https://reviews.llvm.org/D37091 Files: docs/ClangCommandLineReference.rst include/clang/D

[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

2017-08-24 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 112597. danielcdh marked 3 inline comments as done. danielcdh added a comment. update https://reviews.llvm.org/D37091 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/CodeGenFunction.cpp lib/Driver/ToolC

[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

2017-08-24 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 112601. danielcdh added a comment. Herald added subscribers: eraman, mehdi_amini. Add an end-to-end test. https://reviews.llvm.org/D37091 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/CodeGenFunction.cp

[PATCH] D37091: Expose -mllvm -accurate-sample-profile to clang.

2017-08-24 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 112604. danielcdh marked an inline comment as done. danielcdh added a comment. update https://reviews.llvm.org/D37091 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/CodeGenFunction.cpp lib/Driver/ToolC

[PATCH] D39923: [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

2017-11-10 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh accepted this revision. danielcdh added a comment. This revision is now accepted and ready to land. Thanks for the fix. https://reviews.llvm.org/D39923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/m

[PATCH] D27744: Create SampleProfileLoader pass in llvm instead of clang

2016-12-14 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh reopened this revision. danielcdh added a comment. This revision is now accepted and ready to land. was reverted due to bot breaking https://reviews.llvm.org/D27744 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-15 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 81609. danielcdh added a comment. update option name https://reviews.llvm.org/D25435 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/BackendUtil.cpp lib/CodeGen/CGDebugInfo.cpp lib/Driver/Tools.cpp

[PATCH] D27832: Add -plugin-opt=sample-profile for thinLTO build.

2016-12-15 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. danielcdh added reviewers: tejohnson, mehdi_amini, davidxl. danielcdh added a subscriber: cfe-commits. ThinLTO needs to pass down the sample profile file path to linker. https://reviews.llvm.org/D27832 Files: lib/Driver/Tools.cpp Index: lib/Driver/Tools.cpp

[PATCH] D27832: Add -plugin-opt=sample-profile for thinLTO build.

2016-12-16 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 81759. danielcdh added a comment. add a test. https://reviews.llvm.org/D27832 Files: lib/Driver/Tools.cpp test/Driver/gold-lto-samplepgo.c Index: test/Driver/gold-lto-samplepgo.c === --

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2017-01-03 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. ping... Thanks, Dehao https://reviews.llvm.org/D25435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D27832: Add -plugin-opt=sample-profile for thinLTO build.

2017-01-03 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 82975. danielcdh added a comment. fix function name https://reviews.llvm.org/D27832 Files: lib/Driver/Tools.cpp test/Driver/gold-lto-samplepgo.c Index: test/Driver/gold-lto-samplepgo.c

[PATCH] D25435: Add -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection

2017-01-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. Thanks David for the reivew. Could you also help take a look at https://reviews.llvm.org/D25434, as it depends on the TargetOptions.h change in that patch. Thanks, Dehao https://reviews.llvm.org/D25435 ___ cfe-commits m

[PATCH] D28588: Pass -fprofile-sample-use to lto backends.

2017-01-11 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. danielcdh added reviewers: tejohnson, mehdi_amini. danielcdh added a subscriber: cfe-commits. 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 SamplePr

[PATCH] D31202: Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.

2017-03-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added subscribers: Prazek, mehdi_amini. 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 inli

[PATCH] D31213: Add support for -fno-auto-profile and -fno-profile-sample-use

2017-03-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. We need to be able to disable samplepgo for specific files by supporting -fno-auto-profile and -fno-profile-sample-use https://reviews.llvm.org/D31213 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp lib/Driver/ToolChains/CommonArgs.

[PATCH] D31213: Add support for -fno-auto-profile and -fno-profile-sample-use

2017-03-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 92554. danielcdh added a comment. add more test https://reviews.llvm.org/D31213 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp lib/Driver/ToolChains/CommonArgs.cpp lib/Driver/ToolChains/CommonArgs.h test/Driver/clang_f_op

[PATCH] D31219: Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase.

2017-03-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added a subscriber: Prazek. This is the test added for https://reviews.llvm.org/D31217 https://reviews.llvm.org/D31219 Files: test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof test/CodeGen/pgo-sample-thinlto-summary.c Index: test/CodeGen/pgo-sampl

[PATCH] D28588: Pass -fprofile-sample-use to lto backends.

2017-01-12 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh reopened this revision. danielcdh added a comment. This revision is now accepted and ready to land. The breaks some buildbots thus I reverted the patch: http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/1889 http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incr

[PATCH] D28588: Pass -fprofile-sample-use to lto backends.

2017-01-12 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. 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=Re

[PATCH] D28588: Pass -fprofile-sample-use to lto backends.

2017-01-12 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 84193. danielcdh added a comment. Updates the unittests to clang_cc1 to see if it fixes the buildbot failure. https://reviews.llvm.org/D28588 Files: lib/CodeGen/BackendUtil.cpp test/CodeGen/thinlto_backend.ll Index: test/CodeGen/thinlto_backend.ll =

[PATCH] D28588: Pass -fprofile-sample-use to lto backends.

2017-01-12 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. Looks like this is still breaking these buildbots: http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3216/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Athinlto_backend.ll I reverted the test change for now, and am thinking of how to reproduce/fix the pr

[PATCH] D29205: Change debug-info-for-profiling from a TargetOption to a function attribute.

2017-01-26 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added a subscriber: mehdi_amini. cfe change for https://reviews.llvm.org/D29203 https://reviews.llvm.org/D29205 Files: lib/CodeGen/BackendUtil.cpp lib/CodeGen/CodeGenFunction.cpp Index: lib/CodeGen/CodeGenFunction.cpp ===

[PATCH] D29205: Change debug-info-for-profiling from a TargetOption to a function attribute.

2017-01-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 86058. danielcdh added a comment. change to use module flag. https://reviews.llvm.org/D29205 Files: lib/CodeGen/BackendUtil.cpp lib/CodeGen/CodeGenModule.cpp Index: lib/CodeGen/CodeGenModule.cpp ==

[PATCH] D29205: Change debug-info-for-profiling from a TargetOption to a function attribute.

2017-01-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments. Comment at: lib/CodeGen/CodeGenModule.cpp:452 + if (CodeGenOpts.DebugInfoForProfiling) +getModule().addModuleFlag(llvm::Module::Warning, "DebugInfoForProfiling", 1); mehdi_amini wrote: > Why should we warn on mismatch? In

[PATCH] D29205: Change debug-info-for-profiling from a TargetOption to a function attribute.

2017-01-30 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 86292. danielcdh added a comment. update https://reviews.llvm.org/D29205 Files: lib/CodeGen/BackendUtil.cpp lib/CodeGen/CGDebugInfo.cpp Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/Co

[PATCH] D34663: Update test for enabling ICP for AutoFDO.

2017-06-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 104199. danielcdh added a comment. update comments https://reviews.llvm.org/D34663 Files: test/CodeGen/pgo-sample-thinlto-summary.c Index: test/CodeGen/pgo-sample-thinlto-summary.c === --

[PATCH] D34663: Update test for enabling ICP for AutoFDO.

2017-06-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments. Comment at: test/CodeGen/pgo-sample-thinlto-summary.c:39 +// O2: if.true.direct_targ // ThinLTO-NOT: if.true.direct_targ void icp(void (*p)()) { davidxl wrote: > Is the thinLTO behavior here expected? Yes, it's expected, icp is

[PATCH] D34721: [PM] Add support for sample PGO in the new pass manager (clang-side)

2017-06-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added subscribers: eraman, mehdi_amini, sanjoy. This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked. https://reviews.llvm.org/D34721 Files: lib/CodeGen/BackendUtil.cpp test/CodeGen/pgo-

[PATCH] D34721: [PM] Add support for sample PGO in the new pass manager (clang-side)

2017-06-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments. Comment at: test/CodeGen/pgo-sample-thinlto-summary.c:4 +// 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 +// RUN

[PATCH] D34725: Add sample PGO integration test to cover profile annotation and inlining.

2017-06-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added a subscriber: sanjoy. The patch makes the integration test cover major sample PGO components. https://reviews.llvm.org/D34725 Files: test/CodeGen/Inputs/pgo-sample.prof test/CodeGen/pgo-sample.c Index: test/CodeGen/pgo-sample.c ===

[PATCH] D34896: Enable the new PM + SamlePGO + ThinLTO testing.

2017-06-30 Thread Dehao Chen via Phabricator via cfe-commits
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-summa

[PATCH] D34725: Add sample PGO integration test to cover profile annotation and inlining.

2017-07-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments. Comment at: test/CodeGen/pgo-sample.c:28 +// of foo:bar. +// CHECK-NOT: call void @callee +void foo(int x) { davidxl wrote: > SHould this be 'CHECK-NOT: call' as bar is also inlined? There is still call to baz. Explicitly added

[PATCH] D34725: Add sample PGO integration test to cover profile annotation and inlining.

2017-07-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 105705. danielcdh marked an inline comment as done. danielcdh added a comment. Integrate David's comment and add new PM test. https://reviews.llvm.org/D34725 Files: test/CodeGen/Inputs/pgo-sample.prof test/CodeGen/pgo-sample.c Index: test/CodeGen/pg

[PATCH] D35153: Use DenseMap instead std::map for GVSummaryMapTy

2017-07-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added a subscriber: sanjoy. Frontend change for https://reviews.llvm.org/D35148 https://reviews.llvm.org/D35153 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp === -

[PATCH] D34725: Add sample PGO integration test to cover profile annotation and inlining.

2017-07-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh reopened this revision. danielcdh added a comment. This revision is now accepted and ready to land. the patch was reverted as it breaks on certain platforms (e.g. http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/10088/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Apgo-sampl

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. Herald added a subscriber: sanjoy. The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling. https://reviews.llvm.org/D35746 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp ===

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-25 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 108174. danielcdh added a comment. update https://reviews.llvm.org/D35746 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-26 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 108316. danielcdh marked an inline comment as done. danielcdh added a comment. update https://reviews.llvm.org/D35746 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp ===

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-26 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh marked 2 inline comments as done. danielcdh added inline comments. Comment at: lib/CodeGen/BackendUtil.cpp:847-859 if (PGOOpt.RunProfileGen) PGOOpt.ProfileGenFile = CodeGenOpts.InstrProfileOutput.empty() ? DefaultProfileGenName : CodeGenOpts.InstrProfileO

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh marked an inline comment as done. danielcdh added a comment. Thanks for the review! In https://reviews.llvm.org/D35746#822498, @chandlerc wrote: > LGTM with a tiny tweak below. > > Would be good to add a test that this flag is being honored, either in this > patch or in a follow-up.

[PATCH] D30220: Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true

2017-02-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. 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. https://reviews.llvm.org/D30220 Files: lib/CodeG

[PATCH] D30220: Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true

2017-02-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 89258. danielcdh added a comment. update https://reviews.llvm.org/D30220 Files: lib/CodeGen/BackendUtil.cpp test/CodeGenObjC/arc-linetable-autorelease.m Index: test/CodeGenObjC/arc-linetable-autorelease.m

[PATCH] D30220: Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true

2017-02-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. You are right, only discriminator is needed, the encoding and emission part should be orthogonal. Patch updated. https://reviews.llvm.org/D30220 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.or

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-11-29 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 79629. danielcdh marked an inline comment as done. danielcdh added a comment. Change the flag to -fprof-debug, which is more concise. The flag name is still open for discussion. https://reviews.llvm.org/D25435 Files: include/clang/Driver/Options.td i

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-11-30 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 79770. danielcdh added a comment. change the flag name to -fprofile-debug https://reviews.llvm.org/D25435 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/BackendUtil.cpp lib/CodeGen/CGDebugInfo.cpp li

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-05 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. ping https://reviews.llvm.org/D25435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-05 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments. Comment at: lib/CodeGen/CGDebugInfo.cpp:2743-2745 if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs && !CGM.getCodeGenOpts().EmitGcovNotes && + !CGM.getCodeGenOpts().Profi

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments. Comment at: lib/CodeGen/CGDebugInfo.cpp:2743-2745 if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs && !CGM.getCodeGenOpts().EmitGcovNotes && + !CGM.getCodeGenOpts().Profi

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-11 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment. In https://reviews.llvm.org/D25435#619169, @hfinkel wrote: > In https://reviews.llvm.org/D25435#609320, @danielcdh wrote: > > > change the flag name to -fprofile-debug > > > I don't really like this name because it sounds like it might be enabling > some kind of debugg

[PATCH] D27744: Create SampleProfileLoader pass in llvm instead of clang

2016-12-13 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision. danielcdh added reviewers: dnovillo, tejohnson, davidxl. danielcdh added a subscriber: cfe-commits. Herald added a subscriber: mehdi_amini. We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. Th