[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
mtrofin wrote: ### Merge activity * **Sep 6, 4:40 PM EDT**: @mtrofin started a stack merge that includes this pull request via [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/107329). https://github.com/llvm/llvm-project/pull/107329 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Insert the ctx prof flattener after the module inliner (PR #107499)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/107499 >From 3cd88ecfa05613ce4f8e4d9671ca3e1d4169fe82 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 5 Sep 2024 12:52:56 -0700 Subject: [PATCH] [ctx_prof] Insert the ctx prof flattener after the module inliner --- llvm/lib/Passes/PassBuilderPipelines.cpp | 18 +- llvm/lib/Transforms/IPO/ModuleInliner.cpp| 6 -- llvm/test/Analysis/CtxProfAnalysis/inline.ll | 17 + llvm/test/Other/opt-hot-cold-split.ll| 2 +- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 38297dc02b8be6..f9b5f584e00c07 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -1017,6 +1017,11 @@ PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level, IP.EnableDeferral = false; MPM.addPass(ModuleInlinerPass(IP, UseInlineAdvisor, Phase)); + if (!UseCtxProfile.empty()) { +MPM.addPass(GlobalOptPass()); +MPM.addPass(GlobalDCEPass()); +MPM.addPass(PGOCtxProfFlatteningPass()); + } MPM.addPass(createModuleToFunctionPassAdaptor( buildFunctionSimplificationPipeline(Level, Phase), @@ -1744,11 +1749,14 @@ ModulePassManager PassBuilder::buildThinLTODefaultPipeline( MPM.addPass(GlobalDCEPass()); return MPM; } - - // Add the core simplification pipeline. - MPM.addPass(buildModuleSimplificationPipeline( - Level, ThinOrFullLTOPhase::ThinLTOPostLink)); - + if (!UseCtxProfile.empty()) { +MPM.addPass( +buildModuleInlinerPipeline(Level, ThinOrFullLTOPhase::ThinLTOPostLink)); + } else { +// Add the core simplification pipeline. +MPM.addPass(buildModuleSimplificationPipeline( +Level, ThinOrFullLTOPhase::ThinLTOPostLink)); + } // Now add the optimization pipeline. MPM.addPass(buildModuleOptimizationPipeline( Level, ThinOrFullLTOPhase::ThinLTOPostLink)); diff --git a/llvm/lib/Transforms/IPO/ModuleInliner.cpp b/llvm/lib/Transforms/IPO/ModuleInliner.cpp index b7e4531c8e390d..542c319b880747 100644 --- a/llvm/lib/Transforms/IPO/ModuleInliner.cpp +++ b/llvm/lib/Transforms/IPO/ModuleInliner.cpp @@ -241,8 +241,10 @@ PreservedAnalyses ModuleInlinerPass::run(Module &M, // the post-inline cleanup and the next DevirtSCCRepeatedPass // iteration because the next iteration may not happen and we may // miss inlining it. - if (tryPromoteCall(*ICB)) -NewCallee = ICB->getCalledFunction(); + // FIXME: enable for ctxprof. + if (!CtxProf) +if (tryPromoteCall(*ICB)) + NewCallee = ICB->getCalledFunction(); } if (NewCallee) if (!NewCallee->isDeclaration()) diff --git a/llvm/test/Analysis/CtxProfAnalysis/inline.ll b/llvm/test/Analysis/CtxProfAnalysis/inline.ll index 875bc4938653b9..9381418c4e3f12 100644 --- a/llvm/test/Analysis/CtxProfAnalysis/inline.ll +++ b/llvm/test/Analysis/CtxProfAnalysis/inline.ll @@ -31,6 +31,23 @@ ; CHECK-NEXT:%call2 = call i32 @a(i32 %x) #1 ; CHECK-NEXT:br label %exit +; Make sure the postlink thinlto pipeline is aware of ctxprof +; RUN: opt -passes='thinlto' -use-ctx-profile=%t/profile.ctxprofdata \ +; RUN: %t/module.ll -S -o - | FileCheck %s --check-prefix=PIPELINE + +; PIPELINE-LABEL: define i32 @entrypoint +; PIPELINE-SAME: !prof ![[ENTRYPOINT_COUNT:[0-9]+]] +; PIPELINE-LABEL: loop.i: +; PIPELINE: br i1 %cond.i, label %loop.i, label %exit, !prof ![[LOOP_BW_INL:[0-9]+]] +; PIPELINE-LABEL: define i32 @a +; PIPELINE-LABEL: loop: +; PIPELINE: br i1 %cond, label %loop, label %exit, !prof ![[LOOP_BW_ORIG:[0-9]+]] + +; PIPELINE: ![[ENTRYPOINT_COUNT]] = !{!"function_entry_count", i64 10} +; These are the weights of the inlined @a, where the counters were 2, 100 (2 for entry, 100 for loop) +; PIPELINE: ![[LOOP_BW_INL]] = !{!"branch_weights", i32 98, i32 2} +; These are the weights of the un-inlined @a, where the counters were 8, 500 (8 for entry, 500 for loop) +; PIPELINE: ![[LOOP_BW_ORIG]] = !{!"branch_weights", i32 492, i32 8} ;--- module.ll define i32 @entrypoint(i32 %x) !guid !0 { diff --git a/llvm/test/Other/opt-hot-cold-split.ll b/llvm/test/Other/opt-hot-cold-split.ll index 21c713d35bb746..cd290dcc306570 100644 --- a/llvm/test/Other/opt-hot-cold-split.ll +++ b/llvm/test/Other/opt-hot-cold-split.ll @@ -2,7 +2,7 @@ ; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='lto-pre-link' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=LTO-PRELINK-Os ; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='thinlto-pre-link' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=THINLTO-PRELINK-Os ; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='lto' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=LTO-POSTLINK-Os -;
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/107329 >From 22e94e4f30c0b3f4c895e789961bff03db745980 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 3 Sep 2024 21:28:05 -0700 Subject: [PATCH] [ctx_prof] Flattened profile lowering pass --- llvm/include/llvm/ProfileData/ProfileCommon.h | 6 +- .../Instrumentation/PGOCtxProfFlattening.h| 25 ++ llvm/lib/Passes/PassBuilder.cpp | 1 + llvm/lib/Passes/PassBuilderPipelines.cpp | 1 + llvm/lib/Passes/PassRegistry.def | 1 + .../Transforms/Instrumentation/CMakeLists.txt | 1 + .../Instrumentation/PGOCtxProfFlattening.cpp | 350 ++ .../flatten-always-removes-instrumentation.ll | 12 + .../CtxProfAnalysis/flatten-and-annotate.ll | 112 ++ 9 files changed, 506 insertions(+), 3 deletions(-) create mode 100644 llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h create mode 100644 llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp create mode 100644 llvm/test/Analysis/CtxProfAnalysis/flatten-always-removes-instrumentation.ll create mode 100644 llvm/test/Analysis/CtxProfAnalysis/flatten-and-annotate.ll diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h index eaab59484c947a..edd8e1f644ad12 100644 --- a/llvm/include/llvm/ProfileData/ProfileCommon.h +++ b/llvm/include/llvm/ProfileData/ProfileCommon.h @@ -79,13 +79,13 @@ class ProfileSummaryBuilder { class InstrProfSummaryBuilder final : public ProfileSummaryBuilder { uint64_t MaxInternalBlockCount = 0; - inline void addEntryCount(uint64_t Count); - inline void addInternalCount(uint64_t Count); - public: InstrProfSummaryBuilder(std::vector Cutoffs) : ProfileSummaryBuilder(std::move(Cutoffs)) {} + void addEntryCount(uint64_t Count); + void addInternalCount(uint64_t Count); + void addRecord(const InstrProfRecord &); std::unique_ptr getSummary(); }; diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h new file mode 100644 index 00..0eab3aaf6fcad3 --- /dev/null +++ b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h @@ -0,0 +1,25 @@ +//===-- PGOCtxProfFlattening.h - Contextual Instr. Flattening ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file declares the PGOCtxProfFlattening class. +// +//===--===// +#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_PGOCTXPROFFLATTENING_H +#define LLVM_TRANSFORMS_INSTRUMENTATION_PGOCTXPROFFLATTENING_H + +#include "llvm/IR/PassManager.h" +namespace llvm { + +class PGOCtxProfFlatteningPass +: public PassInfoMixin { +public: + explicit PGOCtxProfFlatteningPass() = default; + PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); +}; +} // namespace llvm +#endif diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index a22abed8051a11..d87e64eff08966 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -198,6 +198,7 @@ #include "llvm/Transforms/Instrumentation/MemProfiler.h" #include "llvm/Transforms/Instrumentation/MemorySanitizer.h" #include "llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h" +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" #include "llvm/Transforms/Instrumentation/PGOCtxProfLowering.h" #include "llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h" #include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 1fd7ef929c87d5..38297dc02b8be6 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -76,6 +76,7 @@ #include "llvm/Transforms/Instrumentation/InstrOrderFile.h" #include "llvm/Transforms/Instrumentation/InstrProfiling.h" #include "llvm/Transforms/Instrumentation/MemProfiler.h" +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" #include "llvm/Transforms/Instrumentation/PGOCtxProfLowering.h" #include "llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h" #include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index d6067089c6b5c1..2b0624cb9874da 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -58,6 +58,7 @@ MODULE_PASS("coro-early", CoroEarlyPass()) MODULE_PASS("cross-dso-cfi", CrossDSOCFIPass()) MODULE_PASS("ctx-instr-gen", PGOInstrumentationGen(PGOInstrum
[llvm-branch-commits] [llvm] [ctx_prof] Insert the ctx prof flattener after the module inliner (PR #107499)
mtrofin wrote: > [!WARNING] > This pull request is not mergeable via GitHub because a downstack PR is > open. Once all requirements are satisfied, merge this PR as a stack href="https://app.graphite.dev/github/pr/llvm/llvm-project/107499?utm_source=stack-comment-downstack-mergeability-warning"; > >on Graphite. > https://graphite.dev/docs/merge-pull-requests";>Learn more * **#107499** https://app.graphite.dev/github/pr/llvm/llvm-project/107499?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 * **#107329** https://app.graphite.dev/github/pr/llvm/llvm-project/107329?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#107463** https://app.graphite.dev/github/pr/llvm/llvm-project/107463?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * `main` This stack of pull requests is managed by Graphite. https://stacking.dev/?utm_source=stack-comment";>Learn more about stacking. Join @mtrofin and the rest of your teammates on https://graphite.dev?utm-source=stack-comment";>https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="11px" height="11px"/> Graphite https://github.com/llvm/llvm-project/pull/107499 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Insert the ctx prof flattener after the module inliner (PR #107499)
https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/107499 None >From e90265db97747c0b15f81b31f061e299ffd33138 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 5 Sep 2024 12:52:56 -0700 Subject: [PATCH] [ctx_prof] Insert the ctx prof flattener after the module inliner --- llvm/lib/Passes/PassBuilderPipelines.cpp | 18 +- llvm/test/Analysis/CtxProfAnalysis/inline.ll | 17 + llvm/test/Other/opt-hot-cold-split.ll| 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 38297dc02b8be6..f9b5f584e00c07 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -1017,6 +1017,11 @@ PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level, IP.EnableDeferral = false; MPM.addPass(ModuleInlinerPass(IP, UseInlineAdvisor, Phase)); + if (!UseCtxProfile.empty()) { +MPM.addPass(GlobalOptPass()); +MPM.addPass(GlobalDCEPass()); +MPM.addPass(PGOCtxProfFlatteningPass()); + } MPM.addPass(createModuleToFunctionPassAdaptor( buildFunctionSimplificationPipeline(Level, Phase), @@ -1744,11 +1749,14 @@ ModulePassManager PassBuilder::buildThinLTODefaultPipeline( MPM.addPass(GlobalDCEPass()); return MPM; } - - // Add the core simplification pipeline. - MPM.addPass(buildModuleSimplificationPipeline( - Level, ThinOrFullLTOPhase::ThinLTOPostLink)); - + if (!UseCtxProfile.empty()) { +MPM.addPass( +buildModuleInlinerPipeline(Level, ThinOrFullLTOPhase::ThinLTOPostLink)); + } else { +// Add the core simplification pipeline. +MPM.addPass(buildModuleSimplificationPipeline( +Level, ThinOrFullLTOPhase::ThinLTOPostLink)); + } // Now add the optimization pipeline. MPM.addPass(buildModuleOptimizationPipeline( Level, ThinOrFullLTOPhase::ThinLTOPostLink)); diff --git a/llvm/test/Analysis/CtxProfAnalysis/inline.ll b/llvm/test/Analysis/CtxProfAnalysis/inline.ll index 875bc4938653b9..9381418c4e3f12 100644 --- a/llvm/test/Analysis/CtxProfAnalysis/inline.ll +++ b/llvm/test/Analysis/CtxProfAnalysis/inline.ll @@ -31,6 +31,23 @@ ; CHECK-NEXT:%call2 = call i32 @a(i32 %x) #1 ; CHECK-NEXT:br label %exit +; Make sure the postlink thinlto pipeline is aware of ctxprof +; RUN: opt -passes='thinlto' -use-ctx-profile=%t/profile.ctxprofdata \ +; RUN: %t/module.ll -S -o - | FileCheck %s --check-prefix=PIPELINE + +; PIPELINE-LABEL: define i32 @entrypoint +; PIPELINE-SAME: !prof ![[ENTRYPOINT_COUNT:[0-9]+]] +; PIPELINE-LABEL: loop.i: +; PIPELINE: br i1 %cond.i, label %loop.i, label %exit, !prof ![[LOOP_BW_INL:[0-9]+]] +; PIPELINE-LABEL: define i32 @a +; PIPELINE-LABEL: loop: +; PIPELINE: br i1 %cond, label %loop, label %exit, !prof ![[LOOP_BW_ORIG:[0-9]+]] + +; PIPELINE: ![[ENTRYPOINT_COUNT]] = !{!"function_entry_count", i64 10} +; These are the weights of the inlined @a, where the counters were 2, 100 (2 for entry, 100 for loop) +; PIPELINE: ![[LOOP_BW_INL]] = !{!"branch_weights", i32 98, i32 2} +; These are the weights of the un-inlined @a, where the counters were 8, 500 (8 for entry, 500 for loop) +; PIPELINE: ![[LOOP_BW_ORIG]] = !{!"branch_weights", i32 492, i32 8} ;--- module.ll define i32 @entrypoint(i32 %x) !guid !0 { diff --git a/llvm/test/Other/opt-hot-cold-split.ll b/llvm/test/Other/opt-hot-cold-split.ll index 21c713d35bb746..cd290dcc306570 100644 --- a/llvm/test/Other/opt-hot-cold-split.ll +++ b/llvm/test/Other/opt-hot-cold-split.ll @@ -2,7 +2,7 @@ ; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='lto-pre-link' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=LTO-PRELINK-Os ; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='thinlto-pre-link' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=THINLTO-PRELINK-Os ; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='lto' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=LTO-POSTLINK-Os -; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -passes='thinlto' -debug-pass-manager < %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=THINLTO-POSTLINK-Os +; RUN: opt -mtriple=x86_64-- -hot-cold-split=true -LINK-Os ; REQUIRES: asserts ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/107329 >From 856568c07d924dd59aaa81450cb8bcb64d60d2eb Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 3 Sep 2024 21:28:05 -0700 Subject: [PATCH] [ctx_prof] Flattened profile lowering pass --- llvm/include/llvm/ProfileData/ProfileCommon.h | 6 +- .../Instrumentation/PGOCtxProfFlattening.h| 25 ++ llvm/lib/Passes/PassBuilder.cpp | 1 + llvm/lib/Passes/PassBuilderPipelines.cpp | 1 + llvm/lib/Passes/PassRegistry.def | 1 + .../Transforms/Instrumentation/CMakeLists.txt | 1 + .../Instrumentation/PGOCtxProfFlattening.cpp | 341 ++ .../flatten-always-removes-instrumentation.ll | 12 + .../CtxProfAnalysis/flatten-and-annotate.ll | 112 ++ 9 files changed, 497 insertions(+), 3 deletions(-) create mode 100644 llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h create mode 100644 llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp create mode 100644 llvm/test/Analysis/CtxProfAnalysis/flatten-always-removes-instrumentation.ll create mode 100644 llvm/test/Analysis/CtxProfAnalysis/flatten-and-annotate.ll diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h index eaab59484c947a..edd8e1f644ad12 100644 --- a/llvm/include/llvm/ProfileData/ProfileCommon.h +++ b/llvm/include/llvm/ProfileData/ProfileCommon.h @@ -79,13 +79,13 @@ class ProfileSummaryBuilder { class InstrProfSummaryBuilder final : public ProfileSummaryBuilder { uint64_t MaxInternalBlockCount = 0; - inline void addEntryCount(uint64_t Count); - inline void addInternalCount(uint64_t Count); - public: InstrProfSummaryBuilder(std::vector Cutoffs) : ProfileSummaryBuilder(std::move(Cutoffs)) {} + void addEntryCount(uint64_t Count); + void addInternalCount(uint64_t Count); + void addRecord(const InstrProfRecord &); std::unique_ptr getSummary(); }; diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h new file mode 100644 index 00..0eab3aaf6fcad3 --- /dev/null +++ b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h @@ -0,0 +1,25 @@ +//===-- PGOCtxProfFlattening.h - Contextual Instr. Flattening ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file declares the PGOCtxProfFlattening class. +// +//===--===// +#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_PGOCTXPROFFLATTENING_H +#define LLVM_TRANSFORMS_INSTRUMENTATION_PGOCTXPROFFLATTENING_H + +#include "llvm/IR/PassManager.h" +namespace llvm { + +class PGOCtxProfFlatteningPass +: public PassInfoMixin { +public: + explicit PGOCtxProfFlatteningPass() = default; + PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); +}; +} // namespace llvm +#endif diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index a22abed8051a11..d87e64eff08966 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -198,6 +198,7 @@ #include "llvm/Transforms/Instrumentation/MemProfiler.h" #include "llvm/Transforms/Instrumentation/MemorySanitizer.h" #include "llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h" +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" #include "llvm/Transforms/Instrumentation/PGOCtxProfLowering.h" #include "llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h" #include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 1fd7ef929c87d5..38297dc02b8be6 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -76,6 +76,7 @@ #include "llvm/Transforms/Instrumentation/InstrOrderFile.h" #include "llvm/Transforms/Instrumentation/InstrProfiling.h" #include "llvm/Transforms/Instrumentation/MemProfiler.h" +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" #include "llvm/Transforms/Instrumentation/PGOCtxProfLowering.h" #include "llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h" #include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index d6067089c6b5c1..2b0624cb9874da 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -58,6 +58,7 @@ MODULE_PASS("coro-early", CoroEarlyPass()) MODULE_PASS("cross-dso-cfi", CrossDSOCFIPass()) MODULE_PASS("ctx-instr-gen", PGOInstrumentationGen(PGOInstrum
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
@@ -0,0 +1,333 @@ +//===- PGOCtxProfFlattening.cpp - Contextual Instr. Flattening ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Flattens the contextual profile and lowers it to MD_prof. +// This should happen after all IPO (which is assumed to have maintained the +// contextual profile) happened. Flattening consists of summing the values at +// the same index of the counters belonging to all the contexts of a function. +// The lowering consists of materializing the counter values to function +// entrypoint counts and branch probabilities. +// +// This pass also removes contextual instrumentation, which has been kept around +// to facilitate its functionality. +// +//===--===// + +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/ProfileSummaryInfo.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/CFG.h" +#include "llvm/IR/Dominators.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/ProfileSummary.h" +#include "llvm/ProfileData/ProfileCommon.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "llvm/Transforms/Scalar/DCE.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" + +using namespace llvm; + +namespace { + +class ProfileAnnotator final { + class BBInfo; + struct EdgeInfo { +BBInfo *const Src; +BBInfo *const Dest; +std::optional Count; + +explicit EdgeInfo(BBInfo &Src, BBInfo &Dest) : Src(&Src), Dest(&Dest) {} + }; + + class BBInfo { +std::optional Count; +SmallVector OutEdges; +SmallVector InEdges; +size_t UnknownCountOutEdges = 0; +size_t UnknownCountInEdges = 0; + +uint64_t getEdgeSum(const SmallVector &Edges, +bool AssumeAllKnown) const { + uint64_t Sum = 0; + for (const auto *E : Edges) +if (E) + Sum += AssumeAllKnown ? *E->Count : E->Count.value_or(0U); + return Sum; +} + +void takeCountFrom(const SmallVector &Edges) { + assert(!Count.has_value()); + Count = getEdgeSum(Edges, true); +} + +void setSingleUnknownEdgeCount(SmallVector &Edges) { + uint64_t KnownSum = getEdgeSum(Edges, false); + uint64_t EdgeVal = *Count > KnownSum ? *Count - KnownSum : 0U; + EdgeInfo *E = nullptr; + for (auto *I : Edges) +if (I && !I->Count.has_value()) { + E = I; +#ifdef NDEBUG + break; +#else + assert((!E || E == I) && + "Expected exactly one edge to have an unknown count, " + "found a second one"); + continue; +#endif +} + assert(E && "Expected exactly one edge to have an unknown count"); + assert(!E->Count.has_value()); + E->Count = EdgeVal; + assert(E->Src->UnknownCountOutEdges > 0); + assert(E->Dest->UnknownCountInEdges > 0); + --E->Src->UnknownCountOutEdges; + --E->Dest->UnknownCountInEdges; +} + + public: +BBInfo(size_t NumInEdges, size_t NumOutEdges, std::optional Count) +: Count(Count) { + InEdges.reserve(NumInEdges); + OutEdges.resize(NumOutEdges); +} + +bool tryTakeCountFromKnownOutEdges(const BasicBlock &BB) { + if (!succ_empty(&BB) && !UnknownCountOutEdges) { +takeCountFrom(OutEdges); +return true; + } + return false; +} + +bool tryTakeCountFromKnownInEdges(const BasicBlock &BB) { + if (!BB.isEntryBlock() && !UnknownCountInEdges) { +takeCountFrom(InEdges); +return true; + } + return false; +} + +void addInEdge(EdgeInfo *Info) { + InEdges.push_back(Info); + ++UnknownCountInEdges; +} + +void addOutEdge(size_t Index, EdgeInfo *Info) { + OutEdges[Index] = Info; + ++UnknownCountOutEdges; +} + +bool hasCount() const { return Count.has_value(); } + +bool trySetSingleUnknownInEdgeCount() { + if (UnknownCountInEdges == 1) { +setSingleUnknownEdgeCount(InEdges); +return true; + } + return false; +} + +bool trySetSingleUnknownOutEdgeCount() { + if (UnknownCountOutEdges == 1) { +setSingleUnknownEdgeCount(OutEdges); +return true; + } + return false; +} +size_t getNumOutEdges() const { return OutEdges.size(); } + +uint64_t getEdgeCount(size_t Index) const { + if (auto *E = OutEdges[Index]) +return *E->Count; + return 0U; +} + }; + + F
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
@@ -0,0 +1,333 @@ +//===- PGOCtxProfFlattening.cpp - Contextual Instr. Flattening ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Flattens the contextual profile and lowers it to MD_prof. +// This should happen after all IPO (which is assumed to have maintained the +// contextual profile) happened. Flattening consists of summing the values at +// the same index of the counters belonging to all the contexts of a function. +// The lowering consists of materializing the counter values to function +// entrypoint counts and branch probabilities. +// +// This pass also removes contextual instrumentation, which has been kept around +// to facilitate its functionality. +// +//===--===// + +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/ProfileSummaryInfo.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/CFG.h" +#include "llvm/IR/Dominators.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/ProfileSummary.h" +#include "llvm/ProfileData/ProfileCommon.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "llvm/Transforms/Scalar/DCE.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" + +using namespace llvm; + +namespace { + +class ProfileAnnotator final { + class BBInfo; + struct EdgeInfo { +BBInfo *const Src; +BBInfo *const Dest; +std::optional Count; + +explicit EdgeInfo(BBInfo &Src, BBInfo &Dest) : Src(&Src), Dest(&Dest) {} + }; + + class BBInfo { +std::optional Count; +SmallVector OutEdges; +SmallVector InEdges; +size_t UnknownCountOutEdges = 0; +size_t UnknownCountInEdges = 0; + +uint64_t getEdgeSum(const SmallVector &Edges, +bool AssumeAllKnown) const { + uint64_t Sum = 0; + for (const auto *E : Edges) +if (E) + Sum += AssumeAllKnown ? *E->Count : E->Count.value_or(0U); + return Sum; +} + +void takeCountFrom(const SmallVector &Edges) { + assert(!Count.has_value()); + Count = getEdgeSum(Edges, true); +} + +void setSingleUnknownEdgeCount(SmallVector &Edges) { + uint64_t KnownSum = getEdgeSum(Edges, false); + uint64_t EdgeVal = *Count > KnownSum ? *Count - KnownSum : 0U; + EdgeInfo *E = nullptr; + for (auto *I : Edges) +if (I && !I->Count.has_value()) { + E = I; +#ifdef NDEBUG + break; +#else + assert((!E || E == I) && + "Expected exactly one edge to have an unknown count, " + "found a second one"); + continue; +#endif +} + assert(E && "Expected exactly one edge to have an unknown count"); + assert(!E->Count.has_value()); + E->Count = EdgeVal; + assert(E->Src->UnknownCountOutEdges > 0); + assert(E->Dest->UnknownCountInEdges > 0); + --E->Src->UnknownCountOutEdges; + --E->Dest->UnknownCountInEdges; +} + + public: +BBInfo(size_t NumInEdges, size_t NumOutEdges, std::optional Count) +: Count(Count) { + InEdges.reserve(NumInEdges); + OutEdges.resize(NumOutEdges); +} + +bool tryTakeCountFromKnownOutEdges(const BasicBlock &BB) { + if (!succ_empty(&BB) && !UnknownCountOutEdges) { +takeCountFrom(OutEdges); +return true; + } + return false; +} + +bool tryTakeCountFromKnownInEdges(const BasicBlock &BB) { + if (!BB.isEntryBlock() && !UnknownCountInEdges) { +takeCountFrom(InEdges); +return true; + } + return false; +} + +void addInEdge(EdgeInfo *Info) { + InEdges.push_back(Info); + ++UnknownCountInEdges; +} + +void addOutEdge(size_t Index, EdgeInfo *Info) { + OutEdges[Index] = Info; + ++UnknownCountOutEdges; +} + +bool hasCount() const { return Count.has_value(); } + +bool trySetSingleUnknownInEdgeCount() { + if (UnknownCountInEdges == 1) { +setSingleUnknownEdgeCount(InEdges); +return true; + } + return false; +} + +bool trySetSingleUnknownOutEdgeCount() { + if (UnknownCountOutEdges == 1) { +setSingleUnknownEdgeCount(OutEdges); +return true; + } + return false; +} +size_t getNumOutEdges() const { return OutEdges.size(); } + +uint64_t getEdgeCount(size_t Index) const { + if (auto *E = OutEdges[Index]) +return *E->Count; + return 0U; +} + }; + + F
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
@@ -0,0 +1,333 @@ +//===- PGOCtxProfFlattening.cpp - Contextual Instr. Flattening ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Flattens the contextual profile and lowers it to MD_prof. +// This should happen after all IPO (which is assumed to have maintained the +// contextual profile) happened. Flattening consists of summing the values at +// the same index of the counters belonging to all the contexts of a function. +// The lowering consists of materializing the counter values to function +// entrypoint counts and branch probabilities. +// +// This pass also removes contextual instrumentation, which has been kept around +// to facilitate its functionality. +// +//===--===// + +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/ProfileSummaryInfo.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/CFG.h" +#include "llvm/IR/Dominators.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/ProfileSummary.h" +#include "llvm/ProfileData/ProfileCommon.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "llvm/Transforms/Scalar/DCE.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" + +using namespace llvm; + +namespace { + +class ProfileAnnotator final { + class BBInfo; + struct EdgeInfo { +BBInfo *const Src; +BBInfo *const Dest; +std::optional Count; + +explicit EdgeInfo(BBInfo &Src, BBInfo &Dest) : Src(&Src), Dest(&Dest) {} + }; + + class BBInfo { +std::optional Count; +SmallVector OutEdges; +SmallVector InEdges; +size_t UnknownCountOutEdges = 0; +size_t UnknownCountInEdges = 0; + +uint64_t getEdgeSum(const SmallVector &Edges, +bool AssumeAllKnown) const { + uint64_t Sum = 0; + for (const auto *E : Edges) +if (E) + Sum += AssumeAllKnown ? *E->Count : E->Count.value_or(0U); + return Sum; +} + +void takeCountFrom(const SmallVector &Edges) { + assert(!Count.has_value()); + Count = getEdgeSum(Edges, true); +} + +void setSingleUnknownEdgeCount(SmallVector &Edges) { + uint64_t KnownSum = getEdgeSum(Edges, false); + uint64_t EdgeVal = *Count > KnownSum ? *Count - KnownSum : 0U; + EdgeInfo *E = nullptr; + for (auto *I : Edges) +if (I && !I->Count.has_value()) { + E = I; +#ifdef NDEBUG + break; +#else + assert((!E || E == I) && + "Expected exactly one edge to have an unknown count, " + "found a second one"); + continue; +#endif +} + assert(E && "Expected exactly one edge to have an unknown count"); + assert(!E->Count.has_value()); + E->Count = EdgeVal; + assert(E->Src->UnknownCountOutEdges > 0); + assert(E->Dest->UnknownCountInEdges > 0); + --E->Src->UnknownCountOutEdges; + --E->Dest->UnknownCountInEdges; +} + + public: +BBInfo(size_t NumInEdges, size_t NumOutEdges, std::optional Count) +: Count(Count) { + InEdges.reserve(NumInEdges); + OutEdges.resize(NumOutEdges); +} + +bool tryTakeCountFromKnownOutEdges(const BasicBlock &BB) { + if (!succ_empty(&BB) && !UnknownCountOutEdges) { +takeCountFrom(OutEdges); +return true; + } + return false; +} + +bool tryTakeCountFromKnownInEdges(const BasicBlock &BB) { + if (!BB.isEntryBlock() && !UnknownCountInEdges) { +takeCountFrom(InEdges); +return true; + } + return false; +} + +void addInEdge(EdgeInfo *Info) { + InEdges.push_back(Info); + ++UnknownCountInEdges; +} + +void addOutEdge(size_t Index, EdgeInfo *Info) { + OutEdges[Index] = Info; + ++UnknownCountOutEdges; +} + +bool hasCount() const { return Count.has_value(); } + +bool trySetSingleUnknownInEdgeCount() { + if (UnknownCountInEdges == 1) { +setSingleUnknownEdgeCount(InEdges); +return true; + } + return false; +} + +bool trySetSingleUnknownOutEdgeCount() { + if (UnknownCountOutEdges == 1) { +setSingleUnknownEdgeCount(OutEdges); +return true; + } + return false; +} +size_t getNumOutEdges() const { return OutEdges.size(); } + +uint64_t getEdgeCount(size_t Index) const { + if (auto *E = OutEdges[Index]) +return *E->Count; + return 0U; +} + }; + + F
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
@@ -0,0 +1,333 @@ +//===- PGOCtxProfFlattening.cpp - Contextual Instr. Flattening ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Flattens the contextual profile and lowers it to MD_prof. +// This should happen after all IPO (which is assumed to have maintained the +// contextual profile) happened. Flattening consists of summing the values at +// the same index of the counters belonging to all the contexts of a function. +// The lowering consists of materializing the counter values to function +// entrypoint counts and branch probabilities. +// +// This pass also removes contextual instrumentation, which has been kept around +// to facilitate its functionality. +// +//===--===// + +#include "llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/ProfileSummaryInfo.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/CFG.h" +#include "llvm/IR/Dominators.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/ProfileSummary.h" +#include "llvm/ProfileData/ProfileCommon.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "llvm/Transforms/Scalar/DCE.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" + +using namespace llvm; + +namespace { + +class ProfileAnnotator final { + class BBInfo; + struct EdgeInfo { +BBInfo *const Src; +BBInfo *const Dest; +std::optional Count; + +explicit EdgeInfo(BBInfo &Src, BBInfo &Dest) : Src(&Src), Dest(&Dest) {} + }; + + class BBInfo { +std::optional Count; +SmallVector OutEdges; +SmallVector InEdges; +size_t UnknownCountOutEdges = 0; +size_t UnknownCountInEdges = 0; + +uint64_t getEdgeSum(const SmallVector &Edges, +bool AssumeAllKnown) const { + uint64_t Sum = 0; + for (const auto *E : Edges) +if (E) + Sum += AssumeAllKnown ? *E->Count : E->Count.value_or(0U); + return Sum; +} + +void takeCountFrom(const SmallVector &Edges) { + assert(!Count.has_value()); + Count = getEdgeSum(Edges, true); +} + +void setSingleUnknownEdgeCount(SmallVector &Edges) { + uint64_t KnownSum = getEdgeSum(Edges, false); + uint64_t EdgeVal = *Count > KnownSum ? *Count - KnownSum : 0U; + EdgeInfo *E = nullptr; + for (auto *I : Edges) +if (I && !I->Count.has_value()) { + E = I; +#ifdef NDEBUG + break; +#else + assert((!E || E == I) && + "Expected exactly one edge to have an unknown count, " + "found a second one"); + continue; +#endif +} + assert(E && "Expected exactly one edge to have an unknown count"); + assert(!E->Count.has_value()); + E->Count = EdgeVal; + assert(E->Src->UnknownCountOutEdges > 0); + assert(E->Dest->UnknownCountInEdges > 0); + --E->Src->UnknownCountOutEdges; + --E->Dest->UnknownCountInEdges; +} + + public: +BBInfo(size_t NumInEdges, size_t NumOutEdges, std::optional Count) +: Count(Count) { + InEdges.reserve(NumInEdges); + OutEdges.resize(NumOutEdges); +} + +bool tryTakeCountFromKnownOutEdges(const BasicBlock &BB) { + if (!succ_empty(&BB) && !UnknownCountOutEdges) { +takeCountFrom(OutEdges); +return true; + } + return false; +} + +bool tryTakeCountFromKnownInEdges(const BasicBlock &BB) { + if (!BB.isEntryBlock() && !UnknownCountInEdges) { +takeCountFrom(InEdges); +return true; + } + return false; +} + +void addInEdge(EdgeInfo *Info) { + InEdges.push_back(Info); + ++UnknownCountInEdges; +} + +void addOutEdge(size_t Index, EdgeInfo *Info) { + OutEdges[Index] = Info; + ++UnknownCountOutEdges; +} + +bool hasCount() const { return Count.has_value(); } + +bool trySetSingleUnknownInEdgeCount() { + if (UnknownCountInEdges == 1) { +setSingleUnknownEdgeCount(InEdges); +return true; + } + return false; +} + +bool trySetSingleUnknownOutEdgeCount() { + if (UnknownCountOutEdges == 1) { +setSingleUnknownEdgeCount(OutEdges); +return true; + } + return false; +} +size_t getNumOutEdges() const { return OutEdges.size(); } + +uint64_t getEdgeCount(size_t Index) const { + if (auto *E = OutEdges[Index]) +return *E->Count; + return 0U; +} + }; + + F
[llvm-branch-commits] [llvm] [ctx_prof] Flattened profile lowering pass (PR #107329)
https://github.com/mtrofin edited https://github.com/llvm/llvm-project/pull/107329 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (#99064) (PR #106823)
https://github.com/mtrofin approved this pull request. https://github.com/llvm/llvm-project/pull/106823 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
mtrofin wrote: ### Merge activity * **Aug 27, 6:37 PM EDT**: @mtrofin started a stack merge that includes this pull request via [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/105469). https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -456,3 +463,170 @@ declare void @_ZN5Base35func3Ev(ptr) // 1 call instruction from the entry block. EXPECT_EQ(F->front().size(), OrigEntryBBSize + 4); } + +using namespace llvm::ctx_profile; + +class ContextManager final { + std::vector> Nodes; + std::map Roots; + +public: + ContextNode *createNode(GUID Guid, uint32_t NrCounters, uint32_t NrCallsites, + ContextNode *Next = nullptr) { +auto AllocSize = ContextNode::getAllocSize(NrCounters, NrCallsites); +auto *Mem = Nodes.emplace_back(std::make_unique(AllocSize)).get(); +std::memset(Mem, 0, AllocSize); +auto *Ret = new (Mem) ContextNode(Guid, NrCounters, NrCallsites, Next); +return Ret; + } +}; + +TEST(CallPromotionUtilsTest, PromoteWithIcmpAndCtxProf) { + LLVMContext C; + std::unique_ptr M = parseIR(C, + R"IR( +define i32 @testfunc1(ptr %d) !guid !0 { + call void @llvm.instrprof.increment(ptr @testfunc1, i64 0, i32 1, i32 0) + call void @llvm.instrprof.callsite(ptr @testfunc1, i64 0, i32 1, i32 0, ptr %d) + %call = call i32 %d() + ret i32 %call +} + +define i32 @f1() !guid !1 { + call void @llvm.instrprof.increment(ptr @f1, i64 0, i32 1, i32 0) + ret i32 2 +} + +define i32 @f2() !guid !2 { + call void @llvm.instrprof.increment(ptr @f2, i64 0, i32 1, i32 0) + call void @llvm.instrprof.callsite(ptr @f2, i64 0, i32 1, i32 0, ptr @f4) + %r = call i32 @f4() + ret i32 %r +} + +define i32 @testfunc2(ptr %p) !guid !4 { + call void @llvm.instrprof.increment(ptr @testfunc2, i64 0, i32 1, i32 0) + call void @llvm.instrprof.callsite(ptr @testfunc2, i64 0, i32 1, i32 0, ptr @testfunc1) + %r = call i32 @testfunc1(ptr %p) + ret i32 %r +} + +declare i32 @f3() + +define i32 @f4() !guid !3 { + ret i32 3 +} + +!0 = !{i64 1000} +!1 = !{i64 1001} +!2 = !{i64 1002} +!3 = !{i64 1004} +!4 = !{i64 1005} +)IR"); + + const char *Profile = R"( mtrofin wrote: done, but doesn't seem to have any effect. I do want the formatting to be more compact, fwiw. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -456,3 +463,170 @@ declare void @_ZN5Base35func3Ev(ptr) // 1 call instruction from the entry block. EXPECT_EQ(F->front().size(), OrigEntryBBSize + 4); } + +using namespace llvm::ctx_profile; + +class ContextManager final { + std::vector> Nodes; + std::map Roots; + +public: + ContextNode *createNode(GUID Guid, uint32_t NrCounters, uint32_t NrCallsites, + ContextNode *Next = nullptr) { +auto AllocSize = ContextNode::getAllocSize(NrCounters, NrCallsites); +auto *Mem = Nodes.emplace_back(std::make_unique(AllocSize)).get(); +std::memset(Mem, 0, AllocSize); mtrofin wrote: I actually don't need this whole thing. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 63169fae1171006df0e6e40e64fe9479c371d376 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 + llvm/lib/IR/IntrinsicInst.cpp | 10 ++ .../Transforms/Utils/CallPromotionUtils.cpp | 86 +- .../Utils/CallPromotionUtilsTest.cpp | 157 ++ 8 files changed, 344 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAn
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From a4079fec267380e8503b96eb4685682f01f93e2f Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 + llvm/lib/IR/IntrinsicInst.cpp | 10 ++ .../Transforms/Utils/CallPromotionUtils.cpp | 86 +- .../Utils/CallPromotionUtilsTest.cpp | 157 ++ 8 files changed, 344 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAn
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From a4079fec267380e8503b96eb4685682f01f93e2f Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 + llvm/lib/IR/IntrinsicInst.cpp | 10 ++ .../Transforms/Utils/CallPromotionUtils.cpp | 86 +- .../Utils/CallPromotionUtilsTest.cpp | 157 ++ 8 files changed, 344 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAn
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 4e948895dfc12595f0d65e2599d3d369da8ee204 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 - .../Utils/CallPromotionUtilsTest.cpp | 174 ++ 8 files changed, 361 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAnaly
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 955ac292d2b879a5d8557688345fad4d3e21a09b Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 87 - .../Utils/CallPromotionUtilsTest.cpp | 174 ++ 8 files changed, 361 insertions(+), 34 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAnaly
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -572,6 +575,89 @@ CallBase &llvm::promoteCallWithIfThenElse(CallBase &CB, Function *Callee, return promoteCall(NewInst, Callee); } +CallBase *llvm::promoteCallWithIfThenElse(CallBase &CB, Function &Callee, + PGOContextualProfile &CtxProf) { + assert(CB.isIndirectCall()); + if (!CtxProf.isFunctionKnown(Callee)) +return nullptr; + auto &Caller = *CB.getParent()->getParent(); mtrofin wrote: yes. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -572,6 +575,89 @@ CallBase &llvm::promoteCallWithIfThenElse(CallBase &CB, Function *Callee, return promoteCall(NewInst, Callee); } +CallBase *llvm::promoteCallWithIfThenElse(CallBase &CB, Function &Callee, + PGOContextualProfile &CtxProf) { + assert(CB.isIndirectCall()); + if (!CtxProf.isFunctionKnown(Callee)) +return nullptr; + auto &Caller = *CB.getParent()->getParent(); + auto *CSInstr = CtxProfAnalysis::getCallsiteInstrumentation(CB); + if (!CSInstr) +return nullptr; + const auto CSIndex = CSInstr->getIndex()->getZExtValue(); + + CallBase &DirectCall = promoteCall( + versionCallSite(CB, &Callee, /*BranchWeights=*/nullptr), &Callee); + CSInstr->moveBefore(&CB); + const auto NewCSID = CtxProf.allocateNextCallsiteIndex(Caller); + auto *NewCSInstr = cast(CSInstr->clone()); + NewCSInstr->setIndex(NewCSID); + NewCSInstr->setCallee(&Callee); + NewCSInstr->insertBefore(&DirectCall); + auto &DirectBB = *DirectCall.getParent(); + auto &IndirectBB = *CB.getParent(); + + assert((CtxProfAnalysis::getBBInstrumentation(IndirectBB) == nullptr) && + "The ICP direct BB is new, it shouldn't have instrumentation"); + assert((CtxProfAnalysis::getBBInstrumentation(DirectBB) == nullptr) && + "The ICP indirect BB is new, it shouldn't have instrumentation"); + + // Make the 2 new BBs have counters. + const uint32_t DirectID = CtxProf.allocateNextCounterIndex(Caller); + const uint32_t IndirectID = CtxProf.allocateNextCounterIndex(Caller); + const uint32_t NewCountersSize = IndirectID + 1; + auto *EntryBBIns = + CtxProfAnalysis::getBBInstrumentation(Caller.getEntryBlock()); + auto *DirectBBIns = cast(EntryBBIns->clone()); + DirectBBIns->setIndex(DirectID); + DirectBBIns->insertInto(&DirectBB, DirectBB.getFirstInsertionPt()); + + auto *IndirectBBIns = cast(EntryBBIns->clone()); + IndirectBBIns->setIndex(IndirectID); + IndirectBBIns->insertInto(&IndirectBB, IndirectBB.getFirstInsertionPt()); + + const GlobalValue::GUID CalleeGUID = AssignGUIDPass::getGUID(Callee); + + auto ProfileUpdater = [&](PGOCtxProfContext &Ctx) { +assert(Ctx.guid() == AssignGUIDPass::getGUID(Caller)); +assert(NewCountersSize - 2 == Ctx.counters().size()); +// Regardless what next, all the ctx-es belonging to a function must have mtrofin wrote: dropped. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -456,3 +463,170 @@ declare void @_ZN5Base35func3Ev(ptr) // 1 call instruction from the entry block. EXPECT_EQ(F->front().size(), OrigEntryBBSize + 4); } + +using namespace llvm::ctx_profile; + +class ContextManager final { + std::vector> Nodes; + std::map Roots; + +public: + ContextNode *createNode(GUID Guid, uint32_t NrCounters, uint32_t NrCallsites, + ContextNode *Next = nullptr) { +auto AllocSize = ContextNode::getAllocSize(NrCounters, NrCallsites); +auto *Mem = Nodes.emplace_back(std::make_unique(AllocSize)).get(); +std::memset(Mem, 0, AllocSize); +auto *Ret = new (Mem) ContextNode(Guid, NrCounters, NrCallsites, Next); +return Ret; + } +}; + +TEST(CallPromotionUtilsTest, PromoteWithIcmpAndCtxProf) { + LLVMContext C; + std::unique_ptr M = parseIR(C, + R"IR( +define i32 @testfunc1(ptr %d) !guid !0 { + call void @llvm.instrprof.increment(ptr null, i64 0, i32 1, i32 0) + call void @llvm.instrprof.callsite(ptr null, i64 0, i32 1, i32 0, ptr %d) + %call = call i32 %d() + ret i32 %call +} + +define i32 @f1() !guid !1 { + call void @llvm.instrprof.increment(ptr null, i64 0, i32 1, i32 0) + ret i32 2 +} + +define i32 @f2() !guid !2 { + call void @llvm.instrprof.increment(ptr null, i64 0, i32 1, i32 0) + call void @llvm.instrprof.callsite(ptr null, i64 0, i32 1, i32 0, ptr @f4) + %r = call i32 @f4() + ret i32 %r +} + +define i32 @testfunc2(ptr %p) !guid !4 { + call void @llvm.instrprof.increment(ptr null, i64 0, i32 1, i32 0) + call void @llvm.instrprof.callsite(ptr null, i64 0, i32 1, i32 0, ptr @testfunc1) + %r = call i32 @testfunc1(ptr %p) + ret i32 %r +} + +declare i32 @f3() + +define i32 @f4() !guid !3 { + ret i32 3 +} + +!0 = !{i64 1000} +!1 = !{i64 1001} +!2 = !{i64 1002} +!3 = !{i64 1004} +!4 = !{i64 1005} +)IR"); + + const char *Profile = R"( +[ +{ + "Guid": 1000, + "Counters": [1], + "Callsites": [ +[{ "Guid": 1001, +"Counters": [10]}, + { "Guid": 1002, +"Counters": [11], +"Callsites": [[{"Guid": 1004, "Counters":[13]}]] + }, + { "Guid": 1003, +"Counters": [12] + }]] +}, +{ + "Guid": 1005, + "Counters": [2], + "Callsites": [ +[{ "Guid": 1000, +"Counters": [1], +"Callsites": [ + [{ "Guid": 1001, + "Counters": [101]}, +{ "Guid": 1002, + "Counters": [102], + "Callsites": [[{"Guid": 1004, "Counters":[104]}]] +}, +{ "Guid": 1003, + "Counters": [103] +}]]}]]}] +)"; + + llvm::unittest::TempFile ProfileFile("ctx_profile", "", "", /*Unique*/ true); + { +std::error_code EC; +raw_fd_stream Out(ProfileFile.path(), EC); +ASSERT_FALSE(EC); +// "False" means no error. +ASSERT_FALSE(llvm::createCtxProfFromJSON(Profile, Out)); + } + + ModuleAnalysisManager MAM; + MAM.registerPass([&]() { return CtxProfAnalysis(ProfileFile.path()); }); + MAM.registerPass([&]() { return PassInstrumentationAnalysis(); }); + auto &CtxProf = MAM.getResult(*M); + auto *Caller = M->getFunction("testfunc1"); + ASSERT_TRUE(!!Caller); mtrofin wrote: Odd indeed. Fixed. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -57,9 +57,23 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { return Counters[0]; } mtrofin wrote: wouldn't hurt (the idea is that all functions have their entry BB instrumented) https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -572,6 +575,89 @@ CallBase &llvm::promoteCallWithIfThenElse(CallBase &CB, Function *Callee, return promoteCall(NewInst, Callee); } +CallBase *llvm::promoteCallWithIfThenElse(CallBase &CB, Function &Callee, + PGOContextualProfile &CtxProf) { + assert(CB.isIndirectCall()); + if (!CtxProf.isFunctionKnown(Callee)) +return nullptr; + auto &Caller = *CB.getParent()->getParent(); + auto *CSInstr = CtxProfAnalysis::getCallsiteInstrumentation(CB); + if (!CSInstr) +return nullptr; + const auto CSIndex = CSInstr->getIndex()->getZExtValue(); mtrofin wrote: Done. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) mtrofin wrote: wdym? https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) mtrofin wrote: oh! I think I understand what you mean. Yes, I think the default should be the most verbose, it's a testing facility. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -57,9 +57,23 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { return Counters[0]; } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void growCounters(uint32_t Size) { +if (Size >= Counters.size()) mtrofin wrote: done https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -572,6 +575,89 @@ CallBase &llvm::promoteCallWithIfThenElse(CallBase &CB, Function *Callee, return promoteCall(NewInst, Callee); } +CallBase *llvm::promoteCallWithIfThenElse(CallBase &CB, Function &Callee, + PGOContextualProfile &CtxProf) { + assert(CB.isIndirectCall()); + if (!CtxProf.isFunctionKnown(Callee)) mtrofin wrote: That seems to belong in the pass that will exercise this, rather. https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
@@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *); mtrofin wrote: done https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 40b481829c2c2d284210cfcc157de796c6cb Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 87 - .../Utils/CallPromotionUtilsTest.cpp | 174 ++ 8 files changed, 361 insertions(+), 34 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAnaly
[llvm-branch-commits] [llvm] [ctx_prof] Add Inlining support (PR #106154)
mtrofin wrote: > [!WARNING] > This pull request is not mergeable via GitHub because a downstack PR is > open. Once all requirements are satisfied, merge this PR as a stack href="https://app.graphite.dev/github/pr/llvm/llvm-project/106154?utm_source=stack-comment-downstack-mergeability-warning"; > >on Graphite. > https://graphite.dev/docs/merge-pull-requests";>Learn more * **#106154** https://app.graphite.dev/github/pr/llvm/llvm-project/106154?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 * **#105469** https://app.graphite.dev/github/pr/llvm/llvm-project/105469?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#106129** https://app.graphite.dev/github/pr/llvm/llvm-project/106129?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * `main` This stack of pull requests is managed by Graphite. https://stacking.dev/?utm_source=stack-comment";>Learn more about stacking. Join @mtrofin and the rest of your teammates on https://graphite.dev?utm-source=stack-comment";>https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="11px" height="11px"/> Graphite https://github.com/llvm/llvm-project/pull/106154 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add Inlining support (PR #106154)
https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/106154 None >From eda80fe012239f907df3ee3c4d6d94c93d9d4df2 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 22 Aug 2024 18:03:56 -0700 Subject: [PATCH] [ctx_prof] Add Inlining support --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 10 + llvm/include/llvm/IR/IntrinsicInst.h | 4 + .../llvm/ProfileData/PGOCtxProfReader.h | 5 + llvm/include/llvm/Transforms/Utils/Cloning.h | 9 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 1 - llvm/lib/Transforms/IPO/ModuleInliner.cpp | 1 + llvm/lib/Transforms/Utils/InlineFunction.cpp | 162 .../unittests/Transforms/Utils/CMakeLists.txt | 1 + .../Transforms/Utils/InlineFunctionTest.cpp | 174 ++ 9 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 llvm/unittests/Transforms/Utils/InlineFunctionTest.cpp diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 10aef6f6067b6f..f630dceb8a644c 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -62,6 +62,16 @@ class PGOContextualProfile { bool isFunctionKnown(const Function &F) const { return getDefinedFunctionGUID(F) != 0; } + + uint32_t getNrCounters(const Function &F) const { +assert(isFunctionKnown(F)); +return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCounterIndex; + } + + uint32_t getNrCallsites(const Function &F) const { +assert(isFunctionKnown(F)); +return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex; + } uint32_t allocateNextCounterIndex(const Function &F) { assert(isFunctionKnown(F)); diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 71a96e0671c2f1..2ebcee422eddfb 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1516,6 +1516,10 @@ class InstrProfInstBase : public IntrinsicInst { return const_cast(getArgOperand(0))->stripPointerCasts(); } + void setNameValue(Value *V) { +setArgOperand(0, V); + } + // The hash of the CFG for the instrumented function. ConstantInt *getHash() const { return cast(const_cast(getArgOperand(1))); diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index f7f88966f7573f..c64e6e79f96c4c 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -74,6 +74,11 @@ class PGOCtxProfContext final { Iter->second.emplace(Other.guid(), std::move(Other)); } + void ingestAllContexts(uint32_t CSId, CallTargetMapTy &&Other) { +auto [_, Inserted] = callsites().try_emplace(CSId, std::move(Other)); +assert(Inserted); + } + void resizeCounters(uint32_t Size) { Counters.resize(Size); } bool hasCallsite(uint32_t I) const { diff --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h index 6226062dd713f6..0b670bfb9ce806 100644 --- a/llvm/include/llvm/Transforms/Utils/Cloning.h +++ b/llvm/include/llvm/Transforms/Utils/Cloning.h @@ -20,6 +20,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Twine.h" #include "llvm/Analysis/AssumptionCache.h" +#include "llvm/Analysis/CtxProfAnalysis.h" #include "llvm/Analysis/InlineCost.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/ValueHandle.h" @@ -270,6 +271,14 @@ InlineResult InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, bool InsertLifetime = true, Function *ForwardVarArgsTo = nullptr); +/// Same as above, but it will update the contextual profile. +InlineResult InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, +CtxProfAnalysis::Result &CtxProf, +bool MergeAttributes = false, +AAResults *CalleeAAR = nullptr, +bool InsertLifetime = true, +Function *ForwardVarArgsTo = nullptr); + /// Clones a loop \p OrigLoop. Returns the loop and the blocks in \p /// Blocks. /// diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index 2cd3f2114397e5..77aefecf3ff18c 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -150,7 +150,6 @@ PGOContextualProfile CtxProfAnalysis::run(Module &M, // If we made it this far, the Result is valid - which we mark by setting // .Profiles. // Trim first the roots that aren't in this module. - DenseSet ProfiledGUIDs; for (auto &[RootGuid, _] : llvm::make_early_inc_range(*MaybeCtx)) if (!Result.FuncInfo.contains(RootGuid)) MaybeCtx->erase(RootGuid); diff --git a/llvm/lib/Transforms/IPO/ModuleInliner.cpp b/llvm/lib/Transforms/IPO/ModuleInliner.cp
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 44201f1b7d371f156a8ae02b329f2321cad503d2 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 174 ++ 8 files changed, 362 insertions(+), 32 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAnaly
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 0ff81a0fb355f31a863ded1ce677b8dad26b3c0f Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 17 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 22 +++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 178 ++ 8 files changed, 366 insertions(+), 32 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..10aef6f6067b6f 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index b45c89cadb0fde..71a96e0671c2f1 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1535,6 +1535,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1585,6 +1586,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *Callee); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..f7f88966f7573f 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,25 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { +assert(!Counters.empty() && + "Functions are expected to have at their entry BB instrumented, so " + "there should always be at least 1 counter."); +return Counters[0]; + } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void resizeCounters(uint32_t Size) { Counters.resize(Size); } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +84,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H +#include "llvm/Analysis/CtxProfAnaly
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin edited https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin edited https://github.com/llvm/llvm-project/pull/105469 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From d58d308957961ae7442a7b5aa0561f42dea69caf Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 18 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 20 ++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 178 ++ 8 files changed, 364 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..d6c2bb26a091af 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into @@ -134,6 +145,5 @@ class AssignGUIDPass : public PassInfoMixin { // This should become GlobalValue::getGUID static uint64_t getGUID(const Function &F); }; - } // namespace llvm #endif // LLVM_ANALYSIS_CTXPROFANALYSIS_H diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 2f1e2c08c3ecec..bab41efab528e2 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1519,6 +1519,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1569,6 +1570,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..23dcc376508b39 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,23 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { return Counters[0]; } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void growCounters(uint32_t Size) { +if (Size >= Counters.size()) + Counters.resize(Size); + } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +82,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #defin
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 0d7c720e67a0213565f0e7c141c4ffa1b91fc5b9 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:09:16 -0700 Subject: [PATCH 1/2] [ctx_prof] API to get the instrumentation of a BB --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 5 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 7 ++ .../Analysis/CtxProfAnalysisTest.cpp | 22 +++ 3 files changed, 34 insertions(+) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 23abcbe2c6e9d2..0b4dd8ae3a0dc7 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -95,7 +95,12 @@ class CtxProfAnalysis : public AnalysisInfoMixin { PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM); + /// Get the instruction instrumenting a callsite, or nullptr if that cannot be + /// found. static InstrProfCallsite *getCallsiteInstrumentation(CallBase &CB); + + /// Get the instruction instrumenting a BB, or nullptr if not present. + static InstrProfIncrementInst *getBBInstrumentation(BasicBlock &BB); }; class CtxProfAnalysisPrinterPass diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index ceebb2cf06d235..3fc1bc34afb97e 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -202,6 +202,13 @@ InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { return nullptr; } +InstrProfIncrementInst *CtxProfAnalysis::getBBInstrumentation(BasicBlock &BB) { + for (auto &I : BB) +if (auto *Incr = dyn_cast(&I)) + return Incr; + return nullptr; +} + static void preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles, function_ref Visitor) { diff --git a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp index 5f9bf3ec540eb3..fbe3a6e45109cc 100644 --- a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp +++ b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp @@ -132,4 +132,26 @@ TEST_F(CtxProfAnalysisTest, GetCallsiteIDNegativeTest) { EXPECT_EQ(IndIns, nullptr); } +TEST_F(CtxProfAnalysisTest, GetBBIDTest) { + ModulePassManager MPM; + MPM.addPass(PGOInstrumentationGen(PGOInstrumentationType::CTXPROF)); + EXPECT_FALSE(MPM.run(*M, MAM).areAllPreserved()); + auto *F = M->getFunction("foo"); + ASSERT_NE(F, nullptr); + std::map BBNameAndID; + + for (auto &BB : *F) { +auto *Ins = CtxProfAnalysis::getBBInstrumentation(BB); +if (Ins) + BBNameAndID[BB.getName().str()] = + static_cast(Ins->getIndex()->getZExtValue()); +else + BBNameAndID[BB.getName().str()] = -1; + } + + EXPECT_THAT(BBNameAndID, + testing::UnorderedElementsAre( + testing::Pair("", 0), testing::Pair("yes", 1), + testing::Pair("no", -1), testing::Pair("exit", -1))); +} } // namespace >From 61e37e3e1657a7e85e9df2f77feb6957c304851a Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH 2/2] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 18 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 20 ++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 178 ++ 8 files changed, 364 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..d6c2bb26a091af 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From d58d308957961ae7442a7b5aa0561f42dea69caf Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 18 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 20 ++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 178 ++ 8 files changed, 364 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..d6c2bb26a091af 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into @@ -134,6 +145,5 @@ class AssignGUIDPass : public PassInfoMixin { // This should become GlobalValue::getGUID static uint64_t getGUID(const Function &F); }; - } // namespace llvm #endif // LLVM_ANALYSIS_CTXPROFANALYSIS_H diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 2f1e2c08c3ecec..bab41efab528e2 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1519,6 +1519,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1569,6 +1570,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..23dcc376508b39 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,23 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { return Counters[0]; } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void growCounters(uint32_t Size) { +if (Size >= Counters.size()) + Counters.resize(Size); + } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +82,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #defin
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From de6d88788d35cfeace3f694008d446e8175421a0 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 18 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 20 ++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 79 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 178 ++ 8 files changed, 364 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..d6c2bb26a091af 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into @@ -134,6 +145,5 @@ class AssignGUIDPass : public PassInfoMixin { // This should become GlobalValue::getGUID static uint64_t getGUID(const Function &F); }; - } // namespace llvm #endif // LLVM_ANALYSIS_CTXPROFANALYSIS_H diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 2f1e2c08c3ecec..bab41efab528e2 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1519,6 +1519,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1569,6 +1570,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..23dcc376508b39 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,23 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { return Counters[0]; } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void growCounters(uint32_t Size) { +if (Size >= Counters.size()) + Counters.resize(Size); + } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +82,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #defin
[llvm-branch-commits] [llvm] [ctx_prof] API to get the instrumentation of a BB (PR #105468)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105468 >From f81d31c3311690826bdc1f5c83fc45b4864de035 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:09:16 -0700 Subject: [PATCH] [ctx_prof] API to get the instrumentation of a BB --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 5 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 7 ++ .../Analysis/CtxProfAnalysisTest.cpp | 22 +++ 3 files changed, 34 insertions(+) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 23abcbe2c6e9d2..0b4dd8ae3a0dc7 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -95,7 +95,12 @@ class CtxProfAnalysis : public AnalysisInfoMixin { PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM); + /// Get the instruction instrumenting a callsite, or nullptr if that cannot be + /// found. static InstrProfCallsite *getCallsiteInstrumentation(CallBase &CB); + + /// Get the instruction instrumenting a BB, or nullptr if not present. + static InstrProfIncrementInst *getBBInstrumentation(BasicBlock &BB); }; class CtxProfAnalysisPrinterPass diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index ceebb2cf06d235..3fc1bc34afb97e 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -202,6 +202,13 @@ InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { return nullptr; } +InstrProfIncrementInst *CtxProfAnalysis::getBBInstrumentation(BasicBlock &BB) { + for (auto &I : BB) +if (auto *Incr = dyn_cast(&I)) + return Incr; + return nullptr; +} + static void preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles, function_ref Visitor) { diff --git a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp index 5f9bf3ec540eb3..fbe3a6e45109cc 100644 --- a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp +++ b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp @@ -132,4 +132,26 @@ TEST_F(CtxProfAnalysisTest, GetCallsiteIDNegativeTest) { EXPECT_EQ(IndIns, nullptr); } +TEST_F(CtxProfAnalysisTest, GetBBIDTest) { + ModulePassManager MPM; + MPM.addPass(PGOInstrumentationGen(PGOInstrumentationType::CTXPROF)); + EXPECT_FALSE(MPM.run(*M, MAM).areAllPreserved()); + auto *F = M->getFunction("foo"); + ASSERT_NE(F, nullptr); + std::map BBNameAndID; + + for (auto &BB : *F) { +auto *Ins = CtxProfAnalysis::getBBInstrumentation(BB); +if (Ins) + BBNameAndID[BB.getName().str()] = + static_cast(Ins->getIndex()->getZExtValue()); +else + BBNameAndID[BB.getName().str()] = -1; + } + + EXPECT_THAT(BBNameAndID, + testing::UnorderedElementsAre( + testing::Pair("", 0), testing::Pair("yes", 1), + testing::Pair("no", -1), testing::Pair("exit", -1))); +} } // namespace ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105469 >From 1edbc3bed4cf6c2726394a346891409d5f548537 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:32:23 -0700 Subject: [PATCH] [ctx_prof] Add support for ICP --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 18 +- llvm/include/llvm/IR/IntrinsicInst.h | 2 + .../llvm/ProfileData/PGOCtxProfReader.h | 20 ++ .../Transforms/Utils/CallPromotionUtils.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 80 +--- llvm/lib/IR/IntrinsicInst.cpp | 10 + .../Transforms/Utils/CallPromotionUtils.cpp | 86 + .../Utils/CallPromotionUtilsTest.cpp | 178 ++ 8 files changed, 365 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 0b4dd8ae3a0dc7..d6c2bb26a091af 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -73,6 +73,12 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + using ConstVisitor = function_ref; + using Visitor = function_ref; + + void update(Visitor, const Function *F = nullptr); + void visit(ConstVisitor, const Function *F = nullptr) const; + const CtxProfFlatProfile flatten() const; bool invalidate(Module &, const PreservedAnalyses &PA, @@ -105,13 +111,18 @@ class CtxProfAnalysis : public AnalysisInfoMixin { class CtxProfAnalysisPrinterPass : public PassInfoMixin { - raw_ostream &OS; - public: - explicit CtxProfAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + enum class PrintMode { Everything, JSON }; + explicit CtxProfAnalysisPrinterPass(raw_ostream &OS, + PrintMode Mode = PrintMode::Everything) + : OS(OS), Mode(Mode) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } + +private: + raw_ostream &OS; + const PrintMode Mode; }; /// Assign a GUID to functions as metadata. GUID calculation takes linkage into @@ -134,6 +145,5 @@ class AssignGUIDPass : public PassInfoMixin { // This should become GlobalValue::getGUID static uint64_t getGUID(const Function &F); }; - } // namespace llvm #endif // LLVM_ANALYSIS_CTXPROFANALYSIS_H diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 2f1e2c08c3ecec..bab41efab528e2 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -1519,6 +1519,7 @@ class InstrProfCntrInstBase : public InstrProfInstBase { ConstantInt *getNumCounters() const; // The index of the counter that this instruction acts on. ConstantInt *getIndex() const; + void setIndex(uint32_t Idx); }; /// This represents the llvm.instrprof.cover intrinsic. @@ -1569,6 +1570,7 @@ class InstrProfCallsite : public InstrProfCntrInstBase { return isa(V) && classof(cast(V)); } Value *getCallee() const; + void setCallee(Value *); }; /// This represents the llvm.instrprof.timestamp intrinsic. diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h index 190deaeeacd085..23dcc376508b39 100644 --- a/llvm/include/llvm/ProfileData/PGOCtxProfReader.h +++ b/llvm/include/llvm/ProfileData/PGOCtxProfReader.h @@ -57,9 +57,23 @@ class PGOCtxProfContext final { GlobalValue::GUID guid() const { return GUID; } const SmallVectorImpl &counters() const { return Counters; } + SmallVectorImpl &counters() { return Counters; } + + uint64_t getEntrycount() const { return Counters[0]; } + const CallsiteMapTy &callsites() const { return Callsites; } CallsiteMapTy &callsites() { return Callsites; } + void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) { +auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy()); +Iter->second.emplace(Other.guid(), std::move(Other)); + } + + void growCounters(uint32_t Size) { +if (Size >= Counters.size()) + Counters.resize(Size); + } + bool hasCallsite(uint32_t I) const { return Callsites.find(I) != Callsites.end(); } @@ -68,6 +82,12 @@ class PGOCtxProfContext final { assert(hasCallsite(I) && "Callsite not found"); return Callsites.find(I)->second; } + + CallTargetMapTy &callsite(uint32_t I) { +assert(hasCallsite(I) && "Callsite not found"); +return Callsites.find(I)->second; + } + void getContainedGuids(DenseSet &Guids) const; }; diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h index 385831f457038d..58af26f31417b0 100644 --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,6 +14,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #defin
[llvm-branch-commits] [llvm] [ctx_prof] API to get the instrumentation of a BB (PR #105468)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/105468 >From c5ee379ec43215d8268219ec3cfced3f7f730fc8 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 20 Aug 2024 21:09:16 -0700 Subject: [PATCH] [ctx_prof] API to get the instrumentation of a BB --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 5 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 7 ++ .../Analysis/CtxProfAnalysisTest.cpp | 22 +++ 3 files changed, 34 insertions(+) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 23abcbe2c6e9d2..0b4dd8ae3a0dc7 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -95,7 +95,12 @@ class CtxProfAnalysis : public AnalysisInfoMixin { PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM); + /// Get the instruction instrumenting a callsite, or nullptr if that cannot be + /// found. static InstrProfCallsite *getCallsiteInstrumentation(CallBase &CB); + + /// Get the instruction instrumenting a BB, or nullptr if not present. + static InstrProfIncrementInst *getBBInstrumentation(BasicBlock &BB); }; class CtxProfAnalysisPrinterPass diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index fffc8de2b36c8e..46daa4a4506189 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -202,6 +202,13 @@ InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { return nullptr; } +InstrProfIncrementInst *CtxProfAnalysis::getBBInstrumentation(BasicBlock &BB) { + for (auto &I : BB) +if (auto *Incr = dyn_cast(&I)) + return Incr; + return nullptr; +} + static void preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles, function_ref Visitor) { diff --git a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp index 5f9bf3ec540eb3..fbe3a6e45109cc 100644 --- a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp +++ b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp @@ -132,4 +132,26 @@ TEST_F(CtxProfAnalysisTest, GetCallsiteIDNegativeTest) { EXPECT_EQ(IndIns, nullptr); } +TEST_F(CtxProfAnalysisTest, GetBBIDTest) { + ModulePassManager MPM; + MPM.addPass(PGOInstrumentationGen(PGOInstrumentationType::CTXPROF)); + EXPECT_FALSE(MPM.run(*M, MAM).areAllPreserved()); + auto *F = M->getFunction("foo"); + ASSERT_NE(F, nullptr); + std::map BBNameAndID; + + for (auto &BB : *F) { +auto *Ins = CtxProfAnalysis::getBBInstrumentation(BB); +if (Ins) + BBNameAndID[BB.getName().str()] = + static_cast(Ins->getIndex()->getZExtValue()); +else + BBNameAndID[BB.getName().str()] = -1; + } + + EXPECT_THAT(BBNameAndID, + testing::UnorderedElementsAre( + testing::Pair("", 0), testing::Pair("yes", 1), + testing::Pair("no", -1), testing::Pair("exit", -1))); +} } // namespace ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Profile flatterner (PR #104539)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/104539 >From c0eb05f775a88fdf343d52b7af7fcc5eb4b2497e Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 15 Aug 2024 19:03:30 -0700 Subject: [PATCH] [ctx_prof] Profile flatterner --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 7 ++ llvm/lib/Analysis/CtxProfAnalysis.cpp | 40 .../Analysis/CtxProfAnalysis/full-cycle.ll| 65 ++- llvm/test/Analysis/CtxProfAnalysis/load.ll| 5 ++ 4 files changed, 114 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 43587d953fc4ca..f9c204ea8d7744 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -9,6 +9,8 @@ #ifndef LLVM_ANALYSIS_CTXPROFANALYSIS_H #define LLVM_ANALYSIS_CTXPROFANALYSIS_H +#include "llvm/ADT/DenseMap.h" +#include "llvm/IR/GlobalValue.h" #include "llvm/IR/InstrTypes.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/PassManager.h" @@ -18,6 +20,9 @@ namespace llvm { class CtxProfAnalysis; +using CtxProfFlatProfile = +DenseMap>; + /// The instrumented contextual profile, produced by the CtxProfAnalysis. class PGOContextualProfile { friend class CtxProfAnalysis; @@ -65,6 +70,8 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + const CtxProfFlatProfile flatten() const; + bool invalidate(Module &, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &) { // Check whether the analysis has been explicitly invalidated. Otherwise, diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index 51663196b13070..837ffc43a30235 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -184,6 +184,14 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M, OS << "\nCurrent Profile:\n"; OS << formatv("{0:2}", JSONed); OS << "\n"; + OS << "\nFlat Profile:\n"; + auto Flat = C.flatten(); + for (const auto &[Guid, Counters] : Flat) { +OS << Guid << " : "; +for (auto V : Counters) + OS << V << " "; +OS << "\n"; + } return PreservedAnalyses::all(); } @@ -193,3 +201,35 @@ InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { return IPC; return nullptr; } + +static void +preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles, + function_ref Visitor) { + std::function Traverser = + [&](const auto &Ctx) { +Visitor(Ctx); +for (const auto &[_, SubCtxSet] : Ctx.callsites()) + for (const auto &[__, Subctx] : SubCtxSet) +Traverser(Subctx); + }; + for (const auto &[_, P] : Profiles) +Traverser(P); +} + +const CtxProfFlatProfile PGOContextualProfile::flatten() const { + assert(Profiles.has_value()); + CtxProfFlatProfile Flat; + preorderVisit(*Profiles, [&](const PGOCtxProfContext &Ctx) { +auto [It, Ins] = Flat.insert({Ctx.guid(), {}}); +if (Ins) { + llvm::append_range(It->second, Ctx.counters()); +} else { + assert(It->second.size() == Ctx.counters().size() && + "All contexts corresponding to a function should have the exact " + "same nr of counters."); + for (size_t I = 0, E = It->second.size(); I < E; ++I) +It->second[I] += Ctx.counters()[I]; +} + }); + return Flat; +} diff --git a/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll b/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll index 0cdf82bd96efcb..06ba8b3542f7d5 100644 --- a/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll +++ b/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll @@ -4,6 +4,9 @@ ; RUN: split-file %s %t ; ; Test that the GUID metadata survives through thinlink. +; Also test that the flattener works correctly. f2 is called in 2 places, with +; different counter values, and we expect resulting flat profile to be the sum +; (of values at the same index). ; ; RUN: llvm-ctxprof-util fromJSON --input=%t/profile.json --output=%t/profile.ctxprofdata ; @@ -17,7 +20,9 @@ ; RUN: llvm-lto2 run %t/m1.bc %t/m2.bc -o %t/ -thinlto-distributed-indexes \ ; RUN: -use-ctx-profile=%t/profile.ctxprofdata \ ; RUN: -r %t/m1.bc,f1,plx \ +; RUN: -r %t/m1.bc,f3,plx \ ; RUN: -r %t/m2.bc,f1 \ +; RUN: -r %t/m2.bc,f3 \ ; RUN: -r %t/m2.bc,entrypoint,plx ; RUN: opt --passes='function-import,require,print' \ ; RUN: -summary-file=%t/m2.bc.thinlto.bc -use-ctx-profile=%t/profile.ctxprofdata %t/m2.bc \ @@ -38,6 +43,11 @@ define void @f1() #0 { ret void } +define void @f3() #0 { + call void @f2() + ret void +} + attributes #0 = { noinline } !0 = !{ i64 3087265239403591524 } @@ -48,9 +58,11 @@ target triple = "x86_64-pc-linux-gnu" source_filename = "random_path/m2.cc" declare void @f1() +declare void @f3()
[llvm-branch-commits] [llvm] [ctx_prof] Profile flatterner (PR #104539)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/104539 >From dfbb9803ce352441cd14f250b4d29c603d727e1b Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 15 Aug 2024 19:03:30 -0700 Subject: [PATCH] [ctx_prof] Profile flatterner --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 7 ++ llvm/lib/Analysis/CtxProfAnalysis.cpp | 40 .../Analysis/CtxProfAnalysis/full-cycle.ll| 65 ++- llvm/test/Analysis/CtxProfAnalysis/load.ll| 5 ++ 4 files changed, 114 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index 43587d953fc4ca..f9c204ea8d7744 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -9,6 +9,8 @@ #ifndef LLVM_ANALYSIS_CTXPROFANALYSIS_H #define LLVM_ANALYSIS_CTXPROFANALYSIS_H +#include "llvm/ADT/DenseMap.h" +#include "llvm/IR/GlobalValue.h" #include "llvm/IR/InstrTypes.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/PassManager.h" @@ -18,6 +20,9 @@ namespace llvm { class CtxProfAnalysis; +using CtxProfFlatProfile = +DenseMap>; + /// The instrumented contextual profile, produced by the CtxProfAnalysis. class PGOContextualProfile { friend class CtxProfAnalysis; @@ -65,6 +70,8 @@ class PGOContextualProfile { return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCallsiteIndex++; } + const CtxProfFlatProfile flatten() const; + bool invalidate(Module &, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &) { // Check whether the analysis has been explicitly invalidated. Otherwise, diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index 51663196b13070..837ffc43a30235 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -184,6 +184,14 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M, OS << "\nCurrent Profile:\n"; OS << formatv("{0:2}", JSONed); OS << "\n"; + OS << "\nFlat Profile:\n"; + auto Flat = C.flatten(); + for (const auto &[Guid, Counters] : Flat) { +OS << Guid << " : "; +for (auto V : Counters) + OS << V << " "; +OS << "\n"; + } return PreservedAnalyses::all(); } @@ -193,3 +201,35 @@ InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { return IPC; return nullptr; } + +static void +preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles, + function_ref Visitor) { + std::function Traverser = + [&](const auto &Ctx) { +Visitor(Ctx); +for (const auto &[_, SubCtxSet] : Ctx.callsites()) + for (const auto &[__, Subctx] : SubCtxSet) +Traverser(Subctx); + }; + for (const auto &[_, P] : Profiles) +Traverser(P); +} + +const CtxProfFlatProfile PGOContextualProfile::flatten() const { + assert(Profiles.has_value()); + CtxProfFlatProfile Flat; + preorderVisit(*Profiles, [&](const PGOCtxProfContext &Ctx) { +auto [It, Ins] = Flat.insert({Ctx.guid(), {}}); +if (Ins) { + llvm::append_range(It->second, Ctx.counters()); +} else { + assert(It->second.size() == Ctx.counters().size() && + "All contexts corresponding to a function should have the exact " + "same nr of counters."); + for (size_t I = 0, E = It->second.size(); I < E; ++I) +It->second[I] += Ctx.counters()[I]; +} + }); + return Flat; +} diff --git a/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll b/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll index 0cdf82bd96efcb..06ba8b3542f7d5 100644 --- a/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll +++ b/llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll @@ -4,6 +4,9 @@ ; RUN: split-file %s %t ; ; Test that the GUID metadata survives through thinlink. +; Also test that the flattener works correctly. f2 is called in 2 places, with +; different counter values, and we expect resulting flat profile to be the sum +; (of values at the same index). ; ; RUN: llvm-ctxprof-util fromJSON --input=%t/profile.json --output=%t/profile.ctxprofdata ; @@ -17,7 +20,9 @@ ; RUN: llvm-lto2 run %t/m1.bc %t/m2.bc -o %t/ -thinlto-distributed-indexes \ ; RUN: -use-ctx-profile=%t/profile.ctxprofdata \ ; RUN: -r %t/m1.bc,f1,plx \ +; RUN: -r %t/m1.bc,f3,plx \ ; RUN: -r %t/m2.bc,f1 \ +; RUN: -r %t/m2.bc,f3 \ ; RUN: -r %t/m2.bc,entrypoint,plx ; RUN: opt --passes='function-import,require,print' \ ; RUN: -summary-file=%t/m2.bc.thinlto.bc -use-ctx-profile=%t/profile.ctxprofdata %t/m2.bc \ @@ -38,6 +43,11 @@ define void @f1() #0 { ret void } +define void @f3() #0 { + call void @f2() + ret void +} + attributes #0 = { noinline } !0 = !{ i64 3087265239403591524 } @@ -48,9 +58,11 @@ target triple = "x86_64-pc-linux-gnu" source_filename = "random_path/m2.cc" declare void @f1() +declare void @f3()
[llvm-branch-commits] [llvm] [ctx_prof] Profile flatterner (PR #104539)
https://github.com/mtrofin edited https://github.com/llvm/llvm-project/pull/104539 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add analysis utility to fetch ID of a callsite (PR #104491)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/104491 >From c21867b07c677f46f7e0ea801b38acea8eccf6fc Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 15 Aug 2024 10:28:04 -0700 Subject: [PATCH] [ctx_prof] Add analysis utility to fetch ID of a callsite --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 7 + llvm/unittests/Analysis/CMakeLists.txt| 1 + .../Analysis/CtxProfAnalysisTest.cpp | 145 ++ 4 files changed, 157 insertions(+) create mode 100644 llvm/unittests/Analysis/CtxProfAnalysisTest.cpp diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index d0fb99fe1966a6..25a469bb428b99 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -11,6 +11,8 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/IR/GlobalValue.h" +#include "llvm/IR/InstrTypes.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/PassManager.h" #include "llvm/ProfileData/PGOCtxProfReader.h" @@ -84,6 +86,8 @@ class CtxProfAnalysis : public AnalysisInfoMixin { using Result = PGOContextualProfile; PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM); + + static InstrProfCallsite *getCallsiteInstrumentation(CallBase &CB); }; class CtxProfAnalysisPrinterPass diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index d0ccf4ba537f84..51663196b13070 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -186,3 +186,10 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M, OS << "\n"; return PreservedAnalyses::all(); } + +InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { + while (auto *Prev = CB.getPrevNode()) +if (auto *IPC = dyn_cast(Prev)) + return IPC; + return nullptr; +} diff --git a/llvm/unittests/Analysis/CMakeLists.txt b/llvm/unittests/Analysis/CMakeLists.txt index 3cba630867a83b..958d8f9a72fd66 100644 --- a/llvm/unittests/Analysis/CMakeLists.txt +++ b/llvm/unittests/Analysis/CMakeLists.txt @@ -22,6 +22,7 @@ set(ANALYSIS_TEST_SOURCES CFGTest.cpp CGSCCPassManagerTest.cpp ConstraintSystemTest.cpp + CtxProfAnalysisTest.cpp DDGTest.cpp DomTreeUpdaterTest.cpp DXILResourceTest.cpp diff --git a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp new file mode 100644 index 00..8f57b828bf5a15 --- /dev/null +++ b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp @@ -0,0 +1,145 @@ +//===--- CtxProfAnalysisTest.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/BlockFrequencyInfo.h" +#include "llvm/Analysis/BranchProbabilityInfo.h" +#include "llvm/Analysis/CGSCCPassManager.h" +#include "llvm/Analysis/LoopAnalysisManager.h" +#include "llvm/Analysis/TargetLibraryInfo.h" +#include "llvm/AsmParser/Parser.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassInstrumentation.h" +#include "llvm/IR/PassManager.h" +#include "llvm/Passes/PassBuilder.h" +#include "llvm/Support/SourceMgr.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +class CtxProfAnalysisTest : public testing::Test { + static constexpr auto *IR = R"IR( +declare void @bar() + +define private void @foo(i32 %a, ptr %fct) #0 !guid !0 { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no +yes: + call void %fct(i32 %a) + br label %exit +no: + call void @bar() + br label %exit +exit: + ret void +} + +define void @an_entrypoint(i32 %a) { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no + +yes: + call void @foo(i32 1, ptr null) + ret void +no: + ret void +} + +define void @another_entrypoint_no_callees(i32 %a) { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no + +yes: + ret void +no: + ret void +} + +attributes #0 = { noinline } +!0 = !{ i64 11872291593386833696 } +)IR"; + +protected: + LLVMContext C; + PassBuilder PB; + ModuleAnalysisManager MAM; + FunctionAnalysisManager FAM; + CGSCCAnalysisManager CGAM; + LoopAnalysisManager LAM; + std::unique_ptr M; + + void SetUp() override { +SMDiagnostic Err; +M = parseAssemblyString(IR, Err, C); +if (!M) + Err.print("CtxProfAnalysisTest", errs()); + } + +public: + CtxProfAnalysisTest() { +PB.registerModuleAnalyses(MAM); +PB.registerCGSCCAnalyses(CGAM); +PB.registerFunctionAnalyses(FAM); +PB.registerLoopAna
[llvm-branch-commits] [llvm] [ctx_prof] Add analysis utility to fetch ID of a callsite (PR #104491)
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/104491 >From 505149ba03c189a95f415ef1199627020a740e7a Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 15 Aug 2024 10:28:04 -0700 Subject: [PATCH] [ctx_prof] Add analysis utility to fetch ID of a callsite --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 7 + llvm/unittests/Analysis/CMakeLists.txt| 1 + .../Analysis/CtxProfAnalysisTest.cpp | 145 ++ 4 files changed, 157 insertions(+) create mode 100644 llvm/unittests/Analysis/CtxProfAnalysisTest.cpp diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index f0e2aeb0f92f74..483a6e557126e0 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -11,6 +11,8 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/IR/GlobalValue.h" +#include "llvm/IR/InstrTypes.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/PassManager.h" #include "llvm/ProfileData/PGOCtxProfReader.h" @@ -84,6 +86,8 @@ class CtxProfAnalysis : public AnalysisInfoMixin { using Result = PGOContextualProfile; PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM); + + static InstrProfCallsite *getCallsiteInstrumentation(CallBase &CB); }; class CtxProfAnalysisPrinterPass diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index 7b4666b29a1936..3e4c1f8c3df3c0 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -183,3 +183,10 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M, OS << "\n"; return PreservedAnalyses::all(); } + +InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { + while (auto *Prev = CB.getPrevNode()) +if (auto *IPC = dyn_cast(Prev)) + return IPC; + return nullptr; +} diff --git a/llvm/unittests/Analysis/CMakeLists.txt b/llvm/unittests/Analysis/CMakeLists.txt index 3cba630867a83b..958d8f9a72fd66 100644 --- a/llvm/unittests/Analysis/CMakeLists.txt +++ b/llvm/unittests/Analysis/CMakeLists.txt @@ -22,6 +22,7 @@ set(ANALYSIS_TEST_SOURCES CFGTest.cpp CGSCCPassManagerTest.cpp ConstraintSystemTest.cpp + CtxProfAnalysisTest.cpp DDGTest.cpp DomTreeUpdaterTest.cpp DXILResourceTest.cpp diff --git a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp new file mode 100644 index 00..8f57b828bf5a15 --- /dev/null +++ b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp @@ -0,0 +1,145 @@ +//===--- CtxProfAnalysisTest.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/BlockFrequencyInfo.h" +#include "llvm/Analysis/BranchProbabilityInfo.h" +#include "llvm/Analysis/CGSCCPassManager.h" +#include "llvm/Analysis/LoopAnalysisManager.h" +#include "llvm/Analysis/TargetLibraryInfo.h" +#include "llvm/AsmParser/Parser.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassInstrumentation.h" +#include "llvm/IR/PassManager.h" +#include "llvm/Passes/PassBuilder.h" +#include "llvm/Support/SourceMgr.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +class CtxProfAnalysisTest : public testing::Test { + static constexpr auto *IR = R"IR( +declare void @bar() + +define private void @foo(i32 %a, ptr %fct) #0 !guid !0 { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no +yes: + call void %fct(i32 %a) + br label %exit +no: + call void @bar() + br label %exit +exit: + ret void +} + +define void @an_entrypoint(i32 %a) { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no + +yes: + call void @foo(i32 1, ptr null) + ret void +no: + ret void +} + +define void @another_entrypoint_no_callees(i32 %a) { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no + +yes: + ret void +no: + ret void +} + +attributes #0 = { noinline } +!0 = !{ i64 11872291593386833696 } +)IR"; + +protected: + LLVMContext C; + PassBuilder PB; + ModuleAnalysisManager MAM; + FunctionAnalysisManager FAM; + CGSCCAnalysisManager CGAM; + LoopAnalysisManager LAM; + std::unique_ptr M; + + void SetUp() override { +SMDiagnostic Err; +M = parseAssemblyString(IR, Err, C); +if (!M) + Err.print("CtxProfAnalysisTest", errs()); + } + +public: + CtxProfAnalysisTest() { +PB.registerModuleAnalyses(MAM); +PB.registerCGSCCAnalyses(CGAM); +PB.registerFunctionAnalyses(FAM); +PB.registerLoopAna
[llvm-branch-commits] [llvm] [ctx_prof] Add analysis utility to fetch ID of a callsite (PR #104491)
https://github.com/mtrofin edited https://github.com/llvm/llvm-project/pull/104491 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add analysis utility to fetch ID of a callsite (PR #104491)
https://github.com/mtrofin ready_for_review https://github.com/llvm/llvm-project/pull/104491 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add analysis utility to fetch ID of a callsite (PR #104491)
mtrofin wrote: > [!WARNING] > This pull request is not mergeable via GitHub because a downstack PR is > open. Once all requirements are satisfied, merge this PR as a stack href="https://app.graphite.dev/github/pr/llvm/llvm-project/104491?utm_source=stack-comment-downstack-mergeability-warning"; > >on Graphite. > https://graphite.dev/docs/merge-pull-requests";>Learn more * **#104491** https://app.graphite.dev/github/pr/llvm/llvm-project/104491?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 * **#104490** https://app.graphite.dev/github/pr/llvm/llvm-project/104490?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * `main` This stack of pull requests is managed by Graphite. https://stacking.dev/?utm_source=stack-comment";>Learn more about stacking. Join @mtrofin and the rest of your teammates on https://graphite.dev?utm-source=stack-comment";>https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="11px" height="11px"/> Graphite https://github.com/llvm/llvm-project/pull/104491 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [ctx_prof] Add analysis utility to fetch ID of a callsite (PR #104491)
https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/104491 None >From e0cb0c4b74d0f5fb695d80973b366399ed6dda2b Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 15 Aug 2024 10:28:04 -0700 Subject: [PATCH] [ctx_prof] Add analysis utility to fetch ID of a callsite --- llvm/include/llvm/Analysis/CtxProfAnalysis.h | 4 + llvm/lib/Analysis/CtxProfAnalysis.cpp | 7 + llvm/unittests/Analysis/CMakeLists.txt| 1 + .../Analysis/CtxProfAnalysisTest.cpp | 145 ++ 4 files changed, 157 insertions(+) create mode 100644 llvm/unittests/Analysis/CtxProfAnalysisTest.cpp diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h index f0e2aeb0f92f74..483a6e557126e0 100644 --- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h +++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h @@ -11,6 +11,8 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/IR/GlobalValue.h" +#include "llvm/IR/InstrTypes.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/PassManager.h" #include "llvm/ProfileData/PGOCtxProfReader.h" @@ -84,6 +86,8 @@ class CtxProfAnalysis : public AnalysisInfoMixin { using Result = PGOContextualProfile; PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM); + + static InstrProfCallsite *getCallsiteInstrumentation(CallBase &CB); }; class CtxProfAnalysisPrinterPass diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index 7b4666b29a1936..3e4c1f8c3df3c0 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -183,3 +183,10 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M, OS << "\n"; return PreservedAnalyses::all(); } + +InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { + while (auto *Prev = CB.getPrevNode()) +if (auto *IPC = dyn_cast(Prev)) + return IPC; + return nullptr; +} diff --git a/llvm/unittests/Analysis/CMakeLists.txt b/llvm/unittests/Analysis/CMakeLists.txt index 3cba630867a83b..958d8f9a72fd66 100644 --- a/llvm/unittests/Analysis/CMakeLists.txt +++ b/llvm/unittests/Analysis/CMakeLists.txt @@ -22,6 +22,7 @@ set(ANALYSIS_TEST_SOURCES CFGTest.cpp CGSCCPassManagerTest.cpp ConstraintSystemTest.cpp + CtxProfAnalysisTest.cpp DDGTest.cpp DomTreeUpdaterTest.cpp DXILResourceTest.cpp diff --git a/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp new file mode 100644 index 00..8f57b828bf5a15 --- /dev/null +++ b/llvm/unittests/Analysis/CtxProfAnalysisTest.cpp @@ -0,0 +1,145 @@ +//===--- CtxProfAnalysisTest.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "llvm/Analysis/CtxProfAnalysis.h" +#include "llvm/Analysis/BlockFrequencyInfo.h" +#include "llvm/Analysis/BranchProbabilityInfo.h" +#include "llvm/Analysis/CGSCCPassManager.h" +#include "llvm/Analysis/LoopAnalysisManager.h" +#include "llvm/Analysis/TargetLibraryInfo.h" +#include "llvm/AsmParser/Parser.h" +#include "llvm/IR/Analysis.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/PassInstrumentation.h" +#include "llvm/IR/PassManager.h" +#include "llvm/Passes/PassBuilder.h" +#include "llvm/Support/SourceMgr.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +class CtxProfAnalysisTest : public testing::Test { + static constexpr auto *IR = R"IR( +declare void @bar() + +define private void @foo(i32 %a, ptr %fct) #0 !guid !0 { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no +yes: + call void %fct(i32 %a) + br label %exit +no: + call void @bar() + br label %exit +exit: + ret void +} + +define void @an_entrypoint(i32 %a) { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no + +yes: + call void @foo(i32 1, ptr null) + ret void +no: + ret void +} + +define void @another_entrypoint_no_callees(i32 %a) { + %t = icmp eq i32 %a, 0 + br i1 %t, label %yes, label %no + +yes: + ret void +no: + ret void +} + +attributes #0 = { noinline } +!0 = !{ i64 11872291593386833696 } +)IR"; + +protected: + LLVMContext C; + PassBuilder PB; + ModuleAnalysisManager MAM; + FunctionAnalysisManager FAM; + CGSCCAnalysisManager CGAM; + LoopAnalysisManager LAM; + std::unique_ptr M; + + void SetUp() override { +SMDiagnostic Err; +M = parseAssemblyString(IR, Err, C); +if (!M) + Err.print("CtxProfAnalysisTest", errs()); + } + +public: + CtxProfAnalysisTest() { +PB.registerModuleAnalyses(MAM); +PB.registerCGSCCAnalyses(CGAM); +PB.registerFunctionAnalyses(FAM); +PB.registerL
[llvm-branch-commits] [llvm] [MLGO] Remove absl dependency from scripts (PR #78880)
https://github.com/mtrofin edited https://github.com/llvm/llvm-project/pull/78880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [MLGO] Remove absl dependency from scripts (PR #78880)
https://github.com/mtrofin approved this pull request. LGTM, some nits https://github.com/llvm/llvm-project/pull/78880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [MLGO] Remove absl dependency from scripts (PR #78880)
@@ -156,10 +88,86 @@ def main(argv): ) -def entrypoint(): -multiprocessing.set_start_method("fork") -app.run(main) - - if __name__ == "__main__": -entrypoint() +parser = argparse.ArgumentParser( mtrofin wrote: nit: could you factor all this in a function and put it at the top - this would be consistent to where folks tend to look for module-defined flags. https://github.com/llvm/llvm-project/pull/78880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [MLGO] Remove absl dependency from scripts (PR #78880)
@@ -12,43 +12,38 @@ --default_args="" """ -from absl import app -from absl import flags -from absl import logging +import logging +import argparse mtrofin wrote: can the imports be in alphabetical order, or does `black` not do that for us? https://github.com/llvm/llvm-project/pull/78880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] c042aff - [NFC] Disallow unused prefixes under llvm/test
Author: Mircea Trofin Date: 2021-01-21T20:31:52-08:00 New Revision: c042aff8860df3cad2b274bf0a495e83ae36ddee URL: https://github.com/llvm/llvm-project/commit/c042aff8860df3cad2b274bf0a495e83ae36ddee DIFF: https://github.com/llvm/llvm-project/commit/c042aff8860df3cad2b274bf0a495e83ae36ddee.diff LOG: [NFC] Disallow unused prefixes under llvm/test This patch sets the default for llvm tests, with the exception of tests under Reduce, because quite a few of them use 'FileCheck' as parameter to a tool, and including a flag as that parameter would complicate matters. The rest of the patch undo-es the lit.local.cfg changes we progressively introduced as temporary measure to avoid regressions under various directories. Differential Revision: https://reviews.llvm.org/D95111 Added: llvm/test/Reduce/lit.local.cfg Modified: llvm/test/FileCheck/lit.local.cfg llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll llvm/test/Instrumentation/HWAddressSanitizer/basic.ll llvm/test/Instrumentation/HWAddressSanitizer/prologue.ll llvm/test/Instrumentation/MemorySanitizer/array_types.ll llvm/test/Instrumentation/MemorySanitizer/check-array.ll llvm/test/Instrumentation/MemorySanitizer/check-struct.ll llvm/test/Instrumentation/MemorySanitizer/freeze.ll llvm/test/Instrumentation/MemorySanitizer/msan_asm_conservative.ll llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll llvm/test/Instrumentation/MemorySanitizer/msan_x86_bts_asm.ll llvm/test/Instrumentation/MemorySanitizer/reduce.ll llvm/test/MC/AArch64/lit.local.cfg llvm/test/MC/AMDGPU/lit.local.cfg llvm/test/MC/ARM/lit.local.cfg llvm/test/MC/RISCV/lit.local.cfg llvm/test/lit.cfg.py Removed: llvm/test/Analysis/lit.local.cfg llvm/test/CodeGen/lit.local.cfg llvm/test/Other/lit.local.cfg llvm/test/Transforms/lit.local.cfg diff --git a/llvm/test/Analysis/lit.local.cfg b/llvm/test/Analysis/lit.local.cfg deleted file mode 100644 index 07c3132153e7.. --- a/llvm/test/Analysis/lit.local.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: -from lit.llvm.subst import ToolSubst - -fc = ToolSubst('FileCheck', unresolved='fatal') -# Insert this first. Then, we'll first update the blank FileCheck command; then, -# the default substitution of FileCheck will replace it to its full path. -config.substitutions.insert(0, (fc.regex, -'FileCheck --allow-unused-prefixes=false')) - diff --git a/llvm/test/CodeGen/lit.local.cfg b/llvm/test/CodeGen/lit.local.cfg deleted file mode 100644 index 2499077fdcd7.. --- a/llvm/test/CodeGen/lit.local.cfg +++ /dev/null @@ -1,7 +0,0 @@ -from lit.llvm.subst import ToolSubst - -fc = ToolSubst('FileCheck', unresolved='fatal') -# Insert this first. Then, we'll first update the blank FileCheck command; then, -# the default substitution of FileCheck will replace it to its full path. -config.substitutions.insert(0, (fc.regex, -'FileCheck --allow-unused-prefixes=false')) diff --git a/llvm/test/FileCheck/lit.local.cfg b/llvm/test/FileCheck/lit.local.cfg index 9164f683fc1b..74e4d89e416b 100644 --- a/llvm/test/FileCheck/lit.local.cfg +++ b/llvm/test/FileCheck/lit.local.cfg @@ -54,3 +54,12 @@ config.test_format = lit.formats.ShTest(execute_external=False) # that test results throughout all test suites are affected. config.substitutions.append(('%ProtectFileCheckOutput', 'env -u FILECHECK_OPTS')) + +# FIXME: remove this once the default is flipped. +from lit.llvm.subst import ToolSubst + +fc = ToolSubst('FileCheck', unresolved='fatal') +# the parent introduced the opposite rule, so we replace it if we see it. +if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'): +del config.substitutions[0] + diff --git a/llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll b/llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll index f5b9e4c2408d..e8a8d8e1dfa0 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll @@ -1,9 +1,9 @@ -; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s -; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s -; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s -; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s -; RUN: opt < %s -asan -asan-module -en
[llvm-branch-commits] [llvm] ccec2cf - Reland "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor"
Author: Mircea Trofin Date: 2021-01-20T13:33:43-08:00 New Revision: ccec2cf1d9d7e991ef5a2ff2b02d466ebe6cd7a5 URL: https://github.com/llvm/llvm-project/commit/ccec2cf1d9d7e991ef5a2ff2b02d466ebe6cd7a5 DIFF: https://github.com/llvm/llvm-project/commit/ccec2cf1d9d7e991ef5a2ff2b02d466ebe6cd7a5.diff LOG: Reland "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor" This reverts commit d97f776be5f8cd3cd446fe73827cd355f6bab4e1. The original problem was due to build failures in shared lib builds. D95079 moved ImportedFunctionsInliningStatistics under Analysis, unblocking this. Added: Modified: llvm/include/llvm/Analysis/InlineAdvisor.h llvm/include/llvm/Analysis/MLInlineAdvisor.h llvm/include/llvm/Analysis/ReplayInlineAdvisor.h llvm/include/llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h llvm/include/llvm/Transforms/IPO/Inliner.h llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Analysis/MLInlineAdvisor.cpp llvm/lib/Analysis/ReplayInlineAdvisor.cpp llvm/lib/Transforms/IPO/Inliner.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp llvm/test/Transforms/Inline/inline_stats.ll Removed: diff --git a/llvm/include/llvm/Analysis/InlineAdvisor.h b/llvm/include/llvm/Analysis/InlineAdvisor.h index 295e677126d6..bd046d89aa8d 100644 --- a/llvm/include/llvm/Analysis/InlineAdvisor.h +++ b/llvm/include/llvm/Analysis/InlineAdvisor.h @@ -12,6 +12,7 @@ #include "llvm/Analysis/InlineCost.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/PassManager.h" +#include "llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h" #include #include @@ -65,10 +66,7 @@ class InlineAdvice { /// behavior by implementing the corresponding record*Impl. /// /// Call after inlining succeeded, and did not result in deleting the callee. - void recordInlining() { -markRecorded(); -recordInliningImpl(); - } + void recordInlining(); /// Call after inlining succeeded, and resulted in deleting the callee. void recordInliningWithCalleeDeleted(); @@ -114,6 +112,7 @@ class InlineAdvice { assert(!Recorded && "Recording should happen exactly once"); Recorded = true; } + void recordInlineStatsIfNeeded(); bool Recorded = false; }; @@ -141,7 +140,7 @@ class DefaultInlineAdvice : public InlineAdvice { class InlineAdvisor { public: InlineAdvisor(InlineAdvisor &&) = delete; - virtual ~InlineAdvisor() { freeDeletedFunctions(); } + virtual ~InlineAdvisor(); /// Get an InlineAdvice containing a recommendation on whether to /// inline or not. \p CB is assumed to be a direct call. \p FAM is assumed to @@ -163,12 +162,14 @@ class InlineAdvisor { virtual void onPassExit() {} protected: - InlineAdvisor(FunctionAnalysisManager &FAM) : FAM(FAM) {} + InlineAdvisor(Module &M, FunctionAnalysisManager &FAM); virtual std::unique_ptr getAdviceImpl(CallBase &CB) = 0; virtual std::unique_ptr getMandatoryAdvice(CallBase &CB, bool Advice); + Module &M; FunctionAnalysisManager &FAM; + std::unique_ptr ImportedFunctionsStats; /// We may want to defer deleting functions to after the inlining for a whole /// module has finished. This allows us to reliably use function pointers as @@ -202,8 +203,9 @@ class InlineAdvisor { /// reusable as-is for inliner pass test scenarios, as well as for regular use. class DefaultInlineAdvisor : public InlineAdvisor { public: - DefaultInlineAdvisor(FunctionAnalysisManager &FAM, InlineParams Params) - : InlineAdvisor(FAM), Params(Params) {} + DefaultInlineAdvisor(Module &M, FunctionAnalysisManager &FAM, + InlineParams Params) + : InlineAdvisor(M, FAM), Params(Params) {} private: std::unique_ptr getAdviceImpl(CallBase &CB) override; diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h index 1afccf84ee48..54edbb823263 100644 --- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -50,7 +50,6 @@ class MLInlineAdvisor : public InlineAdvisor { virtual std::unique_ptr getAdviceFromModel(CallBase &CB, OptimizationRemarkEmitter &ORE); - Module &M; std::unique_ptr ModelRunner; private: diff --git a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h index 7e2b0957436d..9ef572f7ab87 100644 --- a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h @@ -24,8 +24,9 @@ class OptimizationRemarkEmitter; /// previous build to guide current inlining. This is useful for inliner tuning. class ReplayInlineAdvisor : public InlineAdvisor { public: - ReplayInlineAdvisor(FunctionAnalysisManager &FAM, LLVMContext &Context, -
[llvm-branch-commits] [llvm] 95ce32c - [NFC] Move ImportedFunctionsInliningStatistics to Analysis
Author: Mircea Trofin Date: 2021-01-20T13:18:03-08:00 New Revision: 95ce32c7878d92a9058c052ebe7b35f97f23569e URL: https://github.com/llvm/llvm-project/commit/95ce32c7878d92a9058c052ebe7b35f97f23569e DIFF: https://github.com/llvm/llvm-project/commit/95ce32c7878d92a9058c052ebe7b35f97f23569e.diff LOG: [NFC] Move ImportedFunctionsInliningStatistics to Analysis This is related to D94982. We want to call these APIs from the Analysis component, so we can't leave them under Transforms. Differential Revision: https://reviews.llvm.org/D95079 Added: llvm/include/llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp Modified: llvm/include/llvm/Transforms/IPO/Inliner.h llvm/lib/Analysis/CMakeLists.txt llvm/lib/Transforms/IPO/Inliner.cpp llvm/lib/Transforms/Utils/CMakeLists.txt Removed: llvm/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp diff --git a/llvm/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h b/llvm/include/llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h similarity index 100% rename from llvm/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h rename to llvm/include/llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h diff --git a/llvm/include/llvm/Transforms/IPO/Inliner.h b/llvm/include/llvm/Transforms/IPO/Inliner.h index b6e793a8a380c..3cac11bce0c55 100644 --- a/llvm/include/llvm/Transforms/IPO/Inliner.h +++ b/llvm/include/llvm/Transforms/IPO/Inliner.h @@ -14,8 +14,8 @@ #include "llvm/Analysis/InlineAdvisor.h" #include "llvm/Analysis/InlineCost.h" #include "llvm/Analysis/LazyCallGraph.h" +#include "llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h" #include "llvm/IR/PassManager.h" -#include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h" #include namespace llvm { diff --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt index b89b6b3c4c647..f31cf349b09aa 100644 --- a/llvm/lib/Analysis/CMakeLists.txt +++ b/llvm/lib/Analysis/CMakeLists.txt @@ -58,6 +58,7 @@ add_llvm_component_library(LLVMAnalysis IRSimilarityIdentifier.cpp IVDescriptors.cpp IVUsers.cpp + ImportedFunctionsInliningStatistics.cpp IndirectCallPromotionAnalysis.cpp InlineCost.cpp InlineAdvisor.cpp diff --git a/llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp b/llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp similarity index 98% rename from llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp rename to llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp index ea93f99d69e34..6e14a63806c09 100644 --- a/llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp +++ b/llvm/lib/Analysis/ImportedFunctionsInliningStatistics.cpp @@ -9,7 +9,7 @@ // ThinLTO. //===--===// -#include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h" +#include "llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h" #include "llvm/ADT/STLExtras.h" #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" @@ -186,7 +186,7 @@ ImportedFunctionsInliningStatistics::SortedNodesTy ImportedFunctionsInliningStatistics::getSortedNodes() { SortedNodesTy SortedNodes; SortedNodes.reserve(NodesMap.size()); - for (const NodesMapTy::value_type& Node : NodesMap) + for (const NodesMapTy::value_type &Node : NodesMap) SortedNodes.push_back(&Node); llvm::sort(SortedNodes, [&](const SortedNodesTy::value_type &Lhs, diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 8be4e93e09dab..3877c0ecb9749 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -36,6 +36,7 @@ #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/DataLayout.h" @@ -59,7 +60,6 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/CallPromotionUtils.h" #include "llvm/Transforms/Utils/Cloning.h" -#include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/ModuleUtils.h" #include diff --git a/llvm/lib/Transforms/Utils/CMakeLists.txt b/llvm/lib/Transforms/Utils/CMakeLists.txt index a68ba40c2bd55..b3bdc192a877f 100644 --- a/llvm/lib/Transforms/Utils/CMakeLists.txt +++ b/llvm/lib/Transforms/Utils/CMakeLists.txt @@ -28,7 +28,6 @@ add_llvm_component_library(LLVMTransformUtils GlobalStatus.cpp GuardUtils.cpp InlineFunction.cpp - ImportedF
[llvm-branch-commits] [llvm] d97f776 - Revert "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor"
Author: Mircea Trofin Date: 2021-01-20T11:19:34-08:00 New Revision: d97f776be5f8cd3cd446fe73827cd355f6bab4e1 URL: https://github.com/llvm/llvm-project/commit/d97f776be5f8cd3cd446fe73827cd355f6bab4e1 DIFF: https://github.com/llvm/llvm-project/commit/d97f776be5f8cd3cd446fe73827cd355f6bab4e1.diff LOG: Revert "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor" This reverts commit e8aec763a57e211420dfceb2a8dc6b88574924f3. Added: Modified: llvm/include/llvm/Analysis/InlineAdvisor.h llvm/include/llvm/Analysis/MLInlineAdvisor.h llvm/include/llvm/Analysis/ReplayInlineAdvisor.h llvm/include/llvm/Transforms/IPO/Inliner.h llvm/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Analysis/MLInlineAdvisor.cpp llvm/lib/Analysis/ReplayInlineAdvisor.cpp llvm/lib/Transforms/IPO/Inliner.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp llvm/test/Transforms/Inline/inline_stats.ll Removed: diff --git a/llvm/include/llvm/Analysis/InlineAdvisor.h b/llvm/include/llvm/Analysis/InlineAdvisor.h index 5946db3103f0..295e677126d6 100644 --- a/llvm/include/llvm/Analysis/InlineAdvisor.h +++ b/llvm/include/llvm/Analysis/InlineAdvisor.h @@ -12,7 +12,6 @@ #include "llvm/Analysis/InlineCost.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/PassManager.h" -#include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h" #include #include @@ -66,7 +65,10 @@ class InlineAdvice { /// behavior by implementing the corresponding record*Impl. /// /// Call after inlining succeeded, and did not result in deleting the callee. - void recordInlining(); + void recordInlining() { +markRecorded(); +recordInliningImpl(); + } /// Call after inlining succeeded, and resulted in deleting the callee. void recordInliningWithCalleeDeleted(); @@ -112,7 +114,6 @@ class InlineAdvice { assert(!Recorded && "Recording should happen exactly once"); Recorded = true; } - void recordInlineStatsIfNeeded(); bool Recorded = false; }; @@ -140,7 +141,7 @@ class DefaultInlineAdvice : public InlineAdvice { class InlineAdvisor { public: InlineAdvisor(InlineAdvisor &&) = delete; - virtual ~InlineAdvisor(); + virtual ~InlineAdvisor() { freeDeletedFunctions(); } /// Get an InlineAdvice containing a recommendation on whether to /// inline or not. \p CB is assumed to be a direct call. \p FAM is assumed to @@ -162,14 +163,12 @@ class InlineAdvisor { virtual void onPassExit() {} protected: - InlineAdvisor(Module &M, FunctionAnalysisManager &FAM); + InlineAdvisor(FunctionAnalysisManager &FAM) : FAM(FAM) {} virtual std::unique_ptr getAdviceImpl(CallBase &CB) = 0; virtual std::unique_ptr getMandatoryAdvice(CallBase &CB, bool Advice); - Module &M; FunctionAnalysisManager &FAM; - std::unique_ptr ImportedFunctionsStats; /// We may want to defer deleting functions to after the inlining for a whole /// module has finished. This allows us to reliably use function pointers as @@ -203,9 +202,8 @@ class InlineAdvisor { /// reusable as-is for inliner pass test scenarios, as well as for regular use. class DefaultInlineAdvisor : public InlineAdvisor { public: - DefaultInlineAdvisor(Module &M, FunctionAnalysisManager &FAM, - InlineParams Params) - : InlineAdvisor(M, FAM), Params(Params) {} + DefaultInlineAdvisor(FunctionAnalysisManager &FAM, InlineParams Params) + : InlineAdvisor(FAM), Params(Params) {} private: std::unique_ptr getAdviceImpl(CallBase &CB) override; diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h index 54edbb823263..1afccf84ee48 100644 --- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -50,6 +50,7 @@ class MLInlineAdvisor : public InlineAdvisor { virtual std::unique_ptr getAdviceFromModel(CallBase &CB, OptimizationRemarkEmitter &ORE); + Module &M; std::unique_ptr ModelRunner; private: diff --git a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h index 9ef572f7ab87..7e2b0957436d 100644 --- a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h @@ -24,9 +24,8 @@ class OptimizationRemarkEmitter; /// previous build to guide current inlining. This is useful for inliner tuning. class ReplayInlineAdvisor : public InlineAdvisor { public: - ReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM, - LLVMContext &Context, StringRef RemarksFile, - bool EmitRemarks); + ReplayInlineAdvisor(FunctionAnalysisManager &FAM, LLV
[llvm-branch-commits] [llvm] e8aec76 - [NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor
Author: Mircea Trofin Date: 2021-01-20T11:07:36-08:00 New Revision: e8aec763a57e211420dfceb2a8dc6b88574924f3 URL: https://github.com/llvm/llvm-project/commit/e8aec763a57e211420dfceb2a8dc6b88574924f3 DIFF: https://github.com/llvm/llvm-project/commit/e8aec763a57e211420dfceb2a8dc6b88574924f3.diff LOG: [NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor When using 2 InlinePass instances in the same CGSCC - one for other mandatory inlinings, the other for the heuristic-driven ones - the order in which the ImportedFunctionStats would be output-ed would depend on the destruction order of the inline passes, which is not deterministic. This patch moves the ImportedFunctionStats responsibility to the InlineAdvisor to address this problem. Differential Revision: https://reviews.llvm.org/D94982 Added: Modified: llvm/include/llvm/Analysis/InlineAdvisor.h llvm/include/llvm/Analysis/MLInlineAdvisor.h llvm/include/llvm/Analysis/ReplayInlineAdvisor.h llvm/include/llvm/Transforms/IPO/Inliner.h llvm/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Analysis/MLInlineAdvisor.cpp llvm/lib/Analysis/ReplayInlineAdvisor.cpp llvm/lib/Transforms/IPO/Inliner.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp llvm/test/Transforms/Inline/inline_stats.ll Removed: diff --git a/llvm/include/llvm/Analysis/InlineAdvisor.h b/llvm/include/llvm/Analysis/InlineAdvisor.h index 295e677126d66..5946db3103f00 100644 --- a/llvm/include/llvm/Analysis/InlineAdvisor.h +++ b/llvm/include/llvm/Analysis/InlineAdvisor.h @@ -12,6 +12,7 @@ #include "llvm/Analysis/InlineCost.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/PassManager.h" +#include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h" #include #include @@ -65,10 +66,7 @@ class InlineAdvice { /// behavior by implementing the corresponding record*Impl. /// /// Call after inlining succeeded, and did not result in deleting the callee. - void recordInlining() { -markRecorded(); -recordInliningImpl(); - } + void recordInlining(); /// Call after inlining succeeded, and resulted in deleting the callee. void recordInliningWithCalleeDeleted(); @@ -114,6 +112,7 @@ class InlineAdvice { assert(!Recorded && "Recording should happen exactly once"); Recorded = true; } + void recordInlineStatsIfNeeded(); bool Recorded = false; }; @@ -141,7 +140,7 @@ class DefaultInlineAdvice : public InlineAdvice { class InlineAdvisor { public: InlineAdvisor(InlineAdvisor &&) = delete; - virtual ~InlineAdvisor() { freeDeletedFunctions(); } + virtual ~InlineAdvisor(); /// Get an InlineAdvice containing a recommendation on whether to /// inline or not. \p CB is assumed to be a direct call. \p FAM is assumed to @@ -163,12 +162,14 @@ class InlineAdvisor { virtual void onPassExit() {} protected: - InlineAdvisor(FunctionAnalysisManager &FAM) : FAM(FAM) {} + InlineAdvisor(Module &M, FunctionAnalysisManager &FAM); virtual std::unique_ptr getAdviceImpl(CallBase &CB) = 0; virtual std::unique_ptr getMandatoryAdvice(CallBase &CB, bool Advice); + Module &M; FunctionAnalysisManager &FAM; + std::unique_ptr ImportedFunctionsStats; /// We may want to defer deleting functions to after the inlining for a whole /// module has finished. This allows us to reliably use function pointers as @@ -202,8 +203,9 @@ class InlineAdvisor { /// reusable as-is for inliner pass test scenarios, as well as for regular use. class DefaultInlineAdvisor : public InlineAdvisor { public: - DefaultInlineAdvisor(FunctionAnalysisManager &FAM, InlineParams Params) - : InlineAdvisor(FAM), Params(Params) {} + DefaultInlineAdvisor(Module &M, FunctionAnalysisManager &FAM, + InlineParams Params) + : InlineAdvisor(M, FAM), Params(Params) {} private: std::unique_ptr getAdviceImpl(CallBase &CB) override; diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h index 1afccf84ee482..54edbb823263b 100644 --- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -50,7 +50,6 @@ class MLInlineAdvisor : public InlineAdvisor { virtual std::unique_ptr getAdviceFromModel(CallBase &CB, OptimizationRemarkEmitter &ORE); - Module &M; std::unique_ptr ModelRunner; private: diff --git a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h index 7e2b0957436d1..9ef572f7ab87e 100644 --- a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h @@ -24,8 +24,9 @@ class OptimizationRemarkEmit
[llvm-branch-commits] [llvm] 27afc09 - [NFC] Disallow unused prefixes under Other
Author: Mircea Trofin Date: 2021-01-19T12:22:29-08:00 New Revision: 27afc091e2c0caa954326129adb86987d1b41c91 URL: https://github.com/llvm/llvm-project/commit/27afc091e2c0caa954326129adb86987d1b41c91 DIFF: https://github.com/llvm/llvm-project/commit/27afc091e2c0caa954326129adb86987d1b41c91.diff LOG: [NFC] Disallow unused prefixes under Other Differential Revision: https://reviews.llvm.org/D94853 Added: llvm/test/Other/lit.local.cfg Modified: llvm/test/Other/new-pass-manager.ll llvm/test/Other/opt-LTO-pipeline.ll llvm/test/Other/opt-bisect-legacy-pass-manager.ll llvm/test/Other/print-slotindexes.ll Removed: diff --git a/llvm/test/Other/lit.local.cfg b/llvm/test/Other/lit.local.cfg new file mode 100644 index 0..1b775f32afe07 --- /dev/null +++ b/llvm/test/Other/lit.local.cfg @@ -0,0 +1,12 @@ +from lit.llvm.subst import ToolSubst + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=false')) + +# FIXME: this substitution should be removed together with the above, when the +# default --allow-unused-prefixes is fixed. At that point, the use of %FileCheckRaw% +# in opt-bisect-legacy-pass-manager.ll should be switched back to just FileCheck. +config.substitutions.append(('%FileCheckRaw%', 'FileCheck')) diff --git a/llvm/test/Other/new-pass-manager.ll b/llvm/test/Other/new-pass-manager.ll index 1206f2c4b5dc4..f1e3702145bd7 100644 --- a/llvm/test/Other/new-pass-manager.ll +++ b/llvm/test/Other/new-pass-manager.ll @@ -366,6 +366,9 @@ ; CHECK-EXT-NEXT: Starting llvm::Function pass manager run. ; CHECK-EXT-NEXT: Running pass: {{.*}}Bye ; CHECK-EXT-NEXT: Finished llvm::Function pass manager run. +; We don't have checks for CHECK-NOEXT here, but this simplifies the test, while +; avoiding FileCheck complaining about the unused prefix. +; CHECK-NOEXT: {{.*}} ; CHECK-O0-NEXT: Finished llvm::Module pass manager run ; RUN: opt -disable-output -disable-verify -debug-pass-manager \ diff --git a/llvm/test/Other/opt-LTO-pipeline.ll b/llvm/test/Other/opt-LTO-pipeline.ll index a3de1b9de3f9c..14f6329b2540b 100644 --- a/llvm/test/Other/opt-LTO-pipeline.ll +++ b/llvm/test/Other/opt-LTO-pipeline.ll @@ -1,4 +1,4 @@ -; RUN: opt -enable-new-pm=0 -mtriple=x86_64-- -std-link-opts -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK,%llvmcheckext %s +; RUN: opt -enable-new-pm=0 -mtriple=x86_64-- -std-link-opts -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK %s ; REQUIRES: asserts diff --git a/llvm/test/Other/opt-bisect-legacy-pass-manager.ll b/llvm/test/Other/opt-bisect-legacy-pass-manager.ll index 8d966deeccd70..decd9db6636f8 100644 --- a/llvm/test/Other/opt-bisect-legacy-pass-manager.ll +++ b/llvm/test/Other/opt-bisect-legacy-pass-manager.ll @@ -39,7 +39,7 @@ ; f2() in f3(). ; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \ -; RUN: --filecheckcmd=FileCheck --test=%s \ +; RUN: --filecheckcmd=%FileCheckRaw% --test=%s \ ; RUN: --prefix=CHECK-BISECT-INLINE-HELPER \ ; RUN: | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT ; The helper script uses this to find the optimization that inlines the call. diff --git a/llvm/test/Other/print-slotindexes.ll b/llvm/test/Other/print-slotindexes.ll index 722a3dc5a9389..cc0abb75a59b0 100644 --- a/llvm/test/Other/print-slotindexes.ll +++ b/llvm/test/Other/print-slotindexes.ll @@ -1,5 +1,5 @@ -; RUN: llc -print-after=slotindexes < %s 2>&1 | FileCheck %s --check-prefixes=ALL,SI -; RUN: llc -print-after=slotindexes -print-slotindexes=false < %s 2>&1 | FileCheck %s --check-prefixes=ALL,NOSI +; RUN: llc -print-after=slotindexes < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,SI +; RUN: llc -print-after=slotindexes -print-slotindexes=false < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,NOSI ; REQUIRES: default_triple define void @foo(){ ret void ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a61e42e - [NPM][Inliner] Temporarily remove inline_stats test case for always
Author: Mircea Trofin Date: 2021-01-15T21:59:35-08:00 New Revision: a61e42efbb73e55c44cbb0eb2686c7b4a25ca812 URL: https://github.com/llvm/llvm-project/commit/a61e42efbb73e55c44cbb0eb2686c7b4a25ca812 DIFF: https://github.com/llvm/llvm-project/commit/a61e42efbb73e55c44cbb0eb2686c7b4a25ca812.diff LOG: [NPM][Inliner] Temporarily remove inline_stats test case for always inline The stats are printed at InlinePass destruction. When we have 2 of them, it appears the destruction order of the Passes std::vector of the pass manager differs in msan builds - example: http://lab.llvm.org:8011/#/builders/74/builds/2135. This reproes locally, too. Temporarily removing the sub-test case, to green the build, and will follow up with a stat dumping alternative that does not depend on vector element dtor order. Added: Modified: llvm/test/Transforms/Inline/inline_stats.ll Removed: diff --git a/llvm/test/Transforms/Inline/inline_stats.ll b/llvm/test/Transforms/Inline/inline_stats.ll index 1d06ff5d533f..1553da04c7b6 100644 --- a/llvm/test/Transforms/Inline/inline_stats.ll +++ b/llvm/test/Transforms/Inline/inline_stats.ll @@ -9,9 +9,6 @@ ; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK ; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK -; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefix=MANDATORY-FIRST -; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefix=MANDATORY-FIRST - ; CHECK: --- Dumping inliner stats for [] --- ; CHECK-BASIC-NOT: -- List of inlined functions: ; CHECK-BASIC-NOT: -- Inlined not imported function @@ -30,21 +27,6 @@ ; CHECK: non-imported functions inlined anywhere: 1 [33.33% of non-imported functions] ; CHECK: non-imported functions inlined into importing module: 1 [33.33% of non-imported functions] -; MANDATORY-FIRST: -- Summary: -; MANDATORY-FIRST: All functions: 10, imported functions: 7 -; MANDATORY-FIRST: inlined functions: 4 [40% of all functions] -; MANDATORY-FIRST: imported functions inlined anywhere: 3 [42.86% of imported functions] -; MANDATORY-FIRST: imported functions inlined into importing module: 2 [28.57% of imported functions], remaining: 5 [71.43% of imported functions] -; MANDATORY-FIRST: non-imported functions inlined anywhere: 1 [33.33% of non-imported functions] -; MANDATORY-FIRST: non-imported functions inlined into importing module: 1 [33.33% of non-imported functions] -; MANDATORY-FIRST: -- Summary: -; MANDATORY-FIRST: All functions: 10, imported functions: 7 -; MANDATORY-FIRST: inlined functions: 1 [10% of all functions] -; MANDATORY-FIRST: imported functions inlined anywhere: 1 [14.29% of imported functions] -; MANDATORY-FIRST: imported functions inlined into importing module: 1 [14.29% of imported functions], remaining: 6 [85.71% of imported functions] -; MANDATORY-FIRST: non-imported functions inlined anywhere: 0 [0% of non-imported functions] -; MANDATORY-FIRST: non-imported functions inlined into importing module: 0 [0% of non-imported functions] - define void @internal() { call fastcc void @external1() call fastcc void @internal2() ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 029c225 - [Inline] Fix a missing character in inline_stats.ll
Author: Mircea Trofin Date: 2021-01-15T20:28:15-08:00 New Revision: 029c2257c21e15e00806b2083e8881fb2468900e URL: https://github.com/llvm/llvm-project/commit/029c2257c21e15e00806b2083e8881fb2468900e DIFF: https://github.com/llvm/llvm-project/commit/029c2257c21e15e00806b2083e8881fb2468900e.diff LOG: [Inline] Fix a missing character in inline_stats.ll Added: Modified: llvm/test/Transforms/Inline/inline_stats.ll Removed: diff --git a/llvm/test/Transforms/Inline/inline_stats.ll b/llvm/test/Transforms/Inline/inline_stats.ll index 7c4471e1db97..1d06ff5d533f 100644 --- a/llvm/test/Transforms/Inline/inline_stats.ll +++ b/llvm/test/Transforms/Inline/inline_stats.ll @@ -30,7 +30,7 @@ ; CHECK: non-imported functions inlined anywhere: 1 [33.33% of non-imported functions] ; CHECK: non-imported functions inlined into importing module: 1 [33.33% of non-imported functions] -; MANDATORY-FIRST: - Summary: +; MANDATORY-FIRST: -- Summary: ; MANDATORY-FIRST: All functions: 10, imported functions: 7 ; MANDATORY-FIRST: inlined functions: 4 [40% of all functions] ; MANDATORY-FIRST: imported functions inlined anywhere: 3 [42.86% of imported functions] ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] e8049dc - [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner
Author: Mircea Trofin Date: 2021-01-15T17:59:38-08:00 New Revision: e8049dc3c8a46ccd75ce2a4f438d695d20feb660 URL: https://github.com/llvm/llvm-project/commit/e8049dc3c8a46ccd75ce2a4f438d695d20feb660 DIFF: https://github.com/llvm/llvm-project/commit/e8049dc3c8a46ccd75ce2a4f438d695d20feb660.diff LOG: [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner Expanding from D94808 - we ensure the same InlineAdvisor is used by both InlinerPass instances. The notion of mandatory inlining is moved into the core InlineAdvisor: advisors anyway have to handle that case, so this change also factors out that a bit better. Differential Revision: https://reviews.llvm.org/D94825 Added: Modified: clang/test/CodeGen/thinlto-distributed-newpm.ll clang/test/Frontend/optimization-remark-line-directive.c clang/test/Frontend/optimization-remark-new-pm.c clang/test/Frontend/optimization-remark-with-hotness-new-pm.c clang/test/Frontend/optimization-remark.c llvm/include/llvm/Analysis/InlineAdvisor.h llvm/include/llvm/Analysis/MLInlineAdvisor.h llvm/include/llvm/Analysis/ReplayInlineAdvisor.h llvm/include/llvm/Passes/PassBuilder.h llvm/include/llvm/Transforms/IPO/Inliner.h llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Analysis/MLInlineAdvisor.cpp llvm/lib/Analysis/ReplayInlineAdvisor.cpp llvm/lib/Passes/PassBuilder.cpp llvm/lib/Passes/PassRegistry.def llvm/lib/Transforms/IPO/Inliner.cpp llvm/test/Other/new-pm-defaults.ll llvm/test/Other/new-pm-lto-defaults.ll llvm/test/Other/new-pm-pgo-preinline.ll llvm/test/Other/new-pm-thinlto-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll llvm/test/Transforms/Inline/inline_stats.ll llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll llvm/test/Transforms/Inline/optimization-remarks.ll llvm/test/Transforms/Inline/pr46945.ll Removed: llvm/test/Other/new-pm-module-inliner-wrapper.ll diff --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll b/clang/test/CodeGen/thinlto-distributed-newpm.ll index 8fe53762837e..4c031db6734b 100644 --- a/clang/test/CodeGen/thinlto-distributed-newpm.ll +++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll @@ -63,19 +63,10 @@ ; CHECK-O: Running analysis: OuterAnalysisManagerProxy ; CHECK-O: Running pass: SimplifyCFGPass on main ; CHECK-O: Finished {{.*}}Function pass manager run. -; CHECK-O: Running pass: ModuleInlinerWrapperPass -; CHECK-O: Running analysis: InlineAdvisorAnalysis ; CHECK-O: Running analysis: InnerAnalysisManagerProxy ; CHECK-O: Running analysis: LazyCallGraphAnalysis ; CHECK-O: Running analysis: FunctionAnalysisManagerCGSCCProxy on (main) ; CHECK-O: Running analysis: OuterAnalysisManagerProxy -; CHECK-O: Running pass: InlinerPass on (main) -; CHECK-O: Finished {{.*}}Module pass manager run -; CHECK-O: Running pass: ModuleInlinerWrapperPass -; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA -; CHECK-O: Running analysis: GlobalsAA -; CHECK-O: Running analysis: CallGraphAnalysis -; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis ; CHECK-O: Starting CGSCC pass manager run. ; CHECK-O: Running pass: InlinerPass on (main) ; CHECK-O: Running pass: PostOrderFunctionAttrsPass on (main) diff --git a/clang/test/Frontend/optimization-remark-line-directive.c b/clang/test/Frontend/optimization-remark-line-directive.c index 5a2dc6754763..59f600125860 100644 --- a/clang/test/Frontend/optimization-remark-line-directive.c +++ b/clang/test/Frontend/optimization-remark-line-directive.c @@ -6,7 +6,7 @@ // The new PM inliner is not added to the default pipeline at O0, so we add // some optimizations to trigger it. -// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -debug-info-kind=line-tables-only -emit-llvm-only -verify -mllvm -mandatory-inlining-first=0 +// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -debug-info-kind=line-tables-only -emit-llvm-only -mllvm -mandatory-inlining-first=false -verify int foo(int x, int y) __attribute__((always_inline)); int foo(int x, int y) { return x + y; } diff --git a/clang/test/Frontend/optimization-remark-new-pm.c b/clang/test/Frontend/optimization-remark-new-pm.c index 79e83014589b..2d89059b13e6 100644 --- a/clang/test/Frontend/optimization-remark-new-pm.c +++ b/clang/test/Frontend/optimization-remark-new-pm.c @@ -1,8 +1,8 @@ // Verify that remarks for the inliner appear. The remarks under the new PM will // be slightly diff erent than those emitted by the legacy PM. The new PM inliner // also doesnot appear to b
[llvm-branch-commits] [llvm] aa3d4d9 - [NFC] Disallow unused prefixes under MC/RISCV
Author: Mircea Trofin Date: 2021-01-15T16:21:30-08:00 New Revision: aa3d4d9939595295d19969c62077cc09e4823f58 URL: https://github.com/llvm/llvm-project/commit/aa3d4d9939595295d19969c62077cc09e4823f58 DIFF: https://github.com/llvm/llvm-project/commit/aa3d4d9939595295d19969c62077cc09e4823f58.diff LOG: [NFC] Disallow unused prefixes under MC/RISCV Differential Revision: https://reviews.llvm.org/D94836 Added: Modified: llvm/test/MC/RISCV/lit.local.cfg llvm/test/MC/RISCV/rv32c-only-valid.s llvm/test/MC/RISCV/rv32zfh-valid.s llvm/test/MC/RISCV/rv64zfh-valid.s Removed: diff --git a/llvm/test/MC/RISCV/lit.local.cfg b/llvm/test/MC/RISCV/lit.local.cfg index c63820126f8c..896e7941295e 100644 --- a/llvm/test/MC/RISCV/lit.local.cfg +++ b/llvm/test/MC/RISCV/lit.local.cfg @@ -1,2 +1,10 @@ +from lit.llvm.subst import ToolSubst + if not 'RISCV' in config.root.targets: config.unsupported = True + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=false')) diff --git a/llvm/test/MC/RISCV/rv32c-only-valid.s b/llvm/test/MC/RISCV/rv32c-only-valid.s index edd5a656eeae..0b10b3f0e90e 100644 --- a/llvm/test/MC/RISCV/rv32c-only-valid.s +++ b/llvm/test/MC/RISCV/rv32c-only-valid.s @@ -1,18 +1,18 @@ # RUN: llvm-mc %s -triple=riscv32 -mattr=+c -riscv-no-aliases -show-encoding \ -# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM %s # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c < %s \ # RUN: | llvm-objdump --mattr=+c -M no-aliases -d -r - \ -# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-OBJ %s # # RUN: not llvm-mc -triple riscv32 \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ -# RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s +# RUN: | FileCheck --check-prefix=CHECK-NO-EXT %s # RUN: not llvm-mc -triple riscv64 -mattr=+c \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ -# RUN: | FileCheck -check-prefixes=CHECK-NO-RV32 %s +# RUN: | FileCheck --check-prefix=CHECK-NO-RV32 %s # RUN: not llvm-mc -triple riscv64 \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ -# RUN: | FileCheck -check-prefixes=CHECK-NO-RV32-AND-EXT %s +# RUN: | FileCheck --check-prefix=CHECK-NO-RV32-AND-EXT %s # CHECK-OBJ: c.jal 0x7fe # CHECK-ASM: c.jal 2046 diff --git a/llvm/test/MC/RISCV/rv32zfh-valid.s b/llvm/test/MC/RISCV/rv32zfh-valid.s index a6853fb95ea0..f257ad0d91fe 100644 --- a/llvm/test/MC/RISCV/rv32zfh-valid.s +++ b/llvm/test/MC/RISCV/rv32zfh-valid.s @@ -4,10 +4,10 @@ # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zfh < %s \ # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfh < %s \ # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s # CHECK-ASM-AND-OBJ: flh ft0, 12(a0) # CHECK-ASM: encoding: [0x07,0x10,0xc5,0x00] diff --git a/llvm/test/MC/RISCV/rv64zfh-valid.s b/llvm/test/MC/RISCV/rv64zfh-valid.s index 0a667f668d4f..49aa4e7aaaef 100644 --- a/llvm/test/MC/RISCV/rv64zfh-valid.s +++ b/llvm/test/MC/RISCV/rv64zfh-valid.s @@ -2,7 +2,7 @@ # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfh < %s \ # RUN: | llvm-objdump --mattr=+experimental-zfh -M no-aliases -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s # # RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zfh < %s 2>&1 \ # RUN: | FileCheck -check-prefix=CHECK-RV32 %s ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 35c8a6c - [NFC] Disallow unused prefixes under MC/AArch64
Author: Mircea Trofin Date: 2021-01-14T09:46:13-08:00 New Revision: 35c8a6cbf5ff0b525e2c01e5d746067bdda1dde7 URL: https://github.com/llvm/llvm-project/commit/35c8a6cbf5ff0b525e2c01e5d746067bdda1dde7 DIFF: https://github.com/llvm/llvm-project/commit/35c8a6cbf5ff0b525e2c01e5d746067bdda1dde7.diff LOG: [NFC] Disallow unused prefixes under MC/AArch64 Differential Revision: https://reviews.llvm.org/D94616 Added: Modified: llvm/test/MC/AArch64/armv8.7a-ls64.s llvm/test/MC/AArch64/armv8.7a-xs.s llvm/test/MC/AArch64/lit.local.cfg Removed: diff --git a/llvm/test/MC/AArch64/armv8.7a-ls64.s b/llvm/test/MC/AArch64/armv8.7a-ls64.s index c647ecce53f0..d4684e38cbea 100644 --- a/llvm/test/MC/AArch64/armv8.7a-ls64.s +++ b/llvm/test/MC/AArch64/armv8.7a-ls64.s @@ -1,7 +1,7 @@ // RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+ls64 < %s 2>%t | FileCheck %s -// RUN: FileCheck --check-prefix=CHECK-ERR --check-prefix=CHECK-LS64-ERR %s < %t +// RUN: FileCheck --check-prefix=CHECK-ERR %s < %t // RUN: not llvm-mc -triple aarch64-none-linux-gnu < %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-ERR --check-prefix=CHECK-NO-LS64-ERR %s < %t +// RUN: FileCheck --check-prefixes=CHECK-ERR,CHECK-NO-LS64-ERR %s < %t ld64b x0, [x13] st64b x14, [x13] diff --git a/llvm/test/MC/AArch64/armv8.7a-xs.s b/llvm/test/MC/AArch64/armv8.7a-xs.s index 6193c1f15f53..e3a1e12aae9a 100644 --- a/llvm/test/MC/AArch64/armv8.7a-xs.s +++ b/llvm/test/MC/AArch64/armv8.7a-xs.s @@ -1,9 +1,9 @@ // RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+v8.4a,+xs < %s 2>%t | FileCheck %s -// RUN: FileCheck --check-prefix=CHECK-ERR --check-prefix=CHECK-XS-ERR %s < %t +// RUN: FileCheck --check-prefix=CHECK-ERR %s < %t // RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+v8.7a < %s 2>%t | FileCheck %s -// RUN: FileCheck --check-prefix=CHECK-ERR --check-prefix=CHECK-XS-ERR %s < %t +// RUN: FileCheck --check-prefix=CHECK-ERR %s < %t // RUN: not llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.4a < %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-ERR --check-prefix=CHECK-NO-XS-ERR %s < %t +// RUN: FileCheck --check-prefixes=CHECK-ERR,CHECK-NO-XS-ERR %s < %t dsb #16 dsb #20 diff --git a/llvm/test/MC/AArch64/lit.local.cfg b/llvm/test/MC/AArch64/lit.local.cfg index 5822b7226687..ab829130e269 100644 --- a/llvm/test/MC/AArch64/lit.local.cfg +++ b/llvm/test/MC/AArch64/lit.local.cfg @@ -1,2 +1,10 @@ +from lit.llvm.subst import ToolSubst + if 'AArch64' not in config.root.targets: config.unsupported = True + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=false')) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] e21bf87 - [NFC] Disallow unused prefixes under MC/ARM
Author: Mircea Trofin Date: 2021-01-14T08:56:45-08:00 New Revision: e21bf875c0f709a721d98450203781a605483a1d URL: https://github.com/llvm/llvm-project/commit/e21bf875c0f709a721d98450203781a605483a1d DIFF: https://github.com/llvm/llvm-project/commit/e21bf875c0f709a721d98450203781a605483a1d.diff LOG: [NFC] Disallow unused prefixes under MC/ARM Differential Revision: https://reviews.llvm.org/D94620 Added: Modified: llvm/test/MC/ARM/ldr-pseudo-cond-darwin.s llvm/test/MC/ARM/ldr-pseudo-cond.s llvm/test/MC/ARM/lit.local.cfg llvm/test/MC/ARM/lsl-zero-errors.s llvm/test/MC/ARM/lsl-zero.s llvm/test/MC/ARM/mve-fp-registers.s llvm/test/MC/ARM/thumbv8m.s Removed: diff --git a/llvm/test/MC/ARM/ldr-pseudo-cond-darwin.s b/llvm/test/MC/ARM/ldr-pseudo-cond-darwin.s index 915b883bc755..34dda3235276 100644 --- a/llvm/test/MC/ARM/ldr-pseudo-cond-darwin.s +++ b/llvm/test/MC/ARM/ldr-pseudo-cond-darwin.s @@ -1,5 +1,5 @@ -@RUN: llvm-mc -triple armv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-ARM --check-prefix=CHECK %s -@RUN: llvm-mc -triple thumbv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-THUMB2 --check-prefix=CHECK %s +@RUN: llvm-mc -triple armv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK %s +@RUN: llvm-mc -triple thumbv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK %s @ @ Check that ldr to constant pool correctly transfers the condition codes diff --git a/llvm/test/MC/ARM/ldr-pseudo-cond.s b/llvm/test/MC/ARM/ldr-pseudo-cond.s index fa78311965c5..2785247f2256 100644 --- a/llvm/test/MC/ARM/ldr-pseudo-cond.s +++ b/llvm/test/MC/ARM/ldr-pseudo-cond.s @@ -1,5 +1,5 @@ -@RUN: llvm-mc -triple armv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-ARM --check-prefix=CHECK %s -@RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-THUMB2 --check-prefix=CHECK %s +@RUN: llvm-mc -triple armv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK %s +@RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK %s @ @ Check that ldr to constant pool correctly transfers the condition codes diff --git a/llvm/test/MC/ARM/lit.local.cfg b/llvm/test/MC/ARM/lit.local.cfg index 236e1d344166..b305cf706e77 100644 --- a/llvm/test/MC/ARM/lit.local.cfg +++ b/llvm/test/MC/ARM/lit.local.cfg @@ -1,2 +1,10 @@ +from lit.llvm.subst import ToolSubst + if not 'ARM' in config.root.targets: config.unsupported = True + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=false')) diff --git a/llvm/test/MC/ARM/lsl-zero-errors.s b/llvm/test/MC/ARM/lsl-zero-errors.s index 937b50f62da0..ad39470a4a50 100644 --- a/llvm/test/MC/ARM/lsl-zero-errors.s +++ b/llvm/test/MC/ARM/lsl-zero-errors.s @@ -1,6 +1,6 @@ -// RUN: not llvm-mc -triple=thumbv7 -show-encoding < %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NONARM --check-prefix=CHECK-THUMBV7 %s -// RUN: not llvm-mc -triple=thumbv8 -show-encoding < %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NONARM --check-prefix=CHECK-THUMBV8 %s -// RUN: llvm-mc -triple=armv7 -show-encoding < %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-ARM %s +// RUN: not llvm-mc -triple=thumbv7 -show-encoding < %s 2>&1 | FileCheck --check-prefixes=CHECK-NONARM,CHECK-THUMBV7 %s +// RUN: not llvm-mc -triple=thumbv8 -show-encoding < %s 2>&1 | FileCheck --check-prefixes=CHECK-NONARM,CHECK-THUMBV8 %s +// RUN: llvm-mc -triple=armv7 -show-encoding < %s 2>&1 | FileCheck --check-prefix=CHECK-ARM %s // lsl #0 is actually mov, so here we check that it behaves the same as // mov with regards to the permitted registers diff --git a/llvm/test/MC/ARM/lsl-zero.s b/llvm/test/MC/ARM/lsl-zero.s index 6e64e0012362..81a599d68417 100644 --- a/llvm/test/MC/ARM/lsl-zero.s +++ b/llvm/test/MC/ARM/lsl-zero.s @@ -1,6 +1,6 @@ -// RUN: llvm-mc -triple=thumbv7 -show-encoding < %s 2>/dev/null | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NONARM --check-prefix=CHECK-THUMBV7 %s -// RUN: llvm-mc -triple=thumbv8 -show-encoding < %s 2>/dev/null | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NONARM --check-prefix=CHECK-THUMBV8 %s -// RUN: llvm-mc -triple=armv7 -show-encoding < %s 2>/dev/null | FileCheck --check-prefix=CHECK --check-prefix=CHECK-ARM %s +// RUN: llvm-mc -triple=thumbv7 -show-encoding < %s 2>/dev/null | FileCheck --check-prefix=CHECK-NONARM %s +// RUN: llvm-mc -triple=thumbv8 -show-encoding < %s 2>/dev/null | FileCheck --check-prefix=CHECK-NONARM %s +// RUN: llvm-mc -triple=armv7 -show-encoding < %s 2>/dev/null | FileCheck --check-prefix=CHECK-ARM %s // lsl #0 is
[llvm-branch-commits] [llvm] 5856123 - [NFC] Disallow unused prefixes under MC/AMDGPU
Author: Mircea Trofin Date: 2021-01-12T15:24:44-08:00 New Revision: 585612355cdf836b434a5331b1263e961135a1ab URL: https://github.com/llvm/llvm-project/commit/585612355cdf836b434a5331b1263e961135a1ab DIFF: https://github.com/llvm/llvm-project/commit/585612355cdf836b434a5331b1263e961135a1ab.diff LOG: [NFC] Disallow unused prefixes under MC/AMDGPU This patches remaining tests, and patches lit.local.cfg to block future such cases (until we flip FileCheck's flag) Differential Revision: https://reviews.llvm.org/D94556 Added: Modified: llvm/test/MC/AMDGPU/isa-version-hsa.s llvm/test/MC/AMDGPU/isa-version-pal.s llvm/test/MC/AMDGPU/isa-version-unk.s llvm/test/MC/AMDGPU/lit.local.cfg llvm/test/MC/AMDGPU/literal16.s llvm/test/MC/AMDGPU/literals.s llvm/test/MC/AMDGPU/mtbuf-gfx10.s llvm/test/MC/AMDGPU/mtbuf.s llvm/test/MC/AMDGPU/mubuf-gfx9.s llvm/test/MC/AMDGPU/mubuf.s llvm/test/MC/AMDGPU/out-of-range-registers.s llvm/test/MC/AMDGPU/reg-syntax-extra.s llvm/test/MC/AMDGPU/smem.s llvm/test/MC/AMDGPU/smrd.s llvm/test/MC/AMDGPU/sop1-err.s llvm/test/MC/AMDGPU/sop1.s llvm/test/MC/AMDGPU/sop2.s llvm/test/MC/AMDGPU/sopc.s llvm/test/MC/AMDGPU/sopk-err.s llvm/test/MC/AMDGPU/sopk.s llvm/test/MC/AMDGPU/sopp-err.s llvm/test/MC/AMDGPU/sopp.s llvm/test/MC/AMDGPU/vintrp-err.s llvm/test/MC/AMDGPU/vintrp.s llvm/test/MC/AMDGPU/vop1.s llvm/test/MC/AMDGPU/vop3-convert.s llvm/test/MC/AMDGPU/vop3-gfx9.s llvm/test/MC/AMDGPU/vop_dpp.s llvm/test/MC/AMDGPU/vop_dpp_expr.s llvm/test/MC/AMDGPU/vop_sdwa.s llvm/test/MC/AMDGPU/xdl-insts-err.s Removed: diff --git a/llvm/test/MC/AMDGPU/isa-version-hsa.s b/llvm/test/MC/AMDGPU/isa-version-hsa.s index 094ab1d4649f..7281487b0517 100644 --- a/llvm/test/MC/AMDGPU/isa-version-hsa.s +++ b/llvm/test/MC/AMDGPU/isa-version-hsa.s @@ -1,10 +1,10 @@ -// RUN: not llvm-mc -triple amdgcn-amd-unknown -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK-ERR %s -// RUN: not llvm-mc -triple amdgcn-amd-unknown -mcpu=iceland %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK-ERR %s -// RUN: llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=gfx802 %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA %s -// RUN: llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=iceland %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA %s -// RUN: not llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=gfx803 %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA-ERR %s -// RUN: not llvm-mc -triple amdgcn-amd-amdpal -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-PAL-ERR %s -// RUN: not llvm-mc -triple amdgcn-amd-amdpal -mcpu=iceland %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-PAL-ERR %s +// RUN: not llvm-mc -triple amdgcn-amd-unknown -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefix=OSABI-UNK-ERR %s +// RUN: not llvm-mc -triple amdgcn-amd-unknown -mcpu=iceland %s 2>&1 | FileCheck --check-prefix=OSABI-UNK-ERR %s +// RUN: llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=gfx802 %s | FileCheck --check-prefix=OSABI-HSA %s +// RUN: llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=iceland %s | FileCheck --check-prefix=OSABI-HSA %s +// RUN: not llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=gfx803 %s 2>&1 | FileCheck --check-prefix=OSABI-HSA-ERR %s +// RUN: not llvm-mc -triple amdgcn-amd-amdpal -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefix=OSABI-PAL-ERR %s +// RUN: not llvm-mc -triple amdgcn-amd-amdpal -mcpu=iceland %s 2>&1 | FileCheck --check-prefix=OSABI-PAL-ERR %s // OSABI-HSA: .amd_amdgpu_isa "amdgcn-amd-amdhsa--gfx802" // OSABI-UNK-ERR: error: .amd_amdgpu_isa directive does not match triple and/or mcpu arguments specified through the command line diff --git a/llvm/test/MC/AMDGPU/isa-version-pal.s b/llvm/test/MC/AMDGPU/isa-version-pal.s index 378b94f87f86..98b91ad8bda9 100644 --- a/llvm/test/MC/AMDGPU/isa-version-pal.s +++ b/llvm/test/MC/AMDGPU/isa-version-pal.s @@ -1,10 +1,10 @@ -// RUN: not llvm-mc -triple amdgcn-amd-unknown -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK-ERR %s -// RUN: not llvm-mc -triple amdgcn-amd-unknown -mcpu=iceland %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK-ERR %s -// RUN: not llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA-ERR %s -// RUN: not llvm-mc -triple amdgcn-amd-amdhsa --amdhsa-code-object-version=2 -mcpu=iceland %s 2>&1 | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA-ERR %s -// RUN: llvm-mc -triple amdgcn-amd-amdpal -mcpu=gfx802 %s | FileCheck --check-prefix=GCN --check-prefix=OSA
[llvm-branch-commits] [llvm] 55f2eee - [NFC] Disallow unused prefixes in MC/AMDGPU
Author: Mircea Trofin Date: 2021-01-12T14:31:22-08:00 New Revision: 55f2eeebc96e7522e49e19074cbfbe4e7f074b5b URL: https://github.com/llvm/llvm-project/commit/55f2eeebc96e7522e49e19074cbfbe4e7f074b5b DIFF: https://github.com/llvm/llvm-project/commit/55f2eeebc96e7522e49e19074cbfbe4e7f074b5b.diff LOG: [NFC] Disallow unused prefixes in MC/AMDGPU 1 out of 2 patches. Differential Revision: https://reviews.llvm.org/D94553 Added: Modified: llvm/test/MC/AMDGPU/add-sub-no-carry.s llvm/test/MC/AMDGPU/buf-fmt-d16-packed.s llvm/test/MC/AMDGPU/buf-fmt-d16-unpacked.s llvm/test/MC/AMDGPU/ds-gfx9.s llvm/test/MC/AMDGPU/ds.s llvm/test/MC/AMDGPU/flat-gfx10.s llvm/test/MC/AMDGPU/flat-global.s llvm/test/MC/AMDGPU/flat-scratch-instructions.s llvm/test/MC/AMDGPU/gfx10_asm_dpp16.s llvm/test/MC/AMDGPU/gfx10_asm_dpp8.s llvm/test/MC/AMDGPU/gfx10_asm_ds.s llvm/test/MC/AMDGPU/gfx10_asm_flat.s llvm/test/MC/AMDGPU/gfx10_asm_mubuf.s llvm/test/MC/AMDGPU/gfx10_asm_smem.s llvm/test/MC/AMDGPU/gfx10_asm_sop.s llvm/test/MC/AMDGPU/gfx10_asm_vop1.s llvm/test/MC/AMDGPU/gfx10_asm_vop2.s llvm/test/MC/AMDGPU/gfx10_asm_vopc.s llvm/test/MC/AMDGPU/gfx10_asm_vopc_e64.s llvm/test/MC/AMDGPU/gfx10_asm_vopc_sdwa.s llvm/test/MC/AMDGPU/gfx10_asm_vopcx.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-args-v3.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-args.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs-v3.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props-v3.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s llvm/test/MC/AMDGPU/hsa-metadata-kernel-debug-props.s llvm/test/MC/AMDGPU/hsa-wave-size.s llvm/test/MC/AMDGPU/regression/bug28165.s llvm/test/MC/AMDGPU/regression/bug28168.s llvm/test/MC/AMDGPU/regression/bug28413.s llvm/test/MC/AMDGPU/regression/bug28538.s Removed: diff --git a/llvm/test/MC/AMDGPU/add-sub-no-carry.s b/llvm/test/MC/AMDGPU/add-sub-no-carry.s index 2e3ac9d24376..1768b73b60af 100644 --- a/llvm/test/MC/AMDGPU/add-sub-no-carry.s +++ b/llvm/test/MC/AMDGPU/add-sub-no-carry.s @@ -1,7 +1,7 @@ -// RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck -check-prefixes=GFX9 %s +// RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=GFX9 %s -// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji %s 2>&1 | FileCheck -check-prefixes=ERR-VI,ERR-SICIVI --implicit-check-not=error: %s -// RUN: not llvm-mc -arch=amdgcn -mcpu=bonaire %s 2>&1 | FileCheck -check-prefixes=ERR-SICI,ERR-SICIVI --implicit-check-not=error: %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji %s 2>&1 | FileCheck --check-prefix=ERR-VI --implicit-check-not=error: %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=bonaire %s 2>&1 | FileCheck --check-prefix=ERR-SICI --implicit-check-not=error: %s // FIXME: pre-gfx9 errors should be more useful diff --git a/llvm/test/MC/AMDGPU/buf-fmt-d16-packed.s b/llvm/test/MC/AMDGPU/buf-fmt-d16-packed.s index ab51b14e5454..a9b5cfdfad64 100644 --- a/llvm/test/MC/AMDGPU/buf-fmt-d16-packed.s +++ b/llvm/test/MC/AMDGPU/buf-fmt-d16-packed.s @@ -1,7 +1,7 @@ -// RUN: llvm-mc -arch=amdgcn -mcpu=gfx810 -show-encoding %s | FileCheck -check-prefix=GCN -check-prefix=PACKED %s -// RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck -check-prefix=GCN -check-prefix=PACKED %s +// RUN: llvm-mc -arch=amdgcn -mcpu=gfx810 -show-encoding %s | FileCheck -check-prefix=PACKED %s +// RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck -check-prefix=PACKED %s -// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji 2>&1 %s | FileCheck -check-prefix=UNPACKED-ERR -check-prefix=GCN-ERR --implicit-check-not=error: %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji 2>&1 %s | FileCheck -check-prefix=UNPACKED-ERR --implicit-check-not=error: %s //===--===// diff --git a/llvm/test/MC/AMDGPU/buf-fmt-d16-unpacked.s b/llvm/test/MC/AMDGPU/buf-fmt-d16-unpacked.s index 78ca007171a5..045da853746d 100644 --- a/llvm/test/MC/AMDGPU/buf-fmt-d16-unpacked.s +++ b/llvm/test/MC/AMDGPU/buf-fmt-d16-unpacked.s @@ -1,6 +1,6 @@ -// RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck -check-prefix=GCN -check-prefix=UNPACKED %s -// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx810 2>&1 %s | FileCheck -check-prefix=PACKED-ERR -check-prefix=GCN-ERR --implicit-check-not=error: %s -// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 2>&1 %s | FileCheck -check-prefix=PACKED-ERR -check-prefix=GCN-ERR --implicit-check-not=error: %s +// RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck -check-prefix=UNPACKED %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx810 2>&1 %s | FileCheck -check-prefix=PACKED-ERR --implicit-check-not=error: %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx9
[llvm-branch-commits] [llvm] 05e90ce - [NFC] Disallow unused prefixes under llvm/test/CodeGen
Author: Mircea Trofin Date: 2021-01-11T12:32:18-08:00 New Revision: 05e90cefeb4bc5613b2cadedc2b8e2ecb2ed20ed URL: https://github.com/llvm/llvm-project/commit/05e90cefeb4bc5613b2cadedc2b8e2ecb2ed20ed DIFF: https://github.com/llvm/llvm-project/commit/05e90cefeb4bc5613b2cadedc2b8e2ecb2ed20ed.diff LOG: [NFC] Disallow unused prefixes under llvm/test/CodeGen This patch finishes addressing unused prefixes under CodeGen: 2 remaining tests fixed, and then undo-ing the lit.local.cfg changes under various subdirs and moving the policy under CodeGen. Differential Revision: https://reviews.llvm.org/D94430 Added: llvm/test/CodeGen/lit.local.cfg Modified: llvm/test/CodeGen/AMDGPU/lit.local.cfg llvm/test/CodeGen/ARM/speculation-hardening-sls.ll llvm/test/CodeGen/NVPTX/f16-instructions.ll llvm/test/CodeGen/PowerPC/lit.local.cfg llvm/test/CodeGen/X86/lit.local.cfg Removed: diff --git a/llvm/test/CodeGen/AMDGPU/lit.local.cfg b/llvm/test/CodeGen/AMDGPU/lit.local.cfg index 42f23b00ea9b..2a665f06be72 100644 --- a/llvm/test/CodeGen/AMDGPU/lit.local.cfg +++ b/llvm/test/CodeGen/AMDGPU/lit.local.cfg @@ -1,12 +1,2 @@ -from lit.llvm.subst import ToolSubst - if not 'AMDGPU' in config.root.targets: config.unsupported = True - -fc = ToolSubst('FileCheck', unresolved='fatal') -# Insert this first. Then, we'll first update the blank FileCheck command; then, -# the default substitution of FileCheck will replace it to its full path. -config.substitutions.insert(0, (fc.regex, -'FileCheck --allow-unused-prefixes=false')) - - diff --git a/llvm/test/CodeGen/ARM/speculation-hardening-sls.ll b/llvm/test/CodeGen/ARM/speculation-hardening-sls.ll index e62012faed88..7fe5a9ba2eb0 100644 --- a/llvm/test/CodeGen/ARM/speculation-hardening-sls.ll +++ b/llvm/test/CodeGen/ARM/speculation-hardening-sls.ll @@ -1,9 +1,9 @@ -; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,HARDEN,ISBDSB,ISBDSBDAGISEL -dump-input-context=100 -; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,HARDENTHUMB,HARDEN,ISBDSB,ISBDSBDAGISEL -dump-input-context=100 -; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,HARDEN,SB,SBDAGISEL -dump-input-context=100 -; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,HARDENTHUMB,HARDEN,SB,SBDAGISEL -dump-input-context=100 -; RUN: llc -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,NOHARDEN,NOHARDENARM -dump-input-context=100 -; RUN: llc -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,NOHARDEN,NOHARDENTHUMB +; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,HARDEN,ISBDSB -dump-input-context=100 +; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,HARDENTHUMB,HARDEN,ISBDSB -dump-input-context=100 +; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,HARDEN,SB -dump-input-context=100 +; RUN: llc -mattr=harden-sls-retbr -mattr=harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,HARDENTHUMB,HARDEN,SB -dump-input-context=100 +; RUN: llc -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,NOHARDENARM -dump-input-context=100 +; RUN: llc -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,NOHARDENTHUMB ; RUN: llc -global-isel -global-isel-abort=0 -mattr=harden-sls-retbr -mattr=harden-sls-blr -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,HARDEN,ISBDSB ; RUN: llc -global-isel -global-isel-abort=0 -mattr=harden-sls-retbr -mattr=harden-sls-blr -verify-machineinstrs -mtriple=thumbv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,HARDENTHUMB,HARDEN,ISBDSB ; RUN: llc -global-isel -global-isel-abort=0 -mattr=harden-sls-retbr -mattr=harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=armv8-linux-gnueabi < %s | FileCheck %s --check-prefixes=CHECK,ARM,HARDEN,SB diff --git a/llvm/test/CodeGen/NVPTX/f16-instructions.ll b/llvm/test/CodeGen/NVPTX/f16-instructions.ll index 3856cb63350d..b06316b48
[llvm-branch-commits] [llvm] 7200d2c - [NFC] Disallow unused prefixes in CodeGen/PowerPC tests.
Author: Mircea Trofin Date: 2021-01-11T09:24:52-08:00 New Revision: 7200d2cf0891ef56607fd0336029b33bd4097eed URL: https://github.com/llvm/llvm-project/commit/7200d2cf0891ef56607fd0336029b33bd4097eed DIFF: https://github.com/llvm/llvm-project/commit/7200d2cf0891ef56607fd0336029b33bd4097eed.diff LOG: [NFC] Disallow unused prefixes in CodeGen/PowerPC tests. Also removed where applicable. Differential Revision: https://reviews.llvm.org/D94385 Added: Modified: llvm/test/CodeGen/PowerPC/aix-lower-jump-table.ll llvm/test/CodeGen/PowerPC/aix32-cc-abi-vaarg.ll llvm/test/CodeGen/PowerPC/aix64-cc-abi-vaarg.ll llvm/test/CodeGen/PowerPC/lit.local.cfg llvm/test/CodeGen/PowerPC/lower-massv.ll llvm/test/CodeGen/PowerPC/popcnt-zext.ll llvm/test/CodeGen/PowerPC/ppc32-pic.ll llvm/test/CodeGen/PowerPC/srem-lkk.ll llvm/test/CodeGen/PowerPC/srem-vector-lkk.ll llvm/test/CodeGen/PowerPC/testComparesigeuc.ll llvm/test/CodeGen/PowerPC/testComparesigeui.ll llvm/test/CodeGen/PowerPC/testComparesigeull.ll llvm/test/CodeGen/PowerPC/testComparesigeus.ll llvm/test/CodeGen/PowerPC/testComparesileuc.ll llvm/test/CodeGen/PowerPC/testComparesileui.ll llvm/test/CodeGen/PowerPC/testComparesileull.ll llvm/test/CodeGen/PowerPC/testComparesileus.ll llvm/test/CodeGen/PowerPC/testComparesiltsc.ll llvm/test/CodeGen/PowerPC/testComparesiltsi.ll llvm/test/CodeGen/PowerPC/testComparesiltsll.ll llvm/test/CodeGen/PowerPC/testComparesiltss.ll llvm/test/CodeGen/PowerPC/testComparesiltuc.ll llvm/test/CodeGen/PowerPC/testComparesiltui.ll llvm/test/CodeGen/PowerPC/testComparesiltus.ll llvm/test/CodeGen/PowerPC/testComparesllgeuc.ll llvm/test/CodeGen/PowerPC/testComparesllgeui.ll llvm/test/CodeGen/PowerPC/testComparesllgeull.ll llvm/test/CodeGen/PowerPC/testComparesllgeus.ll llvm/test/CodeGen/PowerPC/testComparesllleuc.ll llvm/test/CodeGen/PowerPC/testComparesllleui.ll llvm/test/CodeGen/PowerPC/testComparesllleull.ll llvm/test/CodeGen/PowerPC/testComparesllleus.ll llvm/test/CodeGen/PowerPC/testComparesllltsll.ll llvm/test/CodeGen/PowerPC/testComparesllltuc.ll llvm/test/CodeGen/PowerPC/testComparesllltus.ll llvm/test/CodeGen/PowerPC/urem-lkk.ll llvm/test/CodeGen/PowerPC/vec_splat.ll llvm/test/CodeGen/PowerPC/vector-popcnt-128-ult-ugt.ll llvm/test/CodeGen/PowerPC/vmladduhm.ll Removed: diff --git a/llvm/test/CodeGen/PowerPC/aix-lower-jump-table.ll b/llvm/test/CodeGen/PowerPC/aix-lower-jump-table.ll index ec3d9c3c03f1..4201b7450a6a 100644 --- a/llvm/test/CodeGen/PowerPC/aix-lower-jump-table.ll +++ b/llvm/test/CodeGen/PowerPC/aix-lower-jump-table.ll @@ -27,10 +27,10 @@ ; RUN: --check-prefixes=64LARGE-ASM,LARGE-ASM %s ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -function-sections < %s | FileCheck \ -; RUN: --check-prefixes=FUNC-ASM,CHECK %s +; RUN: --check-prefix=FUNC-ASM %s ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -function-sections < %s | FileCheck \ -; RUN: --check-prefixes=FUNC-ASM,CHECK %s +; RUN: --check-prefix=FUNC-ASM %s define i32 @jump_table(i32 %a) { entry: diff --git a/llvm/test/CodeGen/PowerPC/aix32-cc-abi-vaarg.ll b/llvm/test/CodeGen/PowerPC/aix32-cc-abi-vaarg.ll index cb1544ef9756..e8821cb91577 100644 --- a/llvm/test/CodeGen/PowerPC/aix32-cc-abi-vaarg.ll +++ b/llvm/test/CodeGen/PowerPC/aix32-cc-abi-vaarg.ll @@ -1,9 +1,9 @@ ; RUN: llc -O2 -mtriple powerpc-ibm-aix-xcoff -stop-after=machine-cp -verify-machineinstrs < %s | \ -; RUN: FileCheck --check-prefixes=CHECK,32BIT %s +; RUN: FileCheck --check-prefix=32BIT %s ; RUN: llc -O2 -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ ; RUN: -mtriple powerpc-ibm-aix-xcoff < %s | \ -; RUN: FileCheck --check-prefixes=CHECKASM,ASM32 %s +; RUN: FileCheck --check-prefix=ASM32 %s define i32 @int_va_arg(i32 %a, ...) local_unnamed_addr { entry: diff --git a/llvm/test/CodeGen/PowerPC/aix64-cc-abi-vaarg.ll b/llvm/test/CodeGen/PowerPC/aix64-cc-abi-vaarg.ll index 7ee8dd0a3712..4c2daf3b4ecf 100644 --- a/llvm/test/CodeGen/PowerPC/aix64-cc-abi-vaarg.ll +++ b/llvm/test/CodeGen/PowerPC/aix64-cc-abi-vaarg.ll @@ -1,9 +1,9 @@ ; RUN: llc -O2 -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp -verify-machineinstrs < %s | \ -; RUN: FileCheck --check-prefixes=CHECK,64BIT %s +; RUN: FileCheck --check-prefix=64BIT %s ; RUN: llc -O2 -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec \ ; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s | \ -; RUN: FileCheck --check-prefixes=CHECKASM,ASM64 %s +; RUN: FileCheck --check-prefix=ASM64 %s define i32 @int_va_arg(i32 %a, ...) local_unnamed_addr { entry: diff --git a/llvm/test/CodeGen/PowerPC/lit.local.cfg b/llvm/test/CodeGen/PowerPC/lit.local.cfg index 1dbbf92fcf5e..19bfd981b645 100644 --- a/llvm/test/CodeGen/PowerPC/lit.local.cfg +++ b/llvm/test/CodeGen/PowerPC/lit.local.cfg @@ -1,4
[llvm-branch-commits] [llvm] 75c0432 - [NFC] Disallow unused prefixes in CodeGen/X86 tests.
Author: Mircea Trofin Date: 2021-01-09T11:43:32-08:00 New Revision: 75c04327a5ec1f3b7014ebc410f3ef5833537863 URL: https://github.com/llvm/llvm-project/commit/75c04327a5ec1f3b7014ebc410f3ef5833537863 DIFF: https://github.com/llvm/llvm-project/commit/75c04327a5ec1f3b7014ebc410f3ef5833537863.diff LOG: [NFC] Disallow unused prefixes in CodeGen/X86 tests. Also fixed remaining tests that featured unused prefixes. Differential Revision: https://reviews.llvm.org/D94330 Added: Modified: llvm/test/CodeGen/X86/fptosi-sat-scalar.ll llvm/test/CodeGen/X86/fptoui-sat-scalar.ll llvm/test/CodeGen/X86/lit.local.cfg llvm/test/CodeGen/X86/vector-pack-128.ll Removed: diff --git a/llvm/test/CodeGen/X86/fptosi-sat-scalar.ll b/llvm/test/CodeGen/X86/fptosi-sat-scalar.ll index 8c6ae0a389c3..f7a26c6a90b7 100644 --- a/llvm/test/CodeGen/X86/fptosi-sat-scalar.ll +++ b/llvm/test/CodeGen/X86/fptosi-sat-scalar.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=i686-linux | FileCheck %s --check-prefixes=X86,X86-X87 -; RUN: llc < %s -mtriple=i686-linux -mattr=+sse2 | FileCheck %s --check-prefixes=X86,X86-SSE +; RUN: llc < %s -mtriple=i686-linux | FileCheck %s --check-prefix=X86-X87 +; RUN: llc < %s -mtriple=i686-linux -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64 ; diff --git a/llvm/test/CodeGen/X86/fptoui-sat-scalar.ll b/llvm/test/CodeGen/X86/fptoui-sat-scalar.ll index 7ad02208a524..3b74e639eb42 100644 --- a/llvm/test/CodeGen/X86/fptoui-sat-scalar.ll +++ b/llvm/test/CodeGen/X86/fptoui-sat-scalar.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=i686-linux | FileCheck %s --check-prefixes=X86,X86-X87 -; RUN: llc < %s -mtriple=i686-linux -mattr=+sse2 | FileCheck %s --check-prefixes=X86,X86-SSE +; RUN: llc < %s -mtriple=i686-linux | FileCheck %s --check-prefix=X86-X87 +; RUN: llc < %s -mtriple=i686-linux -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64 ; diff --git a/llvm/test/CodeGen/X86/lit.local.cfg b/llvm/test/CodeGen/X86/lit.local.cfg index c8625f4d9d24..20e38ef77e31 100644 --- a/llvm/test/CodeGen/X86/lit.local.cfg +++ b/llvm/test/CodeGen/X86/lit.local.cfg @@ -1,2 +1,10 @@ +from lit.llvm.subst import ToolSubst + if not 'X86' in config.root.targets: config.unsupported = True + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=false')) diff --git a/llvm/test/CodeGen/X86/vector-pack-128.ll b/llvm/test/CodeGen/X86/vector-pack-128.ll index a49d0f9e3605..ab647c6b258b 100644 --- a/llvm/test/CodeGen/X86/vector-pack-128.ll +++ b/llvm/test/CodeGen/X86/vector-pack-128.ll @@ -3,8 +3,8 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.2 | FileCheck %s --check-prefixes=SSE,SSE4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx| FileCheck %s --check-prefixes=AVX,AVX1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512f | FileCheck %s --check-prefixes=AVX,AVX512,AVX512F -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512,AVX512BW +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512f | FileCheck %s --check-prefixes=AVX,AVX512 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512 ; trunc(concat(x,y)) -> pack ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a8bda3d - [NFC] Disallow unused prefixes in CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-08T11:49:23-08:00 New Revision: a8bda3df42565298e28a0424785a8522c41dcf78 URL: https://github.com/llvm/llvm-project/commit/a8bda3df42565298e28a0424785a8522c41dcf78 DIFF: https://github.com/llvm/llvm-project/commit/a8bda3df42565298e28a0424785a8522c41dcf78.diff LOG: [NFC] Disallow unused prefixes in CodeGen/AMDGPU This adds the lit config, and cleans up remaining tests. Differential Revision: https://reviews.llvm.org/D94245 Added: Modified: llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f16.ll llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f32.ll llvm/test/CodeGen/AMDGPU/lit.local.cfg llvm/test/CodeGen/AMDGPU/non-entry-alloca.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f16.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f16.ll index c7b9b4f60bc65..47bf7004f0ffa 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f16.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f16.ll @@ -3,11 +3,11 @@ ; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX6,GFX6-IEEE %s ; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX6,GFX6-FLUSH %s -; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX8,GFX8-IEEE %s -; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX8,GFX8-FLUSH %s +; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX8 %s +; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX8 %s -; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX9,GFX9-IEEE %s -; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX9,GFX9-FLUSH %s +; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX9 %s +; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX89,GFX9 %s define half @v_fdiv_f16(half %a, half %b) { ; GFX6-IEEE-LABEL: v_fdiv_f16: diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f32.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f32.ll index a29c96b93f56f..d1d31e9c1f1f8 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f32.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f32.ll @@ -1,12 +1,12 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-IEEE,GFX6,GFX6-IEEE %s -; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-FLUSH,GFX6,GFX6-FLUSH %s +; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-IEEE,GFX6-IEEE %s +; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-FLUSH,GFX6-FLUSH %s -; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-IEEE,GFX89-IEEE,GFX89,GFX8,GFX8-IEEE %s -; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-FLUSH,GFX89,GFX89-FLUSH,GFX8,GFX8-FLUSH %s +; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-IEEE,GFX89-IEEE %s +; RUN: llc -global-isel -march=amdgcn -mcpu=fiji -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-FLUSH,GFX89-FLUSH %s -; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-IEEE,GFX89,GFX89-IEEE,GFX9,GFX9-IEEE %s -; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=preserve-sign -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-FLUSH,GFX89,GFX89-FLUSH,GFX9,GFX9-FLUSH %s +; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -denormal-fp-math=ieee -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GCN-IEEE,GFX89-IEEE %s +; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900
[llvm-branch-commits] [llvm] ee57d30 - [NFC] Removed unused prefixes from CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-07T09:48:14-08:00 New Revision: ee57d30f4487548d844cc3ffa5895bd3c6b38585 URL: https://github.com/llvm/llvm-project/commit/ee57d30f4487548d844cc3ffa5895bd3c6b38585 DIFF: https://github.com/llvm/llvm-project/commit/ee57d30f4487548d844cc3ffa5895bd3c6b38585.diff LOG: [NFC] Removed unused prefixes from CodeGen/AMDGPU Last bulk batch. Differential Revision: https://reviews.llvm.org/D94236 Added: Modified: llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll llvm/test/CodeGen/AMDGPU/uaddsat.ll llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll llvm/test/CodeGen/AMDGPU/unsupported-calls.ll llvm/test/CodeGen/AMDGPU/usubsat.ll llvm/test/CodeGen/AMDGPU/v_mac.ll llvm/test/CodeGen/AMDGPU/v_madak_f16.ll llvm/test/CodeGen/AMDGPU/vccz-corrupt-bug-workaround.mir llvm/test/CodeGen/AMDGPU/vector-alloca.ll llvm/test/CodeGen/AMDGPU/vgpr-spill.mir llvm/test/CodeGen/AMDGPU/widen-smrd-loads.ll llvm/test/CodeGen/AMDGPU/wqm.ll llvm/test/CodeGen/AMDGPU/xnor.ll llvm/test/CodeGen/AMDGPU/zero_extend.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll b/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll index 112c49953561..8027c89ef374 100644 --- a/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll +++ b/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll @@ -1,5 +1,5 @@ -; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,SI %s -; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs< %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI %s +; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -enable-var-scope --check-prefix=GCN %s +; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs< %s | FileCheck -enable-var-scope --check-prefix=GCN %s ; GCN-LABEL: {{^}}global_truncstore_i32_to_i1: diff --git a/llvm/test/CodeGen/AMDGPU/uaddsat.ll b/llvm/test/CodeGen/AMDGPU/uaddsat.ll index 56e4123e182a..5447d5ea0b75 100644 --- a/llvm/test/CodeGen/AMDGPU/uaddsat.ll +++ b/llvm/test/CodeGen/AMDGPU/uaddsat.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck -check-prefixes=GCN,GFX6 %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=fiji < %s | FileCheck -check-prefixes=GCN,GFX8 %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GFX9 %s +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck --check-prefix=GFX6 %s +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=fiji < %s | FileCheck --check-prefix=GFX8 %s +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck --check-prefix=GFX9 %s define i8 @v_uaddsat_i8(i8 %lhs, i8 %rhs) { ; GFX6-LABEL: v_uaddsat_i8: diff --git a/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll b/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll index d2799d731752..aa1971a3fdbe 100644 --- a/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll +++ b/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll @@ -1,5 +1,5 @@ -; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,FUNC %s +; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,FUNC %s ; FIXME: This should be merged with uint_to_fp.ll, but s_uint_to_fp_v2i64 crashes on r600 diff --git a/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll b/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll index 562c63ecdb56..8fd7c2070fda 100644 --- a/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll +++ b/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll @@ -1,6 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=amdgcn-amdhsa -verify-machineinstrs -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s +; RUN: llc -mtriple=amdgcn-amdhsa -verify-machineinstrs -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck -check-prefix=GCN %s ; RUN: opt -S -si-annotate-control-flow -mtriple=amdgcn-amdhsa -verify-machineinstrs -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck -check-prefix=SI-OPT %s define hidden void @widget() { diff --git a/llvm/test/CodeGen/AMDGPU/unsupported-calls.ll b/llvm/test/CodeGen/AMDGPU/unsupported-calls.ll index 44c33347c9b5..62a2c1348c41 10064
[llvm-branch-commits] [llvm] e881a25 - [NFC] Removed unused prefixes in CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-07T08:00:11-08:00 New Revision: e881a25f1e110b259030745b3592418ea0c8efe8 URL: https://github.com/llvm/llvm-project/commit/e881a25f1e110b259030745b3592418ea0c8efe8 DIFF: https://github.com/llvm/llvm-project/commit/e881a25f1e110b259030745b3592418ea0c8efe8.diff LOG: [NFC] Removed unused prefixes in CodeGen/AMDGPU This covers tests starting with s. Differential Revision: https://reviews.llvm.org/D94184 Added: Modified: llvm/test/CodeGen/AMDGPU/s_code_end.ll llvm/test/CodeGen/AMDGPU/saddo.ll llvm/test/CodeGen/AMDGPU/saddsat.ll llvm/test/CodeGen/AMDGPU/scalar_to_vector.ll llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit2.ll llvm/test/CodeGen/AMDGPU/scratch-simple.ll llvm/test/CodeGen/AMDGPU/sdiv.ll llvm/test/CodeGen/AMDGPU/sdwa-vop2-64bit.mir llvm/test/CodeGen/AMDGPU/select-fabs-fneg-extract-legacy.ll llvm/test/CodeGen/AMDGPU/select.f16.ll llvm/test/CodeGen/AMDGPU/sendmsg-m0-hazard.mir llvm/test/CodeGen/AMDGPU/setcc-fneg-constant.ll llvm/test/CodeGen/AMDGPU/setcc64.ll llvm/test/CodeGen/AMDGPU/sext-in-reg.ll llvm/test/CodeGen/AMDGPU/shift-i64-opts.ll llvm/test/CodeGen/AMDGPU/shl.ll llvm/test/CodeGen/AMDGPU/shl.v2i16.ll llvm/test/CodeGen/AMDGPU/shl_add_ptr_csub.ll llvm/test/CodeGen/AMDGPU/shl_add_ptr_global.ll llvm/test/CodeGen/AMDGPU/shrink-add-sub-constant.ll llvm/test/CodeGen/AMDGPU/sibling-call.ll llvm/test/CodeGen/AMDGPU/sign_extend.ll llvm/test/CodeGen/AMDGPU/sint_to_fp.i64.ll llvm/test/CodeGen/AMDGPU/skip-branch-trap.ll llvm/test/CodeGen/AMDGPU/smrd.ll llvm/test/CodeGen/AMDGPU/spill-agpr-partially-undef.mir llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll llvm/test/CodeGen/AMDGPU/spill-special-sgpr.mir llvm/test/CodeGen/AMDGPU/ssubsat.ll llvm/test/CodeGen/AMDGPU/store-local.128.ll llvm/test/CodeGen/AMDGPU/store-local.96.ll llvm/test/CodeGen/AMDGPU/store-weird-sizes.ll llvm/test/CodeGen/AMDGPU/sub.v2i16.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/s_code_end.ll b/llvm/test/CodeGen/AMDGPU/s_code_end.ll index 80f49427f56e..2c7ce12f8f30 100644 --- a/llvm/test/CodeGen/AMDGPU/s_code_end.ll +++ b/llvm/test/CodeGen/AMDGPU/s_code_end.ll @@ -1,7 +1,7 @@ -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -asm-verbose=0 < %s | FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END,GFX10END-ASM %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=obj < %s | llvm-objdump --arch=amdgcn --mcpu=gfx1010 -d - | FileCheck --check-prefixes=GCN,GCN-OBJ,GFX10END,GFX10END-OBJ %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -asm-verbose=0 < %s | FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END,GFX10END-ASM %s -; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -asm-verbose=0 < %s | FileCheck -check-prefixes=GCN,GCN-ASM,GFX10NOEND,GFX10NOEND-ASM %s +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -asm-verbose=0 < %s | FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END-ASM %s +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=obj < %s | llvm-objdump --arch=amdgcn --mcpu=gfx1010 -d - | FileCheck --check-prefixes=GCN,GCN-OBJ,GFX10END-OBJ %s +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -asm-verbose=0 < %s | FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END-ASM %s +; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -asm-verbose=0 < %s | FileCheck -check-prefixes=GCN,GCN-ASM,GFX10NOEND %s ; RUN: llc -mtriple=amdgcn-- -mcpu=gfx1010 -filetype=obj < %s | llvm-objdump --arch=amdgcn --mcpu=gfx1010 -d - | FileCheck --check-prefixes=GCN,GCN-OBJ,GFX10NOEND,GFX10NOEND-OBJ %s ; GCN:a_kernel1{{>?}}: diff --git a/llvm/test/CodeGen/AMDGPU/saddo.ll b/llvm/test/CodeGen/AMDGPU/saddo.ll index d01dbbfce000..0a223e8ba2c2 100644 --- a/llvm/test/CodeGen/AMDGPU/saddo.ll +++ b/llvm/test/CodeGen/AMDGPU/saddo.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tahiti -verify-machineinstrs | FileCheck %s -check-prefixes=FUNC,GCN,SICIVI,SI -; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s -check-prefixes=FUNC,GCN,SICIVI,VI -; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck %s -check-prefixes=FUNC,GCN,GFX9 +; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tahiti -verify-machineinstrs | FileCheck %s --check-prefix=SI +; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s --check-prefix=VI +; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck %s --check-prefix=GFX9 declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32)
[llvm-branch-commits] [llvm] 90347ab - [NFC] Removed unused prefixes in CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-06T10:32:44-08:00 New Revision: 90347ab96f25c913c832b86c69efa525db7bd039 URL: https://github.com/llvm/llvm-project/commit/90347ab96f25c913c832b86c69efa525db7bd039 DIFF: https://github.com/llvm/llvm-project/commit/90347ab96f25c913c832b86c69efa525db7bd039.diff LOG: [NFC] Removed unused prefixes in CodeGen/AMDGPU This covers tests starting with m-r. Differential Revision: https://reviews.llvm.org/D94181 Added: Modified: llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll llvm/test/CodeGen/AMDGPU/mad-mix-lo.ll llvm/test/CodeGen/AMDGPU/max.i16.ll llvm/test/CodeGen/AMDGPU/med3-no-simplify.ll llvm/test/CodeGen/AMDGPU/min.ll llvm/test/CodeGen/AMDGPU/mixed-wave32-wave64.ll llvm/test/CodeGen/AMDGPU/move-to-valu-atomicrmw.ll llvm/test/CodeGen/AMDGPU/mul.i16.ll llvm/test/CodeGen/AMDGPU/nand.ll llvm/test/CodeGen/AMDGPU/nested-calls.ll llvm/test/CodeGen/AMDGPU/nor.ll llvm/test/CodeGen/AMDGPU/omod.ll llvm/test/CodeGen/AMDGPU/opencl-image-metadata.ll llvm/test/CodeGen/AMDGPU/pack.v2f16.ll llvm/test/CodeGen/AMDGPU/pack.v2i16.ll llvm/test/CodeGen/AMDGPU/packed-op-sel.ll llvm/test/CodeGen/AMDGPU/partial-shift-shrink.ll llvm/test/CodeGen/AMDGPU/preserve-hi16.ll llvm/test/CodeGen/AMDGPU/private-access-no-objects.ll llvm/test/CodeGen/AMDGPU/private-element-size.ll llvm/test/CodeGen/AMDGPU/r600.bitcast.ll llvm/test/CodeGen/AMDGPU/reduce-load-width-alignment.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll b/llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll index f20e29f17849..2b3bdf1974c4 100644 --- a/llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll +++ b/llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll @@ -1,6 +1,6 @@ ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX9 %s -; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CIVI,VI %s -; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CIVI,CI %s +; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -enable-var-scope --check-prefix=GCN %s +; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope --check-prefix=GCN %s ; GCN-LABEL: {{^}}v_mad_mixhi_f16_f16lo_f16lo_f16lo_undeflo: ; GFX9: s_waitcnt diff --git a/llvm/test/CodeGen/AMDGPU/mad-mix-lo.ll b/llvm/test/CodeGen/AMDGPU/mad-mix-lo.ll index db2ed78a15f0..f08ed4843417 100644 --- a/llvm/test/CodeGen/AMDGPU/mad-mix-lo.ll +++ b/llvm/test/CodeGen/AMDGPU/mad-mix-lo.ll @@ -1,5 +1,5 @@ ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -enable-misched=false < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX9 %s -; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs -enable-misched=false < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CIVI,VI %s +; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs -enable-misched=false < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CIVI %s ; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs -enable-misched=false < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CIVI,CI %s ; GCN-LABEL: mixlo_simple: diff --git a/llvm/test/CodeGen/AMDGPU/max.i16.ll b/llvm/test/CodeGen/AMDGPU/max.i16.ll index 90e565020688..dfbdd2b1f92a 100644 --- a/llvm/test/CodeGen/AMDGPU/max.i16.ll +++ b/llvm/test/CodeGen/AMDGPU/max.i16.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=amdgcn-- -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GCN,VIPLUS,VI -; RUN: llc -mtriple=amdgcn-- -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GCN,VIPLUS,GFX9 +; RUN: llc -mtriple=amdgcn-- -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck %s --check-prefix=VI +; RUN: llc -mtriple=amdgcn-- -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck %s --check-prefix=GFX9 ; FIXME: Need to handle non-uniform case for function below (load without gep). define amdgpu_kernel void @v_test_imax_sge_i16(i16 addrspace(1)* %out, i16 addrspace(1)* %aptr, i16 addrspace(1)* %bptr) nounwind { diff --git a/llvm/test/CodeGen/AMDGPU/med3-no-simplify.ll b/llvm/test/CodeGen/AMDGPU/med3-no-simplify.ll index 0d00c9a5e8e5..efa104b732f5 100644 --- a/llvm/test/CodeGen/AMDGPU/med3-no-simplify.ll +++ b/llvm/test/CodeGen/AMDGPU/med3-no-simplify.ll @@ -1,6 +1,6 @@ -; RUN: llc -march=amdgcn -verify-machineinstrs -amdgpu-scalar-ir-passes=false < %s | FileCheck -check-prefix=GCN -check-prefix=SICIVI -check-prefix=SI %s -; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs -amdgpu-scalar-ir-passes=false < %s | F
[llvm-branch-commits] [llvm] b470630 - [NFC] Removed unused prefixes from CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-06T09:34:11-08:00 New Revision: b47063091304410e77cf2e03913d9f093b3ef60d URL: https://github.com/llvm/llvm-project/commit/b47063091304410e77cf2e03913d9f093b3ef60d DIFF: https://github.com/llvm/llvm-project/commit/b47063091304410e77cf2e03913d9f093b3ef60d.diff LOG: [NFC] Removed unused prefixes from CodeGen/AMDGPU All the 'l'-starting tests. Differential Revision: https://reviews.llvm.org/D94151 Added: Modified: llvm/test/CodeGen/AMDGPU/large-alloca-compute.ll llvm/test/CodeGen/AMDGPU/lds-alignment.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.buffer.store.format.d16.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cos.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cubeid.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cubema.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cubesc.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cubetc.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.sema.br.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.sema.p.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.sema.release.all.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.sema.v.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fract.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.d16.dim.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.gather4.d16.dim.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.interp.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.log.clamp.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.atomic.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.load.format.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.load.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.store.format.d16.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.tbuffer.store.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.memrealtime.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.memtime.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sbfe.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sendmsg.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.set.inactive.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sin.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.atomic.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.store.format.d16.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.tbuffer.load.d16.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.tbuffer.store.d16.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.tbuffer.store.d16.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ubfe.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.workgroup.id.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.workitem.id.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.writelane.ll llvm/test/CodeGen/AMDGPU/llvm.cos.f16.ll llvm/test/CodeGen/AMDGPU/llvm.fmuladd.f16.ll llvm/test/CodeGen/AMDGPU/llvm.log.f16.ll llvm/test/CodeGen/AMDGPU/llvm.log.ll llvm/test/CodeGen/AMDGPU/llvm.log10.f16.ll llvm/test/CodeGen/AMDGPU/llvm.log10.ll llvm/test/CodeGen/AMDGPU/llvm.maxnum.f16.ll llvm/test/CodeGen/AMDGPU/llvm.mulo.ll llvm/test/CodeGen/AMDGPU/llvm.r600.read.local.size.ll llvm/test/CodeGen/AMDGPU/llvm.rint.f16.ll llvm/test/CodeGen/AMDGPU/llvm.round.ll llvm/test/CodeGen/AMDGPU/llvm.sin.f16.ll llvm/test/CodeGen/AMDGPU/load-constant-i16.ll llvm/test/CodeGen/AMDGPU/load-constant-i64.ll llvm/test/CodeGen/AMDGPU/load-global-f32.ll llvm/test/CodeGen/AMDGPU/load-global-f64.ll llvm/test/CodeGen/AMDGPU/load-global-i16.ll llvm/test/CodeGen/AMDGPU/load-global-i64.ll llvm/test/CodeGen/AMDGPU/load-lo16.ll llvm/test/CodeGen/AMDGPU/load-local-f64.ll llvm/test/CodeGen/AMDGPU/load-local-i32.ll llvm/test/CodeGen/AMDGPU/load-local.128.ll llvm/test/CodeGen/AMDGPU/load-local.96.ll llvm/test/CodeGen/AMDGPU/load-weird-sizes.ll llvm/test/CodeGen/AMDGPU/local-atomics64.ll llvm/test/CodeGen/AMDGPU/local-memory.ll llvm/test/CodeGen/AMDGPU/local-stack-alloc-block-sp-reference.ll llvm/test/CodeGen/AMDGPU/lshr.v2i16.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/large-alloca-compute.ll b/llvm/test/CodeGen/AMDGPU/large-alloca-compute.ll index c9e6147302ea..7a784611df8f 100644 --- a/llvm/test/CodeGen/AMDGPU/large-alloca-compute.ll +++ b/llvm/test/CodeGen/AMDGPU/large-alloca-compute.ll @@ -1,9 +1,9 @@ -; RUN: llc -march=amdgcn -mcpu=bonaire -show-mc-encoding < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=ALL %s -; RUN: llc -march=amdgcn -mcpu=carrizo --show-mc-encoding < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=ALL %s -; RUN: llc -march=amdgcn -mcpu=gfx900 --show-mc-encoding < %s | FileCheck -check-prefix=GCN -check-prefix=GFX9 -check-prefix=ALL %s -; RUN: llc -march=amdgcn -mcpu=bonaire -mtriple=
[llvm-branch-commits] [llvm] c1cd42d - [NFC] Removed unused prefixes in CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-05T20:22:40-08:00 New Revision: c1cd42d698488f8c92f012d0cfa4f5617aebb803 URL: https://github.com/llvm/llvm-project/commit/c1cd42d698488f8c92f012d0cfa4f5617aebb803 DIFF: https://github.com/llvm/llvm-project/commit/c1cd42d698488f8c92f012d0cfa4f5617aebb803.diff LOG: [NFC] Removed unused prefixes in CodeGen/AMDGPU This covers the tests starting with h-k. Differential Revision: https://reviews.llvm.org/D94147 Added: Modified: llvm/test/CodeGen/AMDGPU/hazard-buffer-store-v-interp.mir llvm/test/CodeGen/AMDGPU/hazard-hidden-bundle.mir llvm/test/CodeGen/AMDGPU/hsa-metadata-enqueue-kernel-v3.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-enqueue-kernel.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full-v3.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args-v3.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-images-v3.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-images.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-kernel-code-props-v3.ll llvm/test/CodeGen/AMDGPU/hsa-metadata-kernel-code-props.ll llvm/test/CodeGen/AMDGPU/imm16.ll llvm/test/CodeGen/AMDGPU/immv216.ll llvm/test/CodeGen/AMDGPU/indirect-addressing-si-gfx9.ll llvm/test/CodeGen/AMDGPU/indirect-addressing-si-pregfx9.ll llvm/test/CodeGen/AMDGPU/indirect-addressing-si.ll llvm/test/CodeGen/AMDGPU/indirect-private-64.ll llvm/test/CodeGen/AMDGPU/inlineasm-packed.ll llvm/test/CodeGen/AMDGPU/insert_vector_elt.ll llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.subtest-nosaddr.ll llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.subtest-saddr.ll llvm/test/CodeGen/AMDGPU/kernel-argument-dag-lowering.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/hazard-buffer-store-v-interp.mir b/llvm/test/CodeGen/AMDGPU/hazard-buffer-store-v-interp.mir index a8c82e6cf254..3b9e94764ddf 100644 --- a/llvm/test/CodeGen/AMDGPU/hazard-buffer-store-v-interp.mir +++ b/llvm/test/CodeGen/AMDGPU/hazard-buffer-store-v-interp.mir @@ -1,5 +1,5 @@ -# RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN -check-prefix=VI %s -# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN -check-prefix=GFX9 %s +# RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN %s +# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN %s # GCN-LABEL: name: hazard_buffer_store_v_interp # GCN:bb.0.entry: diff --git a/llvm/test/CodeGen/AMDGPU/hazard-hidden-bundle.mir b/llvm/test/CodeGen/AMDGPU/hazard-hidden-bundle.mir index b02b6b0664bc..9b32e5317b1b 100644 --- a/llvm/test/CodeGen/AMDGPU/hazard-hidden-bundle.mir +++ b/llvm/test/CodeGen/AMDGPU/hazard-hidden-bundle.mir @@ -1,6 +1,6 @@ -# RUN: llc -march=amdgcn -mcpu=gfx902 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,XNACK,GCX9 %s +# RUN: llc -march=amdgcn -mcpu=gfx902 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,XNACK %s # RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,NOXNACK,GFX9 %s -# RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,NOXNACK,GFX10 %s +# RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,NOXNACK %s # GCN-LABEL: name: break_smem_clause_simple_load_smrd8_ptr_hidden_bundle # GCN: bb.0: diff --git a/llvm/test/CodeGen/AMDGPU/hsa-metadata-enqueue-kernel-v3.ll b/llvm/test/CodeGen/AMDGPU/hsa-metadata-enqueue-kernel-v3.ll index 68d0df1e04cf..f475f4a6c631 100644 --- a/llvm/test/CodeGen/AMDGPU/hsa-metadata-enqueue-kernel-v3.ll +++ b/llvm/test/CodeGen/AMDGPU/hsa-metadata-enqueue-kernel-v3.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readelf --notes - | FileCheck --check-prefix=CHECK --check-prefix=GFX900 --check-prefix=NOTES %s +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readelf --notes - | FileCheck --check-prefix=CHECK %s ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-dump-hsa-metadata -amdgpu-verify-hsa-metadata -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s ; CHECK: --- diff --git a/llvm/test/CodeGen/AMDGPU/hsa-metad
[llvm-branch-commits] [llvm] cdfd4c5 - [NFC] Removed unused prefixes in test/CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-05T19:18:30-08:00 New Revision: cdfd4c5c1a9740b881eccb622b3bea474a26f1f9 URL: https://github.com/llvm/llvm-project/commit/cdfd4c5c1a9740b881eccb622b3bea474a26f1f9 DIFF: https://github.com/llvm/llvm-project/commit/cdfd4c5c1a9740b881eccb622b3bea474a26f1f9.diff LOG: [NFC] Removed unused prefixes in test/CodeGen/AMDGPU More patches to follow. This covers the pertinent tests starting with e, f, and g. Differential Revision: https://reviews.llvm.org/D94124 Added: Modified: llvm/test/CodeGen/AMDGPU/elf-notes.ll llvm/test/CodeGen/AMDGPU/extload-align.ll llvm/test/CodeGen/AMDGPU/extload.ll llvm/test/CodeGen/AMDGPU/extract_vector_elt-i16.ll llvm/test/CodeGen/AMDGPU/fast-regalloc-bundles.mir llvm/test/CodeGen/AMDGPU/fast-unaligned-load-store.global.ll llvm/test/CodeGen/AMDGPU/fast-unaligned-load-store.private.ll llvm/test/CodeGen/AMDGPU/fcopysign.f16.ll llvm/test/CodeGen/AMDGPU/flat-address-space.ll llvm/test/CodeGen/AMDGPU/flat-scratch.ll llvm/test/CodeGen/AMDGPU/fmad-formation-fmul-distribute-denormal-mode.ll llvm/test/CodeGen/AMDGPU/fmax_legacy.ll llvm/test/CodeGen/AMDGPU/fmin_fmax_legacy.amdgcn.ll llvm/test/CodeGen/AMDGPU/fmin_legacy.ll llvm/test/CodeGen/AMDGPU/fminnum.f64.ll llvm/test/CodeGen/AMDGPU/fmuladd.f16.ll llvm/test/CodeGen/AMDGPU/fmuladd.f32.ll llvm/test/CodeGen/AMDGPU/fmuladd.v2f16.ll llvm/test/CodeGen/AMDGPU/fneg-combines.ll llvm/test/CodeGen/AMDGPU/fneg-combines.si.ll llvm/test/CodeGen/AMDGPU/fneg-fabs.f16.ll llvm/test/CodeGen/AMDGPU/fneg-fabs.ll llvm/test/CodeGen/AMDGPU/force-alwaysinline-lds-global-address.ll llvm/test/CodeGen/AMDGPU/fp_to_sint.ll llvm/test/CodeGen/AMDGPU/fpext-free.ll llvm/test/CodeGen/AMDGPU/fpext.f16.ll llvm/test/CodeGen/AMDGPU/fract.f64.ll llvm/test/CodeGen/AMDGPU/fract.ll llvm/test/CodeGen/AMDGPU/frem.ll llvm/test/CodeGen/AMDGPU/fshl.ll llvm/test/CodeGen/AMDGPU/fshr.ll llvm/test/CodeGen/AMDGPU/fsub.f16.ll llvm/test/CodeGen/AMDGPU/function-args.ll llvm/test/CodeGen/AMDGPU/gfx-callable-argument-types.ll llvm/test/CodeGen/AMDGPU/gfx-callable-preserved-registers.ll llvm/test/CodeGen/AMDGPU/global-saddr-atomics.gfx1030.ll llvm/test/CodeGen/AMDGPU/global-saddr-atomics.gfx908.ll llvm/test/CodeGen/AMDGPU/gv-const-addrspace.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/elf-notes.ll b/llvm/test/CodeGen/AMDGPU/elf-notes.ll index fa262752fbc7..05ac3c92f4ba 100644 --- a/llvm/test/CodeGen/AMDGPU/elf-notes.ll +++ b/llvm/test/CodeGen/AMDGPU/elf-notes.ll @@ -1,12 +1,12 @@ -; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=gfx802 --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=iceland --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=gfx802 -filetype=obj --amdhsa-code-object-version=2 < %s | llvm-readelf --notes - | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK-ELF --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx802 --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=iceland --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx802 -filetype=obj --amdhsa-code-object-version=2 < %s | llvm-readelf --notes - | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA-ELF --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx802 --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-PAL --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=iceland --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=GCN --check-prefix=OSABI-PAL --check-prefix=GFX802 %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx802 -filetype=obj --amdhsa-code-object-version=2 < %s | llvm-readelf --notes - | FileCheck --check-prefix=GCN --check-prefix=OSABI-PAL-ELF --check-prefix=GFX802 %s +; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=gfx802 --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=OSABI-UNK %s +; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=iceland --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=OSABI-UNK %s +; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=gfx802 -filetype=obj --amdhsa-code-object-version=2 < %s | llvm-readelf --notes - | FileCheck --check-prefix=OSABI-UNK-ELF %s +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx802 --amdhsa-code-object-version=2 < %s | FileCheck --check-prefix=OSABI-HSA %s +; RUN: llc -mtriple=amdgcn-a
[llvm-branch-commits] [llvm] 1ebe86a - [NFC] Removed unused prefixes in test/CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-05T14:16:52-08:00 New Revision: 1ebe86adf52cbddc03f535554b16585b2947b32c URL: https://github.com/llvm/llvm-project/commit/1ebe86adf52cbddc03f535554b16585b2947b32c DIFF: https://github.com/llvm/llvm-project/commit/1ebe86adf52cbddc03f535554b16585b2947b32c.diff LOG: [NFC] Removed unused prefixes in test/CodeGen/AMDGPU More patches to follow. Differential Revision: https://reviews.llvm.org/D94121 Added: Modified: llvm/test/CodeGen/AMDGPU/bfm.ll llvm/test/CodeGen/AMDGPU/bitreverse.ll llvm/test/CodeGen/AMDGPU/break-smem-soft-clauses.mir llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir llvm/test/CodeGen/AMDGPU/bswap.ll llvm/test/CodeGen/AMDGPU/byval-frame-setup.ll llvm/test/CodeGen/AMDGPU/call-encoding.ll llvm/test/CodeGen/AMDGPU/callee-frame-setup.ll llvm/test/CodeGen/AMDGPU/cgp-addressing-modes-flat.ll llvm/test/CodeGen/AMDGPU/clamp.ll llvm/test/CodeGen/AMDGPU/code-object-v3.ll llvm/test/CodeGen/AMDGPU/commute-compares.ll llvm/test/CodeGen/AMDGPU/commute-shifts.ll llvm/test/CodeGen/AMDGPU/concat_vectors.ll llvm/test/CodeGen/AMDGPU/copy-illegal-type.ll llvm/test/CodeGen/AMDGPU/ctlz.ll llvm/test/CodeGen/AMDGPU/cube.ll llvm/test/CodeGen/AMDGPU/debug.ll llvm/test/CodeGen/AMDGPU/diverge-extra-formal-args.ll llvm/test/CodeGen/AMDGPU/diverge-interp-mov-lower.ll llvm/test/CodeGen/AMDGPU/drop-mem-operand-move-smrd.ll llvm/test/CodeGen/AMDGPU/ds-sub-offset.ll llvm/test/CodeGen/AMDGPU/ds_read2.ll llvm/test/CodeGen/AMDGPU/ds_read2_superreg.ll llvm/test/CodeGen/AMDGPU/ds_write2.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/bfm.ll b/llvm/test/CodeGen/AMDGPU/bfm.ll index 5673995588da..06e03c0a934a 100644 --- a/llvm/test/CodeGen/AMDGPU/bfm.ll +++ b/llvm/test/CodeGen/AMDGPU/bfm.ll @@ -1,6 +1,6 @@ -; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s -; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck --check-prefixes=SI,FUNC %s +; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=SI,FUNC %s +; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC %s ; FUNC-LABEL: {{^}}bfm_pattern: ; SI: s_bfm_b32 {{s[0-9]+}}, {{s[0-9]+}}, {{s[0-9]+}} diff --git a/llvm/test/CodeGen/AMDGPU/bitreverse.ll b/llvm/test/CodeGen/AMDGPU/bitreverse.ll index 55ae15218a44..d6dc59a60dbf 100644 --- a/llvm/test/CodeGen/AMDGPU/bitreverse.ll +++ b/llvm/test/CodeGen/AMDGPU/bitreverse.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=amdgcn-- -mcpu=tahiti -verify-machineinstrs | FileCheck %s --check-prefixes=FUNC,SI -; RUN: llc < %s -mtriple=amdgcn-- -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs | FileCheck %s --check-prefixes=FUNC,FLAT,TONGA -; RUN: llc < %s -mtriple=amdgcn-- -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs | FileCheck %s --check-prefixes=FUNC,FLAT,VI +; RUN: llc < %s -mtriple=amdgcn-- -mcpu=tahiti -verify-machineinstrs | FileCheck %s --check-prefix=SI +; RUN: llc < %s -mtriple=amdgcn-- -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs | FileCheck %s --check-prefix=FLAT +; RUN: llc < %s -mtriple=amdgcn-- -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs | FileCheck %s --check-prefix=FLAT declare i32 @llvm.amdgcn.workitem.id.x() #1 diff --git a/llvm/test/CodeGen/AMDGPU/break-smem-soft-clauses.mir b/llvm/test/CodeGen/AMDGPU/break-smem-soft-clauses.mir index fa482532338e..bc172a33d512 100644 --- a/llvm/test/CodeGen/AMDGPU/break-smem-soft-clauses.mir +++ b/llvm/test/CodeGen/AMDGPU/break-smem-soft-clauses.mir @@ -1,5 +1,5 @@ # RUN: llc -march=amdgcn -mcpu=carrizo -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,XNACK %s -# RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefixes=GCN,NOXNACK %s +# RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck --check-prefix=GCN %s --- # Trivial clause at beginning of program diff --git a/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir b/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir index 39afa4c4515f..a4b71ed2fee6 100644 --- a/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir +++ b/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir @@ -2,7 +2,7 @@ # Make sure the default assumption is xnack enabled with no cpu # RUN: llc -march
[llvm-branch-commits] [llvm] bec987e - [NFC] Removed unused prefixes in CodeGen/AMDGPU
Author: Mircea Trofin Date: 2021-01-05T14:10:03-08:00 New Revision: bec987ea6727f18e1512636804367c3695f51b6f URL: https://github.com/llvm/llvm-project/commit/bec987ea6727f18e1512636804367c3695f51b6f DIFF: https://github.com/llvm/llvm-project/commit/bec987ea6727f18e1512636804367c3695f51b6f.diff LOG: [NFC] Removed unused prefixes in CodeGen/AMDGPU This is part of the pertinent tests, more to follow in subsequent patches. Differential Revision: https://reviews.llvm.org/D94114 Added: Modified: llvm/test/CodeGen/AMDGPU/amdgcn.private-memory.ll llvm/test/CodeGen/AMDGPU/amdgpu.work-item-intrinsics.deprecated.ll llvm/test/CodeGen/AMDGPU/amdpal-cs.ll llvm/test/CodeGen/AMDGPU/amdpal-es.ll llvm/test/CodeGen/AMDGPU/amdpal-gs.ll llvm/test/CodeGen/AMDGPU/amdpal-hs.ll llvm/test/CodeGen/AMDGPU/amdpal-ls.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-cs.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-default.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-denormal.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-dx10-clamp.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-es.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-gs.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-hs.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-ieee.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-ls.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-ps.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-psenable.ll llvm/test/CodeGen/AMDGPU/amdpal-msgpack-vs.ll llvm/test/CodeGen/AMDGPU/amdpal-ps.ll llvm/test/CodeGen/AMDGPU/amdpal-psenable.ll llvm/test/CodeGen/AMDGPU/amdpal-vs.ll llvm/test/CodeGen/AMDGPU/andorn2.ll llvm/test/CodeGen/AMDGPU/anyext.ll llvm/test/CodeGen/AMDGPU/atomic_cmp_swap_local.ll llvm/test/CodeGen/AMDGPU/attr-amdgpu-num-sgpr.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/amdgcn.private-memory.ll b/llvm/test/CodeGen/AMDGPU/amdgcn.private-memory.ll index d38452a3a22a..bbbec113e78c 100644 --- a/llvm/test/CodeGen/AMDGPU/amdgcn.private-memory.ll +++ b/llvm/test/CodeGen/AMDGPU/amdgcn.private-memory.ll @@ -1,9 +1,9 @@ -; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -march=amdgcn < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-PROMOTE %s -; RUN: llc -mattr=+promote-alloca,-flat-for-global -verify-machineinstrs -mtriple=amdgcn--amdhsa -mcpu=kaveri < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-PROMOTE -check-prefix=HSA %s -; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -march=amdgcn < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-ALLOCA %s -; RUN: llc -mattr=-promote-alloca,-flat-for-global -verify-machineinstrs -mtriple=amdgcn-amdhsa -mcpu=kaveri < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-ALLOCA -check-prefix=HSA %s -; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -march=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-PROMOTE %s -; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -march=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck -check-prefix=GCN -check-prefix=GCN-ALLOCA %s +; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -march=amdgcn < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s +; RUN: llc -mattr=+promote-alloca,-flat-for-global -verify-machineinstrs -mtriple=amdgcn--amdhsa -mcpu=kaveri < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s +; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -march=amdgcn < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s +; RUN: llc -mattr=-promote-alloca,-flat-for-global -verify-machineinstrs -mtriple=amdgcn-amdhsa -mcpu=kaveri < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s +; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -march=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s +; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -march=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s declare i32 @llvm.amdgcn.workitem.id.x() nounwind readnone diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu.work-item-intrinsics.deprecated.ll b/llvm/test/CodeGen/AMDGPU/amdgpu.work-item-intrinsics.deprecated.ll index b11f17ba0882..d00e66b7adbb 100644 --- a/llvm/test/CodeGen/AMDGPU/amdgpu.work-item-intrinsics.deprecated.ll +++ b/llvm/test/CodeGen/AMDGPU/amdgpu.work-item-intrinsics.deprecated.ll @@ -1,6 +1,6 @@ -; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=GCN -check-prefix=SI-NOHSA -check-prefix=GCN-NOHSA -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=VI -check-prefix=VI-NOHSA -check-prefix=GCN -check-prefix=GCN-NOHSA -check-prefix=FUNC %s -; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s +; RUN: llc -march=amd
[llvm-branch-commits] [llvm] a954346 - [NFC] Removed unused prefixes in CodeGen/AMDGPU/GlobalISel
Author: Mircea Trofin Date: 2021-01-05T12:57:17-08:00 New Revision: a9543469d54e3dfa1c6b4e9d498b55bca947d51e URL: https://github.com/llvm/llvm-project/commit/a9543469d54e3dfa1c6b4e9d498b55bca947d51e DIFF: https://github.com/llvm/llvm-project/commit/a9543469d54e3dfa1c6b4e9d498b55bca947d51e.diff LOG: [NFC] Removed unused prefixes in CodeGen/AMDGPU/GlobalISel Differential Revision: https://reviews.llvm.org/D94099 Added: Modified: llvm/test/CodeGen/AMDGPU/GlobalISel/dynamic-alloca-uniform.ll llvm/test/CodeGen/AMDGPU/GlobalISel/fmed3.ll llvm/test/CodeGen/AMDGPU/GlobalISel/frem.ll llvm/test/CodeGen/AMDGPU/GlobalISel/insertelement.i16.ll llvm/test/CodeGen/AMDGPU/GlobalISel/insertelement.i8.ll llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ashr.s16.mir llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-lshr.s16.mir llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-shl.s16.mir llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fixed-function-abi-vgpr-args.ll llvm/test/CodeGen/AMDGPU/GlobalISel/lds-global-non-entry-func.ll llvm/test/CodeGen/AMDGPU/GlobalISel/lds-misaligned-bug.ll llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-flat.mir llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.div.fmas.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.div.scale.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.ds.gws.sema.br.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.ds.gws.sema.release.all.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.ds.gws.sema.v.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.fdot2.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.fmul.legacy.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.kernarg.segment.ptr.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.sdot2.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.sdot4.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.sdot8.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.set.inactive.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.udot2.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.udot4.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.udot8.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.workgroup.id.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.workitem.id.ll llvm/test/CodeGen/AMDGPU/GlobalISel/load-local.128.ll llvm/test/CodeGen/AMDGPU/GlobalISel/load-local.96.ll llvm/test/CodeGen/AMDGPU/GlobalISel/load-unaligned.ll llvm/test/CodeGen/AMDGPU/GlobalISel/smrd.ll llvm/test/CodeGen/AMDGPU/GlobalISel/store-local.128.ll llvm/test/CodeGen/AMDGPU/GlobalISel/store-local.96.ll llvm/test/CodeGen/AMDGPU/GlobalISel/zextload.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/dynamic-alloca-uniform.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/dynamic-alloca-uniform.ll index de316692c70a..2a2037247375 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/dynamic-alloca-uniform.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/dynamic-alloca-uniform.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX9 %s -; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX10 %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck --check-prefix=GFX9 %s +; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck --check-prefix=GFX10 %s @gv = external addrspace(4) constant i32 diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/fmed3.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/fmed3.ll index 7823cba3b250..eaec12a8d3e7 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/fmed3.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/fmed3.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -global-isel -march=amdgcn -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=SI %s -; RUN: llc -global-isel -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=VI -check-prefix=GFX89 %s -; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=GFX9 -check-prefix=GFX89 %s +; RUN: llc -global-isel -march=amdgcn -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=SI %s +; RUN: llc -global-isel -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=VI %s +; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GFX9 %s
[llvm-branch-commits] [llvm] 93fd523 - [NFC][utils] Factor remaining APIs under FunctionTestBuilder
Author: Mircea Trofin Date: 2020-12-17T22:13:14-08:00 New Revision: 93fd52329fe530d10ace5d24327e2b6d457c2ac8 URL: https://github.com/llvm/llvm-project/commit/93fd52329fe530d10ace5d24327e2b6d457c2ac8 DIFF: https://github.com/llvm/llvm-project/commit/93fd52329fe530d10ace5d24327e2b6d457c2ac8.diff LOG: [NFC][utils] Factor remaining APIs under FunctionTestBuilder Finishing the refactoring started in D93413. Differential Revision: https://reviews.llvm.org/D93506 Added: Modified: llvm/utils/UpdateTestChecks/common.py Removed: diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 128792da5b90..4befaec651ae 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -258,71 +258,6 @@ def repl_arg_names(match): def __str__(self): return self.scrub -def get_failed_prefixes(func_dict): - # This returns the list of those prefixes that failed to match any function, - # because there were conflicting bodies produced by diff erent RUN lines, in - # all instances of the prefix. Effectively, this prefix is unused and should - # be removed. - for prefix in func_dict: -if func_dict[prefix] and (not [fct for fct in func_dict[prefix] - if func_dict[prefix][fct] is not None]): - yield prefix - -def warn_on_failed_prefixes(func_dict): - for prefix in get_failed_prefixes(func_dict): - warn('Prefix %s had conflicting output from diff erent RUN lines for all functions' % (prefix,)) - -def build_function_body_dictionary(function_re, scrubber, scrubber_args, raw_tool_output, prefixes, func_dict, func_order, verbose, record_args, check_attributes): - for m in function_re.finditer(raw_tool_output): -if not m: - continue -func = m.group('func') -body = m.group('body') -attrs = m.group('attrs') if check_attributes else '' -# Determine if we print arguments, the opening brace, or nothing after the function name -if record_args and 'args_and_sig' in m.groupdict(): -args_and_sig = scrub_body(m.group('args_and_sig').strip()) -elif 'args_and_sig' in m.groupdict(): -args_and_sig = '(' -else: -args_and_sig = '' -scrubbed_body = do_scrub(body, scrubber, scrubber_args, extra = False) -scrubbed_extra = do_scrub(body, scrubber, scrubber_args, extra = True) -if 'analysis' in m.groupdict(): - analysis = m.group('analysis') - if analysis.lower() != 'cost model analysis': -warn('Unsupported analysis mode: %r!' % (analysis,)) -if func.startswith('stress'): - # We only use the last line of the function body for stress tests. - scrubbed_body = '\n'.join(scrubbed_body.splitlines()[-1:]) -if verbose: - print('Processing function: ' + func, file=sys.stderr) - for l in scrubbed_body.splitlines(): -print(' ' + l, file=sys.stderr) -for prefix in prefixes: - if func in func_dict[prefix]: -if (func_dict[prefix][func] is None or -str(func_dict[prefix][func]) != scrubbed_body or -func_dict[prefix][func].args_and_sig != args_and_sig or -func_dict[prefix][func].attrs != attrs): - if (func_dict[prefix][func] is not None and - func_dict[prefix][func].is_same_except_arg_names(scrubbed_extra, - args_and_sig, - attrs)): -func_dict[prefix][func].scrub = scrubbed_extra -func_dict[prefix][func].args_and_sig = args_and_sig -continue - else: -# This means a previous RUN line produced a body for this function -# that is diff erent from the one produced by this current RUN line, -# so the body can't be common accross RUN lines. We use None to -# indicate that. -func_dict[prefix][func] = None -continue - - func_dict[prefix][func] = function_body(scrubbed_body, scrubbed_extra, args_and_sig, attrs) - func_order[prefix].append(func) - class FunctionTestBuilder: def __init__(self, run_list, flags, scrubber_args): self._verbose = flags.verbose @@ -337,17 +272,80 @@ def __init__(self, run_list, flags, scrubber_args): self._func_order.update({prefix: []}) def finish_and_get_func_dict(self): -warn_on_failed_prefixes(self._func_dict) +for prefix in self._get_failed_prefixes(): + warn('Prefix %s had conflicting output from diff erent RUN lines for all functions' % (prefix,)) return self._func_dict def func_order(self): return self._func_order def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes): -build_function_body_dictionary(function_re, scrubber, self._scrubber_args, - raw_tool_output
[llvm-branch-commits] [llvm] ed1e565 - [NFC] factor update test function test builder as a class
Author: Mircea Trofin Date: 2020-12-16T21:12:06-08:00 New Revision: ed1e565aaff6a2b6ad9064bcc58c50a46100a836 URL: https://github.com/llvm/llvm-project/commit/ed1e565aaff6a2b6ad9064bcc58c50a46100a836 DIFF: https://github.com/llvm/llvm-project/commit/ed1e565aaff6a2b6ad9064bcc58c50a46100a836.diff LOG: [NFC] factor update test function test builder as a class This allows us to have shared logic over multiple test runs, e.g. do we have unused prefixes, or which function bodies have conflicting outputs for a prefix appearing in different RUN lines. This patch is just wrapping existing functionality, and replacing its uses. A subsequent patch would then fold the current functionality into the newly introduced class. Differential Revision: https://reviews.llvm.org/D93413 Added: Modified: llvm/utils/UpdateTestChecks/asm.py llvm/utils/UpdateTestChecks/common.py llvm/utils/update_analyze_test_checks.py llvm/utils/update_cc_test_checks.py llvm/utils/update_llc_test_checks.py llvm/utils/update_test_checks.py Removed: diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py index 476e7f1c75c9..839b72730459 100644 --- a/llvm/utils/UpdateTestChecks/asm.py +++ b/llvm/utils/UpdateTestChecks/asm.py @@ -324,8 +324,7 @@ def get_triple_from_march(march): print("Cannot find a triple. Assume 'x86'", file=sys.stderr) return 'x86' -def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, - prefixes, func_dict, func_order): +def get_run_handler(triple): target_handlers = { 'i686': (scrub_asm_x86, ASM_FUNCTION_X86_RE), 'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE), @@ -366,10 +365,7 @@ def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, if handler is None: raise KeyError('Triple %r is not supported' % (triple)) - scrubber, function_re = handler - common.build_function_body_dictionary( - function_re, scrubber, [args], raw_tool_output, prefixes, - func_dict, func_order, args.verbose, False, False) + return handler # Generator of assembly CHECK lines diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 21878e81b89f..128792da5b90 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -322,7 +322,32 @@ def build_function_body_dictionary(function_re, scrubber, scrubber_args, raw_too func_dict[prefix][func] = function_body(scrubbed_body, scrubbed_extra, args_and_sig, attrs) func_order[prefix].append(func) - warn_on_failed_prefixes(func_dict) + +class FunctionTestBuilder: + def __init__(self, run_list, flags, scrubber_args): +self._verbose = flags.verbose +self._record_args = flags.function_signature +self._check_attributes = flags.check_attributes +self._scrubber_args = scrubber_args +self._func_dict = {} +self._func_order = {} +for tuple in run_list: + for prefix in tuple[0]: +self._func_dict.update({prefix:dict()}) +self._func_order.update({prefix: []}) + + def finish_and_get_func_dict(self): +warn_on_failed_prefixes(self._func_dict) +return self._func_dict + + def func_order(self): +return self._func_order + + def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes): +build_function_body_dictionary(function_re, scrubber, self._scrubber_args, + raw_tool_output, prefixes, self._func_dict, + self._func_order, self._verbose, + self._record_args, self._check_attributes) # Generator of LLVM IR CHECK lines diff --git a/llvm/utils/update_analyze_test_checks.py b/llvm/utils/update_analyze_test_checks.py index 4685d32d7242..38add9d4ab01 100755 --- a/llvm/utils/update_analyze_test_checks.py +++ b/llvm/utils/update_analyze_test_checks.py @@ -108,12 +108,11 @@ def main(): # now, we just ignore all but the last. prefix_list.append((check_prefixes, tool_cmd_args)) -func_dict = {} -func_order = {} -for prefixes, _ in prefix_list: - for prefix in prefixes: -func_dict.update({prefix: dict()}) -func_order.update({prefix: []}) +builder = common.FunctionTestBuilder( + run_list = prefix_list, + flags = args, + scrubber_args = []) + for prefixes, opt_args in prefix_list: common.debug('Extracted opt cmd:', opt_basename, opt_args, file=sys.stderr) common.debug('Extracted FileCheck prefixes:', str(prefixes), file=sys.stderr) @@ -122,10 +121,10 @@ def main(): # Split analysis outputs by "Printing analysis " declarations. for raw_tool_output in re.split(r'Printing analysis ', raw_tool_outputs): -common.build_function_body_dictionary( -
[llvm-branch-commits] [llvm] cd551f8 - [NFC] Remove unused prefixes in llvm/test/CodeGen/X86
Author: Mircea Trofin Date: 2020-12-16T12:41:49-08:00 New Revision: cd551f8564281eb85a9e239710b6953f4c763796 URL: https://github.com/llvm/llvm-project/commit/cd551f8564281eb85a9e239710b6953f4c763796 DIFF: https://github.com/llvm/llvm-project/commit/cd551f8564281eb85a9e239710b6953f4c763796.diff LOG: [NFC] Remove unused prefixes in llvm/test/CodeGen/X86 Differential Revision: https://reviews.llvm.org/D92965 Added: Modified: llvm/test/CodeGen/X86/avx512-cvt.ll llvm/test/CodeGen/X86/bswap-vector.ll llvm/test/CodeGen/X86/fast-isel-select-pseudo-cmov.ll llvm/test/CodeGen/X86/haddsub-undef.ll llvm/test/CodeGen/X86/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll llvm/test/CodeGen/X86/hoist-and-by-const-from-shl-in-eqcmp-zero.ll llvm/test/CodeGen/X86/scalar-fp-to-i64.ll llvm/test/CodeGen/X86/sse-intrinsics-x86.ll llvm/test/CodeGen/X86/sse41-intrinsics-fast-isel.ll llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll llvm/test/CodeGen/X86/vector-fshl-rot-128.ll llvm/test/CodeGen/X86/vector-fshl-rot-256.ll llvm/test/CodeGen/X86/vector-fshl-rot-sub128.ll llvm/test/CodeGen/X86/vector-fshr-rot-128.ll llvm/test/CodeGen/X86/vector-fshr-rot-256.ll llvm/test/CodeGen/X86/vector-fshr-rot-sub128.ll llvm/test/CodeGen/X86/vector-rotate-256.ll Removed: diff --git a/llvm/test/CodeGen/X86/avx512-cvt.ll b/llvm/test/CodeGen/X86/avx512-cvt.ll index 64f281b7ffdf..e98885e31c9d 100644 --- a/llvm/test/CodeGen/X86/avx512-cvt.ll +++ b/llvm/test/CodeGen/X86/avx512-cvt.ll @@ -1,11 +1,11 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=ALL --check-prefix=NOVL --check-prefix=NODQ --check-prefix=NOVLDQ --check-prefix=KNL -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq | FileCheck %s --check-prefix=ALL --check-prefix=VL --check-prefix=VLDQ --check-prefix=VLBW --check-prefix=SKX -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512vl | FileCheck %s --check-prefix=ALL --check-prefix=NODQ --check-prefix=VL --check-prefix=VLNODQ --check-prefix=VLNOBW --check-prefix=AVX512VL -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512dq | FileCheck %s --check-prefix=ALL --check-prefix=NOVL --check-prefix=DQNOVL --check-prefix=AVX512DQ -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=NOVL --check-prefix=NODQ --check-prefix=NOVLDQ --check-prefix=AVX512BW -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512vl,avx512dq | FileCheck %s --check-prefix=ALL --check-prefix=VL --check-prefix=VLDQ --check-prefix=VLNOBW --check-prefix=AVX512VLDQ -; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512vl,avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=NODQ --check-prefix=VL --check-prefix=VLNODQ --check-prefix=VLBW --check-prefix=AVX512VLBW +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=ALL,NOVL,NODQ,NOVLDQ,KNL +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq | FileCheck %s --check-prefixes=ALL,VL,VLDQ,VLBW +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512vl | FileCheck %s --check-prefixes=ALL,NODQ,VL,VLNODQ,VLNOBW +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512dq | FileCheck %s --check-prefixes=ALL,NOVL,DQNOVL +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512bw | FileCheck %s --check-prefixes=ALL,NOVL,NODQ,NOVLDQ,AVX512BW +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512vl,avx512dq | FileCheck %s --check-prefixes=ALL,VL,VLDQ,VLNOBW +; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx512vl,avx512bw | FileCheck %s --check-prefixes=ALL,NODQ,VL,VLNODQ,VLBW define <16 x float> @sitof32(<16 x i32> %a) nounwind { diff --git a/llvm/test/CodeGen/X86/bswap-vector.ll b/llvm/test/CodeGen/X86/bswap-vector.ll index d959f224137c..948b3987b636 100644 --- a/llvm/test/CodeGen/X86/bswap-vector.ll +++ b/llvm/test/CodeGen/X86/bswap-vector.ll @@ -1,8 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SSE,CHECK-NOSSSE3,CHECK-SSE-X86,CHECK-NOSSSE3-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SSE,CHECK-SSE-X64,CHECK-NOSSSE3,CHECK-NOSSSE3-X64 +; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2
[llvm-branch-commits] [llvm] 1183e55 - [NFC] update extract-lowbits.ll and scalar-pf-to-i64.ll
Author: Mircea Trofin Date: 2020-12-15T10:04:45-08:00 New Revision: 1183e55580cad9cae3830c261070c32263aad108 URL: https://github.com/llvm/llvm-project/commit/1183e55580cad9cae3830c261070c32263aad108 DIFF: https://github.com/llvm/llvm-project/commit/1183e55580cad9cae3830c261070c32263aad108.diff LOG: [NFC] update extract-lowbits.ll and scalar-pf-to-i64.ll Auto-updated with update_llc_test_checks Added: Modified: llvm/test/CodeGen/X86/extract-lowbits.ll llvm/test/CodeGen/X86/scalar-fp-to-i64.ll Removed: diff --git a/llvm/test/CodeGen/X86/extract-lowbits.ll b/llvm/test/CodeGen/X86/extract-lowbits.ll index e93638132e7d..4c11d5514022 100644 --- a/llvm/test/CodeGen/X86/extract-lowbits.ll +++ b/llvm/test/CodeGen/X86/extract-lowbits.ll @@ -868,7 +868,7 @@ define i32 @bzhi64_32_a1_trunc_extrause(i64 %val, i32 %numlowbits) nounwind { ; X86-NOBMI-NEXT:movb {{[0-9]+}}(%esp), %bl ; X86-NOBMI-NEXT:movl {{[0-9]+}}(%esp), %esi ; X86-NOBMI-NEXT:movl %esi, (%esp) -; X86-NOBMI-NEXT:calll use32 +; X86-NOBMI-NEXT:calll use32@PLT ; X86-NOBMI-NEXT:movl $1, %eax ; X86-NOBMI-NEXT:movl %ebx, %ecx ; X86-NOBMI-NEXT:shll %cl, %eax @@ -887,7 +887,7 @@ define i32 @bzhi64_32_a1_trunc_extrause(i64 %val, i32 %numlowbits) nounwind { ; X86-BMI1NOTBM-NEXT:movb {{[0-9]+}}(%esp), %bl ; X86-BMI1NOTBM-NEXT:movl {{[0-9]+}}(%esp), %esi ; X86-BMI1NOTBM-NEXT:movl %esi, (%esp) -; X86-BMI1NOTBM-NEXT:calll use32 +; X86-BMI1NOTBM-NEXT:calll use32@PLT ; X86-BMI1NOTBM-NEXT:shll $8, %ebx ; X86-BMI1NOTBM-NEXT:bextrl %ebx, %esi, %eax ; X86-BMI1NOTBM-NEXT:addl $4, %esp @@ -903,7 +903,7 @@ define i32 @bzhi64_32_a1_trunc_extrause(i64 %val, i32 %numlowbits) nounwind { ; X86-BMI1BMI2-NEXT:movb {{[0-9]+}}(%esp), %bl ; X86-BMI1BMI2-NEXT:movl {{[0-9]+}}(%esp), %esi ; X86-BMI1BMI2-NEXT:movl %esi, (%esp) -; X86-BMI1BMI2-NEXT:calll use32 +; X86-BMI1BMI2-NEXT:calll use32@PLT ; X86-BMI1BMI2-NEXT:bzhil %ebx, %esi, %eax ; X86-BMI1BMI2-NEXT:addl $4, %esp ; X86-BMI1BMI2-NEXT:popl %esi @@ -917,7 +917,7 @@ define i32 @bzhi64_32_a1_trunc_extrause(i64 %val, i32 %numlowbits) nounwind { ; X64-NOBMI-NEXT:pushq %rax ; X64-NOBMI-NEXT:movl %esi, %ebp ; X64-NOBMI-NEXT:movq %rdi, %rbx -; X64-NOBMI-NEXT:callq use32 +; X64-NOBMI-NEXT:callq use32@PLT ; X64-NOBMI-NEXT:movl $1, %eax ; X64-NOBMI-NEXT:movl %ebp, %ecx ; X64-NOBMI-NEXT:shll %cl, %eax @@ -935,7 +935,7 @@ define i32 @bzhi64_32_a1_trunc_extrause(i64 %val, i32 %numlowbits) nounwind { ; X64-BMI1NOTBM-NEXT:pushq %rax ; X64-BMI1NOTBM-NEXT:movl %esi, %ebx ; X64-BMI1NOTBM-NEXT:movq %rdi, %r14 -; X64-BMI1NOTBM-NEXT:callq use32 +; X64-BMI1NOTBM-NEXT:callq use32@PLT ; X64-BMI1NOTBM-NEXT:shll $8, %ebx ; X64-BMI1NOTBM-NEXT:bextrl %ebx, %r14d, %eax ; X64-BMI1NOTBM-NEXT:addq $8, %rsp @@ -950,7 +950,7 @@ define i32 @bzhi64_32_a1_trunc_extrause(i64 %val, i32 %numlowbits) nounwind { ; X64-BMI1BMI2-NEXT:pushq %rax ; X64-BMI1BMI2-NEXT:movl %esi, %ebp ; X64-BMI1BMI2-NEXT:movq %rdi, %rbx -; X64-BMI1BMI2-NEXT:callq use32 +; X64-BMI1BMI2-NEXT:callq use32@PLT ; X64-BMI1BMI2-NEXT:bzhil %ebp, %ebx, %eax ; X64-BMI1BMI2-NEXT:addq $8, %rsp ; X64-BMI1BMI2-NEXT:popq %rbx @@ -2057,7 +2057,7 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind { ; X86-NOBMI-NEXT:# kill: def $cl killed $cl killed $ecx ; X86-NOBMI-NEXT:shrl %cl, %esi ; X86-NOBMI-NEXT:movl %esi, (%esp) -; X86-NOBMI-NEXT:calll use32 +; X86-NOBMI-NEXT:calll use32@PLT ; X86-NOBMI-NEXT:andl {{[0-9]+}}(%esp), %esi ; X86-NOBMI-NEXT:movl %esi, %eax ; X86-NOBMI-NEXT:addl $8, %esp @@ -2074,7 +2074,7 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind { ; X86-BMI1NOTBM-NEXT:# kill: def $cl killed $cl killed $ecx ; X86-BMI1NOTBM-NEXT:shrl %cl, %esi ; X86-BMI1NOTBM-NEXT:movl %esi, (%esp) -; X86-BMI1NOTBM-NEXT:calll use32 +; X86-BMI1NOTBM-NEXT:calll use32@PLT ; X86-BMI1NOTBM-NEXT:andl {{[0-9]+}}(%esp), %esi ; X86-BMI1NOTBM-NEXT:movl %esi, %eax ; X86-BMI1NOTBM-NEXT:addl $8, %esp @@ -2091,7 +2091,7 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind { ; X86-BMI1BMI2-NEXT:movl $-1, %ecx ; X86-BMI1BMI2-NEXT:shrxl %eax, %ecx, %eax ; X86-BMI1BMI2-NEXT:movl %eax, (%esp) -; X86-BMI1BMI2-NEXT:calll use32 +; X86-BMI1BMI2-NEXT:calll use32@PLT ; X86-BMI1BMI2-NEXT:bzhil %ebx, {{[0-9]+}}(%esp), %eax ; X86-BMI1BMI2-NEXT:addl $8, %esp ; X86-BMI1BMI2-NEXT:popl %ebx @@ -2109,7 +2109,7 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind { ; X64-NOBMI-NEXT:# kill: def $cl killed $cl killed $ecx ; X64-NOBMI-NEXT:shrl %cl, %ebp ; X64-NOBMI-NEXT:movl %ebp, %edi -; X64-NOBMI-NEXT:callq use32 +; X64-NOBMI-NEXT:callq use32@P
[llvm-branch-commits] [llvm] c50f3a8 - [NFC] Update extract-bits.ll
Author: Mircea Trofin Date: 2020-12-15T09:52:17-08:00 New Revision: c50f3a8781abe0ff88c6ba70edba6e59bf998706 URL: https://github.com/llvm/llvm-project/commit/c50f3a8781abe0ff88c6ba70edba6e59bf998706 DIFF: https://github.com/llvm/llvm-project/commit/c50f3a8781abe0ff88c6ba70edba6e59bf998706.diff LOG: [NFC] Update extract-bits.ll Running update_llc_test_checks adds @PLT annotations to a number of calls. Added: Modified: llvm/test/CodeGen/X86/extract-bits.ll Removed: diff --git a/llvm/test/CodeGen/X86/extract-bits.ll b/llvm/test/CodeGen/X86/extract-bits.ll index 9825b828eddf..c128a00fc91a 100644 --- a/llvm/test/CodeGen/X86/extract-bits.ll +++ b/llvm/test/CodeGen/X86/extract-bits.ll @@ -453,7 +453,7 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits ; X86-NOBMI-NEXT:decl %esi ; X86-NOBMI-NEXT:andl %edi, %esi ; X86-NOBMI-NEXT:movl %eax, (%esp) -; X86-NOBMI-NEXT:calll use32 +; X86-NOBMI-NEXT:calll use32@PLT ; X86-NOBMI-NEXT:movl %esi, %eax ; X86-NOBMI-NEXT:addl $4, %esp ; X86-NOBMI-NEXT:popl %esi @@ -471,7 +471,7 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits ; X86-BMI1NOTBM-NEXT:orl %ecx, %edx ; X86-BMI1NOTBM-NEXT:bextrl %edx, {{[0-9]+}}(%esp), %esi ; X86-BMI1NOTBM-NEXT:movl %eax, (%esp) -; X86-BMI1NOTBM-NEXT:calll use32 +; X86-BMI1NOTBM-NEXT:calll use32@PLT ; X86-BMI1NOTBM-NEXT:movl %esi, %eax ; X86-BMI1NOTBM-NEXT:addl $8, %esp ; X86-BMI1NOTBM-NEXT:popl %esi @@ -486,7 +486,7 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits ; X86-BMI1BMI2-NEXT:shrxl %ecx, {{[0-9]+}}(%esp), %edx ; X86-BMI1BMI2-NEXT:bzhil %eax, %edx, %esi ; X86-BMI1BMI2-NEXT:movl %ecx, (%esp) -; X86-BMI1BMI2-NEXT:calll use32 +; X86-BMI1BMI2-NEXT:calll use32@PLT ; X86-BMI1BMI2-NEXT:movl %esi, %eax ; X86-BMI1BMI2-NEXT:addl $8, %esp ; X86-BMI1BMI2-NEXT:popl %esi @@ -503,7 +503,7 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits ; X64-NOBMI-NEXT:decl %ebx ; X64-NOBMI-NEXT:andl %edi, %ebx ; X64-NOBMI-NEXT:movl %esi, %edi -; X64-NOBMI-NEXT:callq use32 +; X64-NOBMI-NEXT:callq use32@PLT ; X64-NOBMI-NEXT:movl %ebx, %eax ; X64-NOBMI-NEXT:popq %rbx ; X64-NOBMI-NEXT:retq @@ -516,7 +516,7 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits ; X64-BMI1NOTBM-NEXT:orl %edx, %eax ; X64-BMI1NOTBM-NEXT:bextrl %eax, %edi, %ebx ; X64-BMI1NOTBM-NEXT:movl %esi, %edi -; X64-BMI1NOTBM-NEXT:callq use32 +; X64-BMI1NOTBM-NEXT:callq use32@PLT ; X64-BMI1NOTBM-NEXT:movl %ebx, %eax ; X64-BMI1NOTBM-NEXT:popq %rbx ; X64-BMI1NOTBM-NEXT:retq @@ -527,7 +527,7 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits ; X64-BMI1BMI2-NEXT:shrxl %esi, %edi, %eax ; X64-BMI1BMI2-NEXT:bzhil %edx, %eax, %ebx ; X64-BMI1BMI2-NEXT:movl %esi, %edi -; X64-BMI1BMI2-NEXT:callq use32 +; X64-BMI1BMI2-NEXT:callq use32@PLT ; X64-BMI1BMI2-NEXT:movl %ebx, %eax ; X64-BMI1BMI2-NEXT:popq %rbx ; X64-BMI1BMI2-NEXT:retq @@ -1455,7 +1455,7 @@ define i64 @bextr64_a5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits ; X86-NOBMI-NEXT:subl $8, %esp ; X86-NOBMI-NEXT:pushl {{[0-9]+}}(%esp) ; X86-NOBMI-NEXT:pushl %eax -; X86-NOBMI-NEXT:calll use64 +; X86-NOBMI-NEXT:calll use64@PLT ; X86-NOBMI-NEXT:addl $16, %esp ; X86-NOBMI-NEXT:movl %esi, %eax ; X86-NOBMI-NEXT:movl %edi, %edx @@ -1505,7 +1505,7 @@ define i64 @bextr64_a5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits ; X86-BMI1NOTBM-NEXT:subl $8, %esp ; X86-BMI1NOTBM-NEXT:pushl {{[0-9]+}}(%esp) ; X86-BMI1NOTBM-NEXT:pushl %eax -; X86-BMI1NOTBM-NEXT:calll use64 +; X86-BMI1NOTBM-NEXT:calll use64@PLT ; X86-BMI1NOTBM-NEXT:addl $16, %esp ; X86-BMI1NOTBM-NEXT:movl %esi, %eax ; X86-BMI1NOTBM-NEXT:movl %edi, %edx @@ -1554,7 +1554,7 @@ define i64 @bextr64_a5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits ; X86-BMI1BMI2-NEXT:subl $8, %esp ; X86-BMI1BMI2-NEXT:pushl {{[0-9]+}}(%esp) ; X86-BMI1BMI2-NEXT:pushl %eax -; X86-BMI1BMI2-NEXT:calll use64 +; X86-BMI1BMI2-NEXT:calll use64@PLT ; X86-BMI1BMI2-NEXT:addl $16, %esp ; X86-BMI1BMI2-NEXT:movl %edi, %eax ; X86-BMI1BMI2-NEXT:movl %esi, %edx @@ -1576,7 +1576,7 @@ define i64 @bextr64_a5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits ; X64-NOBMI-NEXT:decq %rbx ; X64-NOBMI-NEXT:andq %rdi, %rbx ; X64-NOBMI-NEXT:movq %rsi, %rdi -; X64-NOBMI-NEXT:callq use64 +; X64-NOBMI-NEXT:callq use64@PLT ; X64-NOBMI-NEXT:movq %rbx, %rax ; X64-NOBMI-NEXT:popq %rbx ; X64-NOBMI-NEXT:retq @@ -1589,7 +1589,7 @@ define i64 @bextr64_a5_s
[llvm-branch-commits] [llvm] 380e1d9 - [utils] The func_dict for a prefix may just be empty
Author: Mircea Trofin Date: 2020-12-15T08:48:37-08:00 New Revision: 380e1d918cb4581fae0277ff547d75334f3e7ddd URL: https://github.com/llvm/llvm-project/commit/380e1d918cb4581fae0277ff547d75334f3e7ddd DIFF: https://github.com/llvm/llvm-project/commit/380e1d918cb4581fae0277ff547d75334f3e7ddd.diff LOG: [utils] The func_dict for a prefix may just be empty Follow up from D92965 - since we try to find failed prefixes after each RUN line, it's possible the whole list of functions for a prefix be non-existent, which is fine - this happens when none of the RUN lines seen so far used the prefix. Added: Modified: llvm/utils/UpdateTestChecks/common.py Removed: diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 8cd90deefdb9..21878e81b89f 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -261,10 +261,10 @@ def __str__(self): def get_failed_prefixes(func_dict): # This returns the list of those prefixes that failed to match any function, # because there were conflicting bodies produced by diff erent RUN lines, in - # all instances of the prefix. Effectivelly, this prefix is unused and should + # all instances of the prefix. Effectively, this prefix is unused and should # be removed. for prefix in func_dict: -if (not [fct for fct in func_dict[prefix] +if func_dict[prefix] and (not [fct for fct in func_dict[prefix] if func_dict[prefix][fct] is not None]): yield prefix ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] e2dc306 - [utils] Fix UpdateTestChecks case where 2 runs differ for last label
Author: Mircea Trofin Date: 2020-12-15T07:16:54-08:00 New Revision: e2dc306b1ac71258e6ce40a66e778527f282c355 URL: https://github.com/llvm/llvm-project/commit/e2dc306b1ac71258e6ce40a66e778527f282c355 DIFF: https://github.com/llvm/llvm-project/commit/e2dc306b1ac71258e6ce40a66e778527f282c355.diff LOG: [utils] Fix UpdateTestChecks case where 2 runs differ for last label Two RUN lines produce outputs that, each, have some common parts and some different parts. The common parts are checked under label A. The differing parts are associated to a function and checked under labels B and C, respectivelly. When build_function_body_dictionary is called for the first RUN line, it will attribute the function body to labels A and C. When the second RUN is passed to build_function_body_dictionary, it sees that the function body under A is different from what it has. If in this second RUN line, A were at the end of the prefixes list, A's body is still kept associated with the first run's function. When we output the function body (i.e. add_checks), we stop after emitting for the first prefix matching that function. So we end up with the wrong function body (first RUN's A-association). There is no reason to special-case the last label in the prefixes list, and the fix is to always clear a label association if we find a RUN line where the body is different. Differential Revision: https://reviews.llvm.org/D93078 Added: clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp clang/test/utils/update_cc_test_checks/prefix-never-matches.test llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-1.ll llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-2.ll llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test Modified: llvm/utils/UpdateTestChecks/common.py llvm/utils/update_test_prefix.py Removed: diff --git a/clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp b/clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp new file mode 100644 index ..75bd5b1249a7 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -O0 -o - %s | FileCheck %s -check-prefix=A +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -O3 -o - %s | FileCheck %s -check-prefix=A + +int foo(int i ) { +return 1; +} \ No newline at end of file diff --git a/clang/test/utils/update_cc_test_checks/prefix-never-matches.test b/clang/test/utils/update_cc_test_checks/prefix-never-matches.test new file mode 100644 index ..7100377337bc --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/prefix-never-matches.test @@ -0,0 +1,6 @@ +# RUN: cp -f %S/Inputs/prefix-never-matches.cpp %t.cpp +# RUN: %update_cc_test_checks %t.cpp 2>&1 | FileCheck %s +# RUN: FileCheck --input-file=%t.cpp %s --check-prefix=OUTPUT + +# CHECK: WARNING: Prefix A had conflicting output +# OUTPUT-NOT: A: \ No newline at end of file diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label- diff erent-bodies-1.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label- diff erent-bodies-1.ll new file mode 100644 index ..c5f2bc9ba5bc --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label- diff erent-bodies-1.ll @@ -0,0 +1,11 @@ +; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=A,B +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --allow-unused-prefixes=true --check-prefixes=C,A,UNUSED + +declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>) +; A: declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>) + +define <2 x i64> @fold_v2i64() { +entry: + %r = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> ) + ret <2 x i64> %r +} diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label- diff erent-bodies-2.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label- diff erent-bodies-2.ll new file mode 100644 index ..bc1990462d37 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label- diff erent-bodies-2.ll @@ -0,0 +1,11 @@ +; RUN: llc < %s -mtriple=
[llvm-branch-commits] [llvm] f76b7f2 - [MLGO] Fix build break as result of new InstructionCost (D91174)
Author: Mircea Trofin Date: 2020-12-11T20:28:39-08:00 New Revision: f76b7f22f085fbf9f2585923f7a3a0558d75964b URL: https://github.com/llvm/llvm-project/commit/f76b7f22f085fbf9f2585923f7a3a0558d75964b DIFF: https://github.com/llvm/llvm-project/commit/f76b7f22f085fbf9f2585923f7a3a0558d75964b.diff LOG: [MLGO] Fix build break as result of new InstructionCost (D91174) Added: Modified: llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp Removed: diff --git a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp index 2213cd8598b0..3c90e82fb952 100644 --- a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp +++ b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp @@ -130,8 +130,8 @@ size_t getSize(Function &F, TargetTransformInfo &TTI) { size_t Ret = 0; for (const auto &BB : F) for (const auto &I : BB) - Ret += TTI.getInstructionCost( - &I, TargetTransformInfo::TargetCostKind::TCK_CodeSize); + Ret += *(TTI.getInstructionCost( + &I, TargetTransformInfo::TargetCostKind::TCK_CodeSize).getValue()); return Ret; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 55ea639 - [NFC] Removed unused prefixes in llvm/test/CodeGen/AArch64
Author: Mircea Trofin Date: 2020-12-09T12:47:51-08:00 New Revision: 55ea639d3c576f713041c3d1832e71d92f732ee3 URL: https://github.com/llvm/llvm-project/commit/55ea639d3c576f713041c3d1832e71d92f732ee3 DIFF: https://github.com/llvm/llvm-project/commit/55ea639d3c576f713041c3d1832e71d92f732ee3.diff LOG: [NFC] Removed unused prefixes in llvm/test/CodeGen/AArch64 Differential Revision: https://reviews.llvm.org/D92943 Added: Modified: llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll llvm/test/CodeGen/AArch64/sve-fixed-length-fp-arith.ll llvm/test/CodeGen/AArch64/sve-fixed-length-fp-converts.ll llvm/test/CodeGen/AArch64/sve-fixed-length-fp-select.ll llvm/test/CodeGen/AArch64/sve-fixed-length-int-div.ll llvm/test/CodeGen/AArch64/sve-fixed-length-int-select.ll Removed: diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll b/llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll index e8eb36bd1c34..9be8c043a929 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py -; RUN: llc %s -stop-after=irtranslator -verify-machineinstrs -mtriple aarch64-apple-darwin -global-isel -o - 2>&1 | FileCheck %s --check-prefixes=DARWIN,COMMON +; RUN: llc %s -stop-after=irtranslator -verify-machineinstrs -mtriple aarch64-apple-darwin -global-isel -o - 2>&1 | FileCheck %s --check-prefix=DARWIN ; Shouldn't tail call when the OS doesn't support it. declare extern_weak void @extern_weak_fn() diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll b/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll index fc8802155054..48315532064f 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll @@ -1,22 +1,22 @@ ; RUN: llc -mtriple=aarch64-- -debug-pass=Structure %s -o /dev/null 2>&1 \ ; RUN: --debugify-and-strip-all-safe=0 \ ; RUN: -verify-machineinstrs=0 -O0 \ -; RUN: | FileCheck %s --check-prefixes=ENABLED,ENABLED-O0,FALLBACK +; RUN: | FileCheck %s --check-prefixes=ENABLED,FALLBACK ; RUN: llc -mtriple=aarch64-- -debug-pass=Structure %s -o /dev/null 2>&1 \ ; RUN: --debugify-and-strip-all-safe=0 \ ; RUN: -verify-machineinstrs -O0 \ -; RUN: | FileCheck %s --check-prefixes=ENABLED,ENABLED-O0,FALLBACK,VERIFY,VERIFY-O0 +; RUN: | FileCheck %s --check-prefixes=ENABLED,FALLBACK,VERIFY,VERIFY-O0 ; RUN: llc -mtriple=aarch64-- -debug-pass=Structure %s -o /dev/null 2>&1 \ ; RUN: --debugify-and-strip-all-safe=0 \ ; RUN: -verify-machineinstrs=0 -O0 -aarch64-enable-global-isel-at-O=0 -global-isel-abort=1 \ -; RUN: | FileCheck %s --check-prefix ENABLED --check-prefix ENABLED-O0 --check-prefix NOFALLBACK +; RUN: | FileCheck %s --check-prefixes=ENABLED,NOFALLBACK ; RUN: llc -mtriple=aarch64-- -debug-pass=Structure %s -o /dev/null 2>&1 \ ; RUN: --debugify-and-strip-all-safe=0 \ ; RUN: -verify-machineinstrs=0 -O0 -aarch64-enable-global-isel-at-O=0 -global-isel-abort=2 \ -; RUN: | FileCheck %s --check-prefix ENABLED --check-prefix ENABLED-O0 --check-prefix FALLBACK +; RUN: | FileCheck %s --check-prefixes=ENABLED,FALLBACK ; RUN: llc -mtriple=aarch64-- -debug-pass=Structure %s -o /dev/null 2>&1 \ ; RUN: --debugify-and-strip-all-safe=0 \ diff --git a/llvm/test/CodeGen/AArch64/sve-fixed-length-fp-arith.ll b/llvm/test/CodeGen/AArch64/sve-fixed-length-fp-arith.ll index 1806b4945ec9..407b52714e64 100644 --- a/llvm/test/CodeGen/AArch64/sve-fixed-length-fp-arith.ll +++ b/llvm/test/CodeGen/AArch64/sve-fixed-length-fp-arith.ll @@ -1,19 +1,19 @@ ; RUN: llc -aarch64-sve-vector-bits-min=128 < %s | FileCheck %s -D#VBYTES=16 -check-prefix=NO_SVE -; RUN: llc -aarch64-sve-vector-bits-min=256 < %s | FileCheck %s -D#VBYTES=32 -check-prefixes=CHECK,VBITS_LE_1024,VBITS_LE_512,VBITS_LE_256 -; RUN: llc -aarch64-sve-vector-bits-min=384 < %s | FileCheck %s -D#VBYTES=32 -check-prefixes=CHECK,VBITS_LE_1024,VBITS_LE_512,VBITS_LE_256 -; RUN: llc -aarch64-sve-vector-bits-min=512 < %s | FileCheck %s -D#VBYTES=64 -check-prefixes=CHECK,VBITS_LE_1024,VBITS_LE_512 -; RUN: llc -aarch64-sve-vector-bits-min=640 < %s | FileCheck %s -D#VBYTES=64 -check-prefixes=CHECK,VBITS_LE_1024,VBITS_LE_512 -; RUN: llc -aarch64-sve-vector-bits-min=768 < %s | FileCheck %s -D#VBYTES=64 -check-prefixes=CHECK,VBITS_LE_1024,VBITS_LE_512 -; RUN: llc -aarch64-sve-vector-bits-min=896 < %s | FileCheck %s -D#VBYTES=64 -check-prefixes=CHECK,VBITS_LE_1024,VBITS_LE_512 -; RUN: llc -aarch64-sve-vector-bits-min=1024 < %s | FileCheck %s -D#VBYTES=128 -chec
[llvm-branch-commits] [llvm] f9a27df - [FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms
Author: Mircea Trofin Date: 2020-12-09T08:51:38-08:00 New Revision: f9a27df16bc4c86eb9c81b0fed3d263876334572 URL: https://github.com/llvm/llvm-project/commit/f9a27df16bc4c86eb9c81b0fed3d263876334572 DIFF: https://github.com/llvm/llvm-project/commit/f9a27df16bc4c86eb9c81b0fed3d263876334572.diff LOG: [FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms Explicitly opt-out llvm/test/Transforms/Attributor. Verified by flipping the default value of allow-unused-prefixes and observing that none of the failures were under llvm/test/Transforms. Differential Revision: https://reviews.llvm.org/D92404 Added: llvm/test/Transforms/Attributor/lit.local.cfg llvm/test/Transforms/lit.local.cfg Modified: llvm/test/Transforms/ArgumentPromotion/crash.ll llvm/test/Transforms/HardwareLoops/scalar-while.ll llvm/test/Transforms/Inline/inline_stats.ll llvm/test/Transforms/Inline/noalias2.ll llvm/test/Transforms/LICM/pr23608.ll llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/merge-stores-private.ll llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-1.ll llvm/test/Transforms/LowerTypeTests/export-inline.ll llvm/test/Transforms/MemCpyOpt/memcpy-invoke-memcpy.ll llvm/test/Transforms/PhaseOrdering/ARM/arm_fill_q7.ll llvm/test/Transforms/PhaseOrdering/X86/loop-idiom-vs-indvars.ll llvm/test/lit.cfg.py Removed: diff --git a/llvm/test/Transforms/ArgumentPromotion/crash.ll b/llvm/test/Transforms/ArgumentPromotion/crash.ll index d79d906434bb..d55f4624e0c3 100644 --- a/llvm/test/Transforms/ArgumentPromotion/crash.ll +++ b/llvm/test/Transforms/ArgumentPromotion/crash.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes -; RUN: opt -S < %s -inline -argpromotion | FileCheck %s --check-prefixes=ARGPROMOTION,ALL_OLDPM +; RUN: opt -S < %s -inline -argpromotion | FileCheck %s --check-prefix=ARGPROMOTION ; RUN: opt -S < %s -passes=inline,argpromotion | FileCheck %s --check-prefixes=ARGPROMOTION,ALL_NEWPM %S = type { %S* } diff --git a/llvm/test/Transforms/Attributor/lit.local.cfg b/llvm/test/Transforms/Attributor/lit.local.cfg new file mode 100644 index ..fad1a46e1d0f --- /dev/null +++ b/llvm/test/Transforms/Attributor/lit.local.cfg @@ -0,0 +1,11 @@ +# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: +from lit.llvm.subst import ToolSubst + +fc = ToolSubst('FileCheck', unresolved='fatal') +# the parent introduced the opposite rule, so we replace it if we see it. +if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'): +config.substitutions[0] = ( +fc.regex, 'FileCheck --allow-unused-prefixes=true') +else: +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=true')) diff --git a/llvm/test/Transforms/HardwareLoops/scalar-while.ll b/llvm/test/Transforms/HardwareLoops/scalar-while.ll index fb614ea275a0..0b99f74f0d98 100644 --- a/llvm/test/Transforms/HardwareLoops/scalar-while.ll +++ b/llvm/test/Transforms/HardwareLoops/scalar-while.ll @@ -1,9 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DEC -; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -force-hardware-loop-phi=true -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-PHI -; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -force-nested-hardware-loop=true -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NESTED -; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -force-hardware-loop-guard=true -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GUARD -; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -force-hardware-loop-phi=true -force-hardware-loop-guard=true -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-PHIGUARD +; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -S %s -o - | FileCheck %s --check-prefix=CHECK-DEC +; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -force-hardware-loop-phi=true -S %s -o - | FileCheck %s --check-prefix=CHECK-PHI +; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32
[llvm-branch-commits] [llvm] e51c2d6 - [tools] Update update_test_prefix.py to handle %s after prefixes
Author: Mircea Trofin Date: 2020-12-03T20:07:28-08:00 New Revision: e51c2d6a747d8c85dee711edd3a766f036635da0 URL: https://github.com/llvm/llvm-project/commit/e51c2d6a747d8c85dee711edd3a766f036635da0 DIFF: https://github.com/llvm/llvm-project/commit/e51c2d6a747d8c85dee711edd3a766f036635da0.diff LOG: [tools] Update update_test_prefix.py to handle %s after prefixes Sometimes the check-prefixes is followed by %s, and we want to keep a white space before it. Differential Revision: https://reviews.llvm.org/D92542 Added: Modified: llvm/utils/update_test_prefix.py Removed: diff --git a/llvm/utils/update_test_prefix.py b/llvm/utils/update_test_prefix.py index 9d383cae6f9f..28122cc34c40 100755 --- a/llvm/utils/update_test_prefix.py +++ b/llvm/utils/update_test_prefix.py @@ -18,8 +18,7 @@ def remove_prefix(i, d=0): s = re.sub(',' + p + '([, \n])', '\\1', s) s = re.sub('\s+-?-check-prefix=' + p + '([ \n])', '\\1', s) else: -s = re.sub('-?-check-prefixes=([^, ]+\n)', '--check-prefix=\\1', s) -s = re.sub('-?-check-prefixes=([^, ]+) ', '--check-prefix=\\1', s) +s = re.sub('-?-check-prefixes=([\w-]+)(\Z|[ \t\n])', '--check-prefix=\\1\\2', s) t = re.search('-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)', s) while t: s = re.sub(t.group(), '--check-prefixes=' + t.group(1) + ',' + t.group(2), s) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] bab72dd - [NFC][MC] TargetRegisterInfo::getSubReg is a MCRegister.
Author: Mircea Trofin Date: 2020-12-02T15:46:38-08:00 New Revision: bab72dd5d5122817f41320ddde8e3246dfb5fc28 URL: https://github.com/llvm/llvm-project/commit/bab72dd5d5122817f41320ddde8e3246dfb5fc28 DIFF: https://github.com/llvm/llvm-project/commit/bab72dd5d5122817f41320ddde8e3246dfb5fc28.diff LOG: [NFC][MC] TargetRegisterInfo::getSubReg is a MCRegister. Typing the API appropriately. Differential Revision: https://reviews.llvm.org/D92341 Added: Modified: llvm/include/llvm/CodeGen/TargetRegisterInfo.h llvm/lib/CodeGen/CalcSpillWeights.cpp llvm/lib/CodeGen/RegAllocFast.cpp llvm/lib/CodeGen/RegisterCoalescer.cpp llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp llvm/lib/Target/ARM/ARMAsmPrinter.cpp llvm/lib/Target/Hexagon/BitTracker.cpp llvm/lib/Target/Hexagon/BitTracker.h llvm/lib/Target/Hexagon/HexagonBitTracker.cpp llvm/lib/Target/Hexagon/HexagonBitTracker.h llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp llvm/lib/Target/Mips/MipsExpandPseudo.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/TargetRegisterInfo.h b/llvm/include/llvm/CodeGen/TargetRegisterInfo.h index ff5104c11500..de2c1b069784 100644 --- a/llvm/include/llvm/CodeGen/TargetRegisterInfo.h +++ b/llvm/include/llvm/CodeGen/TargetRegisterInfo.h @@ -1030,7 +1030,7 @@ class TargetRegisterInfo : public MCRegisterInfo { /// Returns the physical register number of sub-register "Index" /// for physical register RegNo. Return zero if the sub-register does not /// exist. - inline Register getSubReg(MCRegister Reg, unsigned Idx) const { + inline MCRegister getSubReg(MCRegister Reg, unsigned Idx) const { return static_cast(this)->getSubReg(Reg, Idx); } }; diff --git a/llvm/lib/CodeGen/CalcSpillWeights.cpp b/llvm/lib/CodeGen/CalcSpillWeights.cpp index 0a268a20d365..bf31441c37bb 100644 --- a/llvm/lib/CodeGen/CalcSpillWeights.cpp +++ b/llvm/lib/CodeGen/CalcSpillWeights.cpp @@ -64,7 +64,7 @@ static Register copyHint(const MachineInstr *MI, unsigned Reg, return Sub == HSub ? HReg : Register(); const TargetRegisterClass *rc = MRI.getRegClass(Reg); - Register CopiedPReg = (HSub ? TRI.getSubReg(HReg, HSub) : HReg); + MCRegister CopiedPReg = HSub ? TRI.getSubReg(HReg, HSub) : HReg.asMCReg(); if (rc->contains(CopiedPReg)) return CopiedPReg; diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index 3d83fcf8e09c..09c4674e4be6 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -950,7 +950,7 @@ void RegAllocFast::setPhysReg(MachineInstr &MI, MachineOperand &MO, } // Handle subregister index. - MO.setReg(PhysReg ? TRI->getSubReg(PhysReg, MO.getSubReg()) : Register()); + MO.setReg(PhysReg ? TRI->getSubReg(PhysReg, MO.getSubReg()) : MCRegister()); MO.setIsRenamable(true); // Note: We leave the subreg number around a little longer in case of defs. // This is so that the register freeing logic in allocateInstruction can still diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index d244434801fb..7deabe6761d9 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -538,8 +538,8 @@ bool CoalescerPair::isCoalescable(const MachineInstr *MI) const { } // Now check that Dst matches DstReg. - if (Register::isPhysicalRegister(DstReg)) { -if (!Register::isPhysicalRegister(Dst)) + if (DstReg.isPhysical()) { +if (!Dst.isPhysical()) return false; assert(!DstIdx && !SrcIdx && "Inconsistent CoalescerPair state."); // DstSub could be set for a physreg from INSERT_SUBREG. @@ -549,7 +549,7 @@ bool CoalescerPair::isCoalescable(const MachineInstr *MI) const { if (!SrcSub) return DstReg == Dst; // This is a partial register copy. Check that the parts match. -return TRI.getSubReg(DstReg, SrcSub) == Dst; +return Register(TRI.getSubReg(DstReg, SrcSub)) == Dst; } else { // DstReg is virtual. if (DstReg != Dst) diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp index 71db374081e0..9d7a041390ca 100644 --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp @@ -840,9 +840,10 @@ void SIRegisterInfo::buildSpillLoadStore(MachineBasicBlock::iterator MI, // FIXME: Flat scratch does not have to be limited to a dword per store. for (unsigned i = 0, e = NumSubRegs; i != e; ++i, Offset += EltSize) { -Register SubReg = NumSubRegs == 1 - ? Register(ValueReg) - : getSubReg(ValueReg, getSubRegFromChannel(i)); +Register SubReg = +NumSubRegs == 1 +? ValueReg +: Register(getSubReg(ValueReg, getSubRegFromChannel(i))); unsigned SOffsetRegState = 0; unsigned SrcDstRegState = g
[llvm-branch-commits] [clang] 5fe1026 - [llvm][inliner] Reuse the inliner pass to implement 'always inliner'
Author: Mircea Trofin Date: 2020-11-30T12:03:39-08:00 New Revision: 5fe10263ab39be96e316f37272b85a72596a7928 URL: https://github.com/llvm/llvm-project/commit/5fe10263ab39be96e316f37272b85a72596a7928 DIFF: https://github.com/llvm/llvm-project/commit/5fe10263ab39be96e316f37272b85a72596a7928.diff LOG: [llvm][inliner] Reuse the inliner pass to implement 'always inliner' Enable performing mandatory inlinings upfront, by reusing the same logic as the full inliner, instead of the AlwaysInliner. This has the following benefits: - reduce code duplication - one inliner codebase - open the opportunity to help the full inliner by performing additional function passes after the mandatory inlinings, but before th full inliner. Performing the mandatory inlinings first simplifies the problem the full inliner needs to solve: less call sites, more contextualization, and, depending on the additional function optimization passes run between the 2 inliners, higher accuracy of cost models / decision policies. Note that this patch does not yet enable much in terms of post-always inline function optimization. Differential Revision: https://reviews.llvm.org/D91567 Added: Modified: clang/test/CodeGen/thinlto-distributed-newpm.ll clang/test/Frontend/optimization-remark-line-directive.c clang/test/Frontend/optimization-remark-new-pm.c clang/test/Frontend/optimization-remark-with-hotness-new-pm.c clang/test/Frontend/optimization-remark.c llvm/include/llvm/Analysis/InlineAdvisor.h llvm/include/llvm/Passes/PassBuilder.h llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Analysis/MLInlineAdvisor.cpp llvm/lib/Passes/PassBuilder.cpp llvm/lib/Passes/PassRegistry.def llvm/lib/Transforms/IPO/Inliner.cpp llvm/test/Other/new-pm-defaults.ll llvm/test/Other/new-pm-lto-defaults.ll llvm/test/Other/new-pm-module-inliner-wrapper.ll llvm/test/Other/new-pm-thinlto-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll llvm/test/Transforms/Inline/ML/bounds-checks.ll llvm/test/Transforms/Inline/inline_stats.ll llvm/test/Transforms/Inline/pr46945.ll Removed: diff --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll b/clang/test/CodeGen/thinlto-distributed-newpm.ll index 3056bf45877a..75ea4064d6af 100644 --- a/clang/test/CodeGen/thinlto-distributed-newpm.ll +++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll @@ -63,14 +63,19 @@ ; CHECK-O: Running analysis: OuterAnalysisManagerProxy ; CHECK-O: Running pass: SimplifyCFGPass on main ; CHECK-O: Finished {{.*}}Function pass manager run. -; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA -; CHECK-O: Running analysis: GlobalsAA -; CHECK-O: Running analysis: CallGraphAnalysis -; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis +; CHECK-O: Running pass: ModuleInlinerWrapperPass +; CHECK-O: Running analysis: InlineAdvisorAnalysis ; CHECK-O: Running analysis: InnerAnalysisManagerProxy ; CHECK-O: Running analysis: LazyCallGraphAnalysis ; CHECK-O: Running analysis: FunctionAnalysisManagerCGSCCProxy on (main) ; CHECK-O: Running analysis: OuterAnalysisManagerProxy +; CHECK-O: Running pass: InlinerPass on (main) +; CHECK-O: Finished {{.*}}Module pass manager run +; CHECK-O: Running pass: ModuleInlinerWrapperPass +; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA +; CHECK-O: Running analysis: GlobalsAA +; CHECK-O: Running analysis: CallGraphAnalysis +; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis ; CHECK-O: Starting CGSCC pass manager run. ; CHECK-O: Running pass: InlinerPass on (main) ; CHECK-O: Running pass: PostOrderFunctionAttrsPass on (main) diff --git a/clang/test/Frontend/optimization-remark-line-directive.c b/clang/test/Frontend/optimization-remark-line-directive.c index 095791e505f8..5a2dc6754763 100644 --- a/clang/test/Frontend/optimization-remark-line-directive.c +++ b/clang/test/Frontend/optimization-remark-line-directive.c @@ -6,7 +6,7 @@ // The new PM inliner is not added to the default pipeline at O0, so we add // some optimizations to trigger it. -// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -debug-info-kind=line-tables-only -emit-llvm-only -verify +// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -debug-info-kind=line-tables-only -emit-llvm-only -verify -mllvm -mandatory-inlining-first=0 int foo(int x, int y) __attribute__((always_inline)); int foo(int x, int y) { return x + y; } diff --git a/clang/test/Frontend/optimization-remark-new-pm.c b/clang/test/Frontend/optimization-remark-new-pm.c index 885dc686dafc..79e8301
[llvm-branch-commits] [clang] 2482648 - thinlto_embed_bitcode.ll: clarify grep should treat input as text
Author: Mircea Trofin Date: 2020-11-21T21:46:53-08:00 New Revision: 2482648a795afbe12774168bbbf70dc14c031267 URL: https://github.com/llvm/llvm-project/commit/2482648a795afbe12774168bbbf70dc14c031267 DIFF: https://github.com/llvm/llvm-project/commit/2482648a795afbe12774168bbbf70dc14c031267.diff LOG: thinlto_embed_bitcode.ll: clarify grep should treat input as text The input to the test's use of grep should be treated as text, and that's not the case on certain Linux distros. Added --text. Added: Modified: clang/test/CodeGen/thinlto_embed_bitcode.ll Removed: diff --git a/clang/test/CodeGen/thinlto_embed_bitcode.ll b/clang/test/CodeGen/thinlto_embed_bitcode.ll index 6c7e36e7226b..971d4005435d 100644 --- a/clang/test/CodeGen/thinlto_embed_bitcode.ll +++ b/clang/test/CodeGen/thinlto_embed_bitcode.ll @@ -18,7 +18,7 @@ ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt ; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD ; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null -; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1 +; RUN: grep --text x86_64-unknown-linux-gnu %t-embedded.cmd | count 1 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT ; We should only need the index and the post-thinlto merged module to generate ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] ab326ac - [llvm][NFC] Cache FAM in InlineAdvisor
Author: Mircea Trofin Date: 2020-06-01T12:38:53-07:00 New Revision: ab326ac96ecb0379b8fe268b43e65a9115bb634f URL: https://github.com/llvm/llvm-project/commit/ab326ac96ecb0379b8fe268b43e65a9115bb634f DIFF: https://github.com/llvm/llvm-project/commit/ab326ac96ecb0379b8fe268b43e65a9115bb634f.diff LOG: [llvm][NFC] Cache FAM in InlineAdvisor Summary: This simplifies the interface by storing the function analysis manager with the InlineAdvisor, and, thus, not requiring it be passed each time we inquire for an advice. Reviewers: davidxl, asbirlea Subscribers: eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80405 Added: Modified: llvm/include/llvm/Analysis/InlineAdvisor.h llvm/include/llvm/Transforms/IPO/Inliner.h llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Transforms/IPO/Inliner.cpp Removed: diff --git a/llvm/include/llvm/Analysis/InlineAdvisor.h b/llvm/include/llvm/Analysis/InlineAdvisor.h index ac8e7c20429d..e9f08a69a5af 100644 --- a/llvm/include/llvm/Analysis/InlineAdvisor.h +++ b/llvm/include/llvm/Analysis/InlineAdvisor.h @@ -116,8 +116,7 @@ class InlineAdvisor { /// inline or not. \p CB is assumed to be a direct call. \p FAM is assumed to /// be up-to-date wrt previous inlining decisions. /// Returns an InlineAdvice with the inlining recommendation. - virtual std::unique_ptr - getAdvice(CallBase &CB, FunctionAnalysisManager &FAM) = 0; + virtual std::unique_ptr getAdvice(CallBase &CB) = 0; /// This must be called when the Inliner pass is entered, to allow the /// InlineAdvisor update internal state, as result of function passes run @@ -130,7 +129,9 @@ class InlineAdvisor { virtual void onPassExit() {} protected: - InlineAdvisor() = default; + InlineAdvisor(FunctionAnalysisManager &FAM) : FAM(FAM) {} + + FunctionAnalysisManager &FAM; /// We may want to defer deleting functions to after the inlining for a whole /// module has finished. This allows us to reliably use function pointers as @@ -156,13 +157,14 @@ class InlineAdvisor { /// reusable as-is for inliner pass test scenarios, as well as for regular use. class DefaultInlineAdvisor : public InlineAdvisor { public: - DefaultInlineAdvisor(InlineParams Params) : Params(Params) {} + DefaultInlineAdvisor(FunctionAnalysisManager &FAM, InlineParams Params) + : InlineAdvisor(FAM), Params(Params) {} private: - std::unique_ptr - getAdvice(CallBase &CB, FunctionAnalysisManager &FAM) override; + std::unique_ptr getAdvice(CallBase &CB) override; void onPassExit() override { freeDeletedFunctions(); } + InlineParams Params; }; @@ -173,7 +175,7 @@ class InlineAdvisorAnalysis : public AnalysisInfoMixin { static AnalysisKey Key; InlineAdvisorAnalysis() = default; struct Result { -Result(Module &M, ModuleAnalysisManager &MAM) {} +Result(Module &M, ModuleAnalysisManager &MAM) : M(M), MAM(MAM) {} bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &) { // InlineAdvisor must be preserved across analysis invalidations. @@ -184,6 +186,8 @@ class InlineAdvisorAnalysis : public AnalysisInfoMixin { void clear() { Advisor.reset(); } private: +Module &M; +ModuleAnalysisManager &MAM; std::unique_ptr Advisor; }; diff --git a/llvm/include/llvm/Transforms/IPO/Inliner.h b/llvm/include/llvm/Transforms/IPO/Inliner.h index 447616102c0d..3454b0af0d9f 100644 --- a/llvm/include/llvm/Transforms/IPO/Inliner.h +++ b/llvm/include/llvm/Transforms/IPO/Inliner.h @@ -106,7 +106,7 @@ class InlinerPass : public PassInfoMixin { private: InlineAdvisor &getAdvisor(const ModuleAnalysisManagerCGSCCProxy::Result &MAM, -Module &M); +FunctionAnalysisManager &FAM, Module &M); std::unique_ptr ImportedFunctionsStats; Optional OwnedDefaultAdvisor; }; diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp index ac3ba451aa3f..7af8a4dffcba 100644 --- a/llvm/lib/Analysis/InlineAdvisor.cpp +++ b/llvm/lib/Analysis/InlineAdvisor.cpp @@ -90,8 +90,7 @@ class DefaultInlineAdvice : public InlineAdvice { } // namespace -std::unique_ptr -DefaultInlineAdvisor::getAdvice(CallBase &CB, FunctionAnalysisManager &FAM) { +std::unique_ptr DefaultInlineAdvisor::getAdvice(CallBase &CB) { Function &Caller = *CB.getCaller(); ProfileSummaryInfo *PSI = FAM.getResult(Caller) @@ -149,9 +148,10 @@ AnalysisKey InlineAdvisorAnalysis::Key; bool InlineAdvisorAnalysis::Result::tryCreate(InlineParams Params, InliningAdvisorMode Mode) { + auto &FAM = MAM.getResult(M).getManager(); switch (Mode) { case InliningAdvisorMode::Default: -Advisor.reset(new DefaultInlineAdvisor(Params)); +Advisor.reset(new DefaultInlineAdvisor(FA