llvm.org GIT mirror llvm / 61ce277
[PM] Port indirect call promotion pass to new pass manager git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269660 91177308-0d34-0410-b5e6-96231b3b80d8 Xinliang David Li 3 years ago
9 changed file(s) with 27 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3434 std::string ProfileFileName;
3535 };
3636
37 /// The indirect function call promotion pass.
38 class PGOIndirectCallPromotion : public PassInfoMixin {
39 public:
40 PGOIndirectCallPromotion() : InLTO(false) {}
41 PreservedAnalyses run(Module &M, AnalysisManager &AM);
42 void setInLTO() { InLTO = true; }
43 private:
44 bool InLTO;
45 };
46
3747 } // End llvm namespace
3848 #endif
4646 MODULE_PASS("invalidate", InvalidateAllAnalysesPass())
4747 MODULE_PASS("ipsccp", IPSCCPPass())
4848 MODULE_PASS("no-op-module", NoOpModulePass())
49 MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
4950 MODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
5051 MODULE_PASS("pgo-instr-use", PGOInstrumentationUse())
5152 MODULE_PASS("print", PrintModulePass(dbgs()))
3030 #include "llvm/ProfileData/InstrProfReader.h"
3131 #include "llvm/Support/Debug.h"
3232 #include "llvm/Transforms/Instrumentation.h"
33 #include "llvm/Transforms/PGOInstrumentation.h"
3334 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
3435 #include
3536 #include
692693 InLTO |= ICPLTOMode;
693694 return promoteIndirectCalls(M, InLTO);
694695 }
696
697 PreservedAnalyses PGOIndirectCallPromotion::run(Module &M, AnalysisManager &AM) {
698 InLTO |= ICPLTOMode;
699 if (!promoteIndirectCalls(M, InLTO))
700 return PreservedAnalyses::all();
701
702 return PreservedAnalyses::none();
703 }
0 ; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
1 ; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34
0 ; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
1 ; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34 %struct.D = type { %struct.B }
0 ; RUN: opt < %s -icp-lto -pgo-icall-prom -S -icp-count-threshold=0 | FileCheck %s --check-prefix=ICP
1 ; RUN: opt < %s -icp-lto -passes=pgo-icall-prom -S -icp-count-threshold=0 | FileCheck %s --check-prefix=ICP
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34
0 ; RUN: opt < %s -pgo-icall-prom -pass-remarks-missed=PGOIndirectCallPromotion -S 2>& 1 | FileCheck %s
1 ; RUN: opt < %s -passes=pgo-icall-prom -pass-remarks-missed=PGOIndirectCallPromotion -S 2>& 1 | FileCheck %s
12
23 ; CHECK: remark: :0:0: Cannot promote indirect call to func4 with count of 1234: The number of arguments mismatch
34 ; CHECK: remark: :0:0: Cannot promote indirect call to 11517462787082255043 with count of 2345: Cannot find the target
0 ; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
1 ; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34
0 ; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
1 ; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
12 ; RUN: opt < %s -pgo-icall-prom -S -pass-remarks=PGOIndirectCallPromotion -icp-count-threshold=0 -icp-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS-REMARK
3 ; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=PGOIndirectCallPromotion -icp-count-threshold=0 -icp-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS-REMARK
24 ; PASS-REMARK: remark: :0:0: Promote indirect call to func4 with count 1030 out of 1600
35 ; PASS-REMARK: remark: :0:0: Promote indirect call to func2 with count 410 out of 570
46 ; PASS-REMARK: remark: :0:0: Promote indirect call to func3 with count 150 out of 160