mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-26 22:42:46 +02:00
479a57ca4a
Summary: Implement guard widening in LLVM. Description from GuardWidening.cpp: The semantics of the `@llvm.experimental.guard` intrinsic lets LLVM transform it so that it fails more often that it did before the transform. This optimization is called "widening" and can be used hoist and common runtime checks in situations like these: ``` %cmp0 = 7 u< Length call @llvm.experimental.guard(i1 %cmp0) [ "deopt"(...) ] call @unknown_side_effects() %cmp1 = 9 u< Length call @llvm.experimental.guard(i1 %cmp1) [ "deopt"(...) ] ... ``` to ``` %cmp0 = 9 u< Length call @llvm.experimental.guard(i1 %cmp0) [ "deopt"(...) ] call @unknown_side_effects() ... ``` If `%cmp0` is false, `@llvm.experimental.guard` will "deoptimize" back to a generic implementation of the same function, which will have the correct semantics from that point onward. It is always _legal_ to deoptimize (so replacing `%cmp0` with false is "correct"), though it may not always be profitable to do so. NB! This pass is a work in progress. It hasn't been tuned to be "production ready" yet. It is known to have quadriatic running time and will not scale to large numbers of guards Reviewers: reames, atrick, bogner, apilipenko, nlewycky Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D20143 llvm-svn: 269997
159 lines
6.3 KiB
C++
159 lines
6.3 KiB
C++
//===- PassRegistry.def - Registry of passes --------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file is used as the registry of passes that are part of the core LLVM
|
|
// libraries. This file describes both transformation passes and analyses
|
|
// Analyses are registered while transformation passes have names registered
|
|
// that can be used when providing a textual pass pipeline.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// NOTE: NO INCLUDE GUARD DESIRED!
|
|
|
|
#ifndef MODULE_ANALYSIS
|
|
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
MODULE_ANALYSIS("callgraph", CallGraphAnalysis())
|
|
MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
|
|
MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis())
|
|
MODULE_ANALYSIS("targetlibinfo", TargetLibraryAnalysis())
|
|
MODULE_ANALYSIS("verify", VerifierAnalysis())
|
|
|
|
#ifndef MODULE_ALIAS_ANALYSIS
|
|
#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
|
|
MODULE_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
MODULE_ALIAS_ANALYSIS("globals-aa", GlobalsAA())
|
|
#undef MODULE_ALIAS_ANALYSIS
|
|
#undef MODULE_ANALYSIS
|
|
|
|
#ifndef MODULE_PASS
|
|
#define MODULE_PASS(NAME, CREATE_PASS)
|
|
#endif
|
|
MODULE_PASS("constmerge", ConstantMergePass())
|
|
MODULE_PASS("elim-avail-extern", EliminateAvailableExternallyPass())
|
|
MODULE_PASS("forceattrs", ForceFunctionAttrsPass())
|
|
MODULE_PASS("globaldce", GlobalDCEPass())
|
|
MODULE_PASS("globalopt", GlobalOptPass())
|
|
MODULE_PASS("inferattrs", InferFunctionAttrsPass())
|
|
MODULE_PASS("internalize", InternalizePass())
|
|
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()))
|
|
MODULE_PASS("print-callgraph", CallGraphPrinterPass(dbgs()))
|
|
MODULE_PASS("print-lcg", LazyCallGraphPrinterPass(dbgs()))
|
|
MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
|
|
MODULE_PASS("verify", VerifierPass())
|
|
#undef MODULE_PASS
|
|
|
|
#ifndef CGSCC_ANALYSIS
|
|
#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis())
|
|
#undef CGSCC_ANALYSIS
|
|
|
|
#ifndef CGSCC_PASS
|
|
#define CGSCC_PASS(NAME, CREATE_PASS)
|
|
#endif
|
|
CGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
|
CGSCC_PASS("function-attrs", PostOrderFunctionAttrsPass())
|
|
CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
|
|
#undef CGSCC_PASS
|
|
|
|
#ifndef FUNCTION_ANALYSIS
|
|
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
FUNCTION_ANALYSIS("aa", AAManager())
|
|
FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
|
|
FUNCTION_ANALYSIS("block-freq", BlockFrequencyAnalysis())
|
|
FUNCTION_ANALYSIS("branch-prob", BranchProbabilityAnalysis())
|
|
FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
|
|
FUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
|
|
FUNCTION_ANALYSIS("demanded-bits", DemandedBitsAnalysis())
|
|
FUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
|
|
FUNCTION_ANALYSIS("loops", LoopAnalysis())
|
|
FUNCTION_ANALYSIS("da", DependenceAnalysis())
|
|
FUNCTION_ANALYSIS("memdep", MemoryDependenceAnalysis())
|
|
FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
|
|
FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
|
|
FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
|
|
FUNCTION_ANALYSIS("targetlibinfo", TargetLibraryAnalysis())
|
|
FUNCTION_ANALYSIS("targetir",
|
|
TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())
|
|
FUNCTION_ANALYSIS("verify", VerifierAnalysis())
|
|
|
|
#ifndef FUNCTION_ALIAS_ANALYSIS
|
|
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
|
|
FUNCTION_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
FUNCTION_ALIAS_ANALYSIS("basic-aa", BasicAA())
|
|
FUNCTION_ALIAS_ANALYSIS("cfl-aa", CFLAA())
|
|
FUNCTION_ALIAS_ANALYSIS("scev-aa", SCEVAA())
|
|
FUNCTION_ALIAS_ANALYSIS("scoped-noalias-aa", ScopedNoAliasAA())
|
|
FUNCTION_ALIAS_ANALYSIS("type-based-aa", TypeBasedAA())
|
|
#undef FUNCTION_ALIAS_ANALYSIS
|
|
#undef FUNCTION_ANALYSIS
|
|
|
|
#ifndef FUNCTION_PASS
|
|
#define FUNCTION_PASS(NAME, CREATE_PASS)
|
|
#endif
|
|
FUNCTION_PASS("aa-eval", AAEvaluator())
|
|
FUNCTION_PASS("adce", ADCEPass())
|
|
FUNCTION_PASS("dce", DCEPass())
|
|
FUNCTION_PASS("dse", DSEPass())
|
|
FUNCTION_PASS("early-cse", EarlyCSEPass())
|
|
FUNCTION_PASS("instcombine", InstCombinePass())
|
|
FUNCTION_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
|
FUNCTION_PASS("no-op-function", NoOpFunctionPass())
|
|
FUNCTION_PASS("loweratomic", LowerAtomicPass())
|
|
FUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
|
|
FUNCTION_PASS("guard-widening", GuardWideningPass())
|
|
FUNCTION_PASS("gvn", GVN())
|
|
FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
|
|
FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<regions>", RegionInfoPrinterPass(dbgs()))
|
|
FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
|
|
FUNCTION_PASS("reassociate", ReassociatePass())
|
|
FUNCTION_PASS("sccp", SCCPPass())
|
|
FUNCTION_PASS("simplify-cfg", SimplifyCFGPass())
|
|
FUNCTION_PASS("sink", SinkingPass())
|
|
FUNCTION_PASS("sroa", SROA())
|
|
FUNCTION_PASS("verify", VerifierPass())
|
|
FUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
|
|
FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
|
|
#undef FUNCTION_PASS
|
|
|
|
#ifndef LOOP_ANALYSIS
|
|
#define LOOP_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
LOOP_ANALYSIS("no-op-loop", NoOpLoopAnalysis())
|
|
#undef LOOP_ANALYSIS
|
|
|
|
#ifndef LOOP_PASS
|
|
#define LOOP_PASS(NAME, CREATE_PASS)
|
|
#endif
|
|
LOOP_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
|
LOOP_PASS("rotate", LoopRotatePass())
|
|
LOOP_PASS("no-op-loop", NoOpLoopPass())
|
|
LOOP_PASS("print", PrintLoopPass(dbgs()))
|
|
LOOP_PASS("simplify-cfg", LoopSimplifyCFGPass())
|
|
#undef LOOP_PASS
|