mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
c112624b0b
As discussed in D101191, this patch adds a poison-safe folding of overflow bit check: ``` %Op0 = icmp ne i4 %X, 0 %Agg = call { i4, i1 } @llvm.[us]mul.with.overflow.i4(i4 %X, i4 %Y) %Op1 = extractvalue { i4, i1 } %Agg, 1 %ret = select i1 %Op0, i1 %Op1, i1 false => %Y.fr = freeze %Y %Agg = call { i4, i1 } @llvm.[us]mul.with.overflow.i4(i4 %X, i4 %Y.fr) %Op1 = extractvalue { i4, i1 } %Agg, 1 %ret = %Op1 ``` https://alive2.llvm.org/ce/z/zgPUGT https://alive2.llvm.org/ce/z/h2gZ_6 Note that there are cases where inserting freeze is not necessary: e.g. %Y is `noundef`. In this case, LLVM is already good because `%ret` is already successfully folded into `and`, triggering the pre-existing optimization in InstSimplify: https://godbolt.org/z/v6qena15K Differential Revision: https://reviews.llvm.org/D101423
154 lines
3.4 KiB
CMake
154 lines
3.4 KiB
CMake
if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
|
|
if (DEFINED LLVM_HAVE_TF_AOT)
|
|
set(LLVM_INLINER_MODEL_PATH "models/inliner"
|
|
CACHE STRING
|
|
"ML-driven inliner policy location (path to saved model)")
|
|
include(TensorFlowCompile)
|
|
tfcompile(${LLVM_INLINER_MODEL_PATH} serve action InlinerSizeModel llvm::InlinerSizeModel)
|
|
list(APPEND GeneratedMLSources
|
|
${GENERATED_HEADERS}
|
|
)
|
|
LIST(APPEND MLDeps tf_xla_runtime)
|
|
LIST(APPEND MLLinkDeps tf_xla_runtime ${GENERATED_OBJS})
|
|
endif()
|
|
|
|
if (DEFINED LLVM_HAVE_TF_API)
|
|
LIST(APPEND MLLinkDeps ${tensorflow_c_api})
|
|
endif()
|
|
endif()
|
|
|
|
add_llvm_component_library(LLVMAnalysis
|
|
AliasAnalysis.cpp
|
|
AliasAnalysisEvaluator.cpp
|
|
AliasAnalysisSummary.cpp
|
|
AliasSetTracker.cpp
|
|
Analysis.cpp
|
|
AssumeBundleQueries.cpp
|
|
AssumptionCache.cpp
|
|
BasicAliasAnalysis.cpp
|
|
BlockFrequencyInfo.cpp
|
|
BlockFrequencyInfoImpl.cpp
|
|
BranchProbabilityInfo.cpp
|
|
CFG.cpp
|
|
CFGPrinter.cpp
|
|
CFLAndersAliasAnalysis.cpp
|
|
CFLSteensAliasAnalysis.cpp
|
|
CGSCCPassManager.cpp
|
|
CallGraph.cpp
|
|
CallGraphSCCPass.cpp
|
|
CallPrinter.cpp
|
|
CaptureTracking.cpp
|
|
CmpInstAnalysis.cpp
|
|
CostModel.cpp
|
|
CodeMetrics.cpp
|
|
ConstantFolding.cpp
|
|
DDG.cpp
|
|
DDGPrinter.cpp
|
|
ConstraintSystem.cpp
|
|
Delinearization.cpp
|
|
DemandedBits.cpp
|
|
DependenceAnalysis.cpp
|
|
DependenceGraphBuilder.cpp
|
|
DevelopmentModeInlineAdvisor.cpp
|
|
DivergenceAnalysis.cpp
|
|
DomPrinter.cpp
|
|
DomTreeUpdater.cpp
|
|
DominanceFrontier.cpp
|
|
EHPersonalities.cpp
|
|
FunctionPropertiesAnalysis.cpp
|
|
GlobalsModRef.cpp
|
|
GuardUtils.cpp
|
|
HeatUtils.cpp
|
|
IRSimilarityIdentifier.cpp
|
|
IVDescriptors.cpp
|
|
IVUsers.cpp
|
|
ImportedFunctionsInliningStatistics.cpp
|
|
IndirectCallPromotionAnalysis.cpp
|
|
InlineCost.cpp
|
|
InlineAdvisor.cpp
|
|
InlineSizeEstimatorAnalysis.cpp
|
|
InstCount.cpp
|
|
InstructionPrecedenceTracking.cpp
|
|
InstructionSimplify.cpp
|
|
Interval.cpp
|
|
IntervalPartition.cpp
|
|
LazyBranchProbabilityInfo.cpp
|
|
LazyBlockFrequencyInfo.cpp
|
|
LazyCallGraph.cpp
|
|
LazyValueInfo.cpp
|
|
LegacyDivergenceAnalysis.cpp
|
|
Lint.cpp
|
|
Loads.cpp
|
|
LoopAccessAnalysis.cpp
|
|
LoopAnalysisManager.cpp
|
|
LoopCacheAnalysis.cpp
|
|
LoopNestAnalysis.cpp
|
|
LoopUnrollAnalyzer.cpp
|
|
LoopInfo.cpp
|
|
LoopPass.cpp
|
|
MLInlineAdvisor.cpp
|
|
MemDepPrinter.cpp
|
|
MemDerefPrinter.cpp
|
|
MemoryBuiltins.cpp
|
|
MemoryDependenceAnalysis.cpp
|
|
MemoryLocation.cpp
|
|
MemorySSA.cpp
|
|
MemorySSAUpdater.cpp
|
|
ModuleDebugInfoPrinter.cpp
|
|
ModuleSummaryAnalysis.cpp
|
|
MustExecute.cpp
|
|
ObjCARCAliasAnalysis.cpp
|
|
ObjCARCAnalysisUtils.cpp
|
|
ObjCARCInstKind.cpp
|
|
OptimizationRemarkEmitter.cpp
|
|
OverflowInstAnalysis.cpp
|
|
PHITransAddr.cpp
|
|
PhiValues.cpp
|
|
PostDominators.cpp
|
|
ProfileSummaryInfo.cpp
|
|
PtrUseVisitor.cpp
|
|
RegionInfo.cpp
|
|
RegionPass.cpp
|
|
RegionPrinter.cpp
|
|
ReleaseModeModelRunner.cpp
|
|
ReplayInlineAdvisor.cpp
|
|
ScalarEvolution.cpp
|
|
ScalarEvolutionAliasAnalysis.cpp
|
|
ScalarEvolutionDivision.cpp
|
|
ScalarEvolutionNormalization.cpp
|
|
StackLifetime.cpp
|
|
StackSafetyAnalysis.cpp
|
|
SyncDependenceAnalysis.cpp
|
|
SyntheticCountsUtils.cpp
|
|
TFUtils.cpp
|
|
TargetLibraryInfo.cpp
|
|
TargetTransformInfo.cpp
|
|
Trace.cpp
|
|
TypeBasedAliasAnalysis.cpp
|
|
TypeMetadataUtils.cpp
|
|
ScopedNoAliasAA.cpp
|
|
ValueLattice.cpp
|
|
ValueLatticeUtils.cpp
|
|
ValueTracking.cpp
|
|
VectorUtils.cpp
|
|
VFABIDemangling.cpp
|
|
${GeneratedMLSources}
|
|
|
|
ADDITIONAL_HEADER_DIRS
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Analysis
|
|
|
|
DEPENDS
|
|
intrinsics_gen
|
|
${MLDeps}
|
|
|
|
LINK_LIBS
|
|
${MLLinkDeps}
|
|
|
|
LINK_COMPONENTS
|
|
BinaryFormat
|
|
Core
|
|
Object
|
|
ProfileData
|
|
Support
|
|
)
|