r352849 - Provide reason messages for unviable inlining
Author: yrouban Date: Fri Feb 1 02:44:43 2019 New Revision: 352849 URL: http://llvm.org/viewvc/llvm-project?rev=352849&view=rev Log: Provide reason messages for unviable inlining InlineCost's isInlineViable() is changed to return InlineResult instead of bool. This provides messages for failure reasons and allows to get more specific messages for cases where callsites are not viable for inlining. Reviewed By: xbolva00, anemet Differential Revision: https://reviews.llvm.org/D57089 Modified: cfe/trunk/test/Frontend/optimization-remark-with-hotness.c Modified: cfe/trunk/test/Frontend/optimization-remark-with-hotness.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-with-hotness.c?rev=352849&r1=352848&r2=352849&view=diff == --- cfe/trunk/test/Frontend/optimization-remark-with-hotness.c (original) +++ cfe/trunk/test/Frontend/optimization-remark-with-hotness.c Fri Feb 1 02:44:43 2019 @@ -66,7 +66,7 @@ void bar(int x) { int main(int argc, const char *argv[]) { for (int i = 0; i < 30; i++) -// expected-remark@+1 {{bar not inlined into main because it should never be inlined (cost=never): always inliner (hotness:}} +// expected-remark@+1 {{bar not inlined into main because it should never be inlined (cost=never): no alwaysinline attribute (hotness:}} bar(argc); return sum; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 81f8df0 - [clangd] Make dexp command line options sticky
Author: Yevgeny Rouban Date: 2022-03-09T12:59:49+07:00 New Revision: 81f8df0c83c6a4476f5bffa6947c0e78a94138a7 URL: https://github.com/llvm/llvm-project/commit/81f8df0c83c6a4476f5bffa6947c0e78a94138a7 DIFF: https://github.com/llvm/llvm-project/commit/81f8df0c83c6a4476f5bffa6947c0e78a94138a7.diff LOG: [clangd] Make dexp command line options sticky Preparing for the cl::opt reset fix proposed on D115433 this patch fixes the dexp tool to preserve its three command line options (IndexLocation, ExecCommand, ProjectRoot) from reset that is done before parsing query options. Tags: #clang Added: Modified: clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp Removed: diff --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp index 2615d06bbd2b5..c6cefdf675ef5 100644 --- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp +++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp @@ -413,6 +413,13 @@ int main(int argc, const char *argv[]) { using namespace clang::clangd; llvm::cl::ParseCommandLineOptions(argc, argv, Overview); + + // Preserve global options when flag parser is reset, so commands can use + // them. + IndexLocation.setValue(IndexLocation, /*initial=*/ true); + ExecCommand.setValue(ExecCommand, /*initial=*/ true); + ProjectRoot.setValue(ProjectRoot, /*initial=*/ true); + llvm::cl::ResetCommandLineParser(); // We reuse it for REPL commands. llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] c8a3572 - [clangd] Make dexp command line options sticky
Author: Yevgeny Rouban Date: 2022-03-09T13:00:25+07:00 New Revision: c8a35727fe7cdb06bf2a081356c36a5159598e9f URL: https://github.com/llvm/llvm-project/commit/c8a35727fe7cdb06bf2a081356c36a5159598e9f DIFF: https://github.com/llvm/llvm-project/commit/c8a35727fe7cdb06bf2a081356c36a5159598e9f.diff LOG: [clangd] Make dexp command line options sticky Preparing for the cl::opt reset fix proposed on D115433 this patch fixes the dexp tool to preserve its three command line options (IndexLocation, ExecCommand, ProjectRoot) from reset that is done before parsing query options. Tags: #clang Added: Modified: clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp Removed: diff --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp index c6cefdf675ef5..7bbcba3398335 100644 --- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp +++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp @@ -416,9 +416,9 @@ int main(int argc, const char *argv[]) { // Preserve global options when flag parser is reset, so commands can use // them. - IndexLocation.setValue(IndexLocation, /*initial=*/ true); - ExecCommand.setValue(ExecCommand, /*initial=*/ true); - ProjectRoot.setValue(ProjectRoot, /*initial=*/ true); + IndexLocation.setValue(IndexLocation, /*initial=*/true); + ExecCommand.setValue(ExecCommand, /*initial=*/true); + ProjectRoot.setValue(ProjectRoot, /*initial=*/true); llvm::cl::ResetCommandLineParser(); // We reuse it for REPL commands. llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 39e3e3a - [NewPM] Redesign of PreserveCFG Checker
Author: Yevgeny Rouban Date: 2021-04-06T12:35:49+07:00 New Revision: 39e3e3aa51d628722637c1bfa507f9ec2c532120 URL: https://github.com/llvm/llvm-project/commit/39e3e3aa51d628722637c1bfa507f9ec2c532120 DIFF: https://github.com/llvm/llvm-project/commit/39e3e3aa51d628722637c1bfa507f9ec2c532120.diff LOG: [NewPM] Redesign of PreserveCFG Checker The reason for the NewPM redesign is described in the commit cba3e783389a: [NewPM] Disable PreservedCFGChecker ... The checker introduces an internal custom CFG analysis that tracks current up-to date CFG snapshot. The analysis is invalidated along any other CFG related analysis (the key is CFGAnalyses). If the CFG analysis is not invalidated at a functional pass exit then the checker asserts that the CFG snapshot taken from this analysis is equals to a snapshot of the current CFG. Along the way: - the function CFG::printDiff() is simplified by removing function name calculation. The name is printed by the caller; - fixed CFG invalidated condition (see CFG::invalidate()); - StandardInstrumentations::registerCallbacks() gets additional optional parameter of type FunctionAnalysisManager*, which is needed by the checker to get the custom CFG analysis; - several PM related tests updated to explicitly set -verify-cfg-preserved=1 as they need. This patch is safe to land as the CFGChecker is left switched off (the options -verify-cfg-preserved is false by default). It will be switched on by a separate patch to minimize possible reverts. Reviewed By: skatkov, kuhar Differential Revision: https://reviews.llvm.org/D91327 Added: Modified: clang/lib/CodeGen/BackendUtil.cpp llvm/include/llvm/Passes/StandardInstrumentations.h llvm/lib/LTO/LTOBackend.cpp llvm/lib/Passes/StandardInstrumentations.cpp llvm/test/Other/new-pass-manager.ll llvm/test/Other/new-pm-defaults.ll llvm/tools/opt/NewPMDriver.cpp llvm/unittests/IR/PassManagerTest.cpp Removed: diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 00d92e7beadd4..7edca6fb30730 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -1268,9 +1268,14 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; PTO.Coroutines = LangOpts.Coroutines; + LoopAnalysisManager LAM(CodeGenOpts.DebugPassManager); + FunctionAnalysisManager FAM(CodeGenOpts.DebugPassManager); + CGSCCAnalysisManager CGAM(CodeGenOpts.DebugPassManager); + ModuleAnalysisManager MAM(CodeGenOpts.DebugPassManager); + PassInstrumentationCallbacks PIC; StandardInstrumentations SI(CodeGenOpts.DebugPassManager); - SI.registerCallbacks(PIC); + SI.registerCallbacks(PIC, &FAM); PassBuilder PB(CodeGenOpts.DebugPassManager, TM.get(), PTO, PGOOpt, &PIC); // Attempt to load pass plugins and register their callbacks with PB. @@ -1287,11 +1292,6 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB); #include "llvm/Support/Extension.def" - LoopAnalysisManager LAM(CodeGenOpts.DebugPassManager); - FunctionAnalysisManager FAM(CodeGenOpts.DebugPassManager); - CGSCCAnalysisManager CGAM(CodeGenOpts.DebugPassManager); - ModuleAnalysisManager MAM(CodeGenOpts.DebugPassManager); - // Register the AA manager first so that our version is the one used. FAM.registerPass([&] { return PB.buildDefaultAAPipeline(); }); diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index d24f3fbbf2e54..6953d0cd1b0a1 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -91,7 +91,16 @@ class PrintPassInstrumentation { }; class PreservedCFGCheckerInstrumentation { -private: +public: + // Keeps sticky poisoned flag for the given basic block once it has been + // deleted or RAUWed. + struct BBGuard final : public CallbackVH { +BBGuard(const BasicBlock *BB) : CallbackVH(BB) {} +void deleted() override { CallbackVH::deleted(); } +void allUsesReplacedWith(Value *) override { CallbackVH::deleted(); } +bool isPoisoned() const { return !getValPtr(); } + }; + // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic // block, {(Succ, Multiplicity)} set of all pairs of the block's successors // and the multiplicity of the edge (BB->Succ). As the mapped sets are @@ -101,40 +110,34 @@ class PreservedCFGCheckerInstrumentation { // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed // then the CFG is treated poisoned and no block pointer of the Graph is used. struct CFG { -struct BBGuard final : public CallbackVH { - BBGuard(const BasicBlock *BB) : CallbackVH(BB) {} - void deleted() override { CallbackVH::deleted(); } -