forked from OSchip/llvm-project
[PM] Port indirect call promotion pass to new pass manager
llvm-svn: 269660
This commit is contained in:
parent
e43198dc4b
commit
f3c7a35238
|
@ -35,5 +35,15 @@ private:
|
|||
std::string ProfileFileName;
|
||||
};
|
||||
|
||||
/// The indirect function call promotion pass.
|
||||
class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
|
||||
public:
|
||||
PGOIndirectCallPromotion() : InLTO(false) {}
|
||||
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
|
||||
void setInLTO() { InLTO = true; }
|
||||
private:
|
||||
bool InLTO;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
#endif
|
||||
|
|
|
@ -47,6 +47,7 @@ MODULE_PASS("instrprof", InstrProfiling())
|
|||
MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
||||
MODULE_PASS("ipsccp", IPSCCPPass())
|
||||
MODULE_PASS("no-op-module", NoOpModulePass())
|
||||
MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
|
||||
MODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
|
||||
MODULE_PASS("pgo-instr-use", PGOInstrumentationUse())
|
||||
MODULE_PASS("print", PrintModulePass(dbgs()))
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "llvm/ProfileData/InstrProfReader.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "llvm/Transforms/PGOInstrumentation.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -693,3 +694,11 @@ bool PGOIndirectCallPromotionLegacyPass::runOnModule(Module &M) {
|
|||
InLTO |= ICPLTOMode;
|
||||
return promoteIndirectCalls(M, InLTO);
|
||||
}
|
||||
|
||||
PreservedAnalyses PGOIndirectCallPromotion::run(Module &M, AnalysisManager<Module> &AM) {
|
||||
InLTO |= ICPLTOMode;
|
||||
if (!promoteIndirectCalls(M, InLTO))
|
||||
return PreservedAnalyses::all();
|
||||
|
||||
return PreservedAnalyses::none();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
%struct.D = type { %struct.B }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt < %s -icp-lto -pgo-icall-prom -S -icp-count-threshold=0 | FileCheck %s --check-prefix=ICP
|
||||
; RUN: opt < %s -icp-lto -passes=pgo-icall-prom -S -icp-count-threshold=0 | FileCheck %s --check-prefix=ICP
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt < %s -pgo-icall-prom -pass-remarks-missed=PGOIndirectCallPromotion -S 2>& 1 | FileCheck %s
|
||||
; RUN: opt < %s -passes=pgo-icall-prom -pass-remarks-missed=PGOIndirectCallPromotion -S 2>& 1 | FileCheck %s
|
||||
|
||||
; CHECK: remark: <unknown>:0:0: Cannot promote indirect call to func4 with count of 1234: The number of arguments mismatch
|
||||
; CHECK: remark: <unknown>:0:0: Cannot promote indirect call to 11517462787082255043 with count of 2345: Cannot find the target
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM
|
||||
; 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
|
||||
; 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
|
||||
; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 1600
|
||||
; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 570
|
||||
; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func3 with count 150 out of 160
|
||||
|
|
Loading…
Reference in New Issue