Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / include / llvm / Transforms / Instrumentation / PGOInstrumentation.h
blob4f22e28232e72f1b357c13ba999eabf38c2420a0
1 //===- Transforms/Instrumentation/PGOInstrumentation.h ----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// This file provides the interface for IR based instrumentation passes (
11 /// (profile-gen, and profile-use).
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
16 #define LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/IR/PassManager.h"
20 #include <cstdint>
21 #include <string>
23 namespace llvm {
25 class Function;
26 class Instruction;
27 class Module;
29 /// The instrumentation (profile-instr-gen) pass for IR based PGO.
30 class PGOInstrumentationGen : public PassInfoMixin<PGOInstrumentationGen> {
31 public:
32 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
35 /// The profile annotation (profile-instr-use) pass for IR based PGO.
36 class PGOInstrumentationUse : public PassInfoMixin<PGOInstrumentationUse> {
37 public:
38 PGOInstrumentationUse(std::string Filename = "",
39 std::string RemappingFilename = "");
41 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
43 private:
44 std::string ProfileFileName;
45 std::string ProfileRemappingFileName;
48 /// The indirect function call promotion pass.
49 class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
50 public:
51 PGOIndirectCallPromotion(bool IsInLTO = false, bool SamplePGO = false)
52 : InLTO(IsInLTO), SamplePGO(SamplePGO) {}
54 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
56 private:
57 bool InLTO;
58 bool SamplePGO;
61 /// The profile size based optimization pass for memory intrinsics.
62 class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
63 public:
64 PGOMemOPSizeOpt() = default;
66 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
69 void setProfMetadata(Module *M, Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
70 uint64_t MaxCount);
72 void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count);
74 } // end namespace llvm
76 #endif // LLVM_TRANSFORMS_PGOINSTRUMENTATION_H