|
|
|||
File indexing completed on 2026-05-10 08:44:42
0001 //===- AssumeBundleBuilder.h - utils to build assume bundles ----*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file contain tools to preserve informations. They should be used before 0010 // performing a transformation that may move and delete instructions as those 0011 // transformation may destroy or worsen information that can be derived from the 0012 // IR. 0013 // 0014 //===----------------------------------------------------------------------===// 0015 0016 #ifndef LLVM_TRANSFORMS_UTILS_ASSUMEBUNDLEBUILDER_H 0017 #define LLVM_TRANSFORMS_UTILS_ASSUMEBUNDLEBUILDER_H 0018 0019 #include "llvm/Analysis/AssumeBundleQueries.h" 0020 #include "llvm/IR/PassManager.h" 0021 #include "llvm/Support/CommandLine.h" 0022 0023 namespace llvm { 0024 class AssumeInst; 0025 class Function; 0026 class Instruction; 0027 class AssumptionCache; 0028 class DominatorTree; 0029 0030 extern cl::opt<bool> EnableKnowledgeRetention; 0031 0032 /// Build a call to llvm.assume to preserve informations that can be derived 0033 /// from the given instruction. 0034 /// If no information derived from \p I, this call returns null. 0035 /// The returned instruction is not inserted anywhere. 0036 AssumeInst *buildAssumeFromInst(Instruction *I); 0037 0038 /// Calls BuildAssumeFromInst and if the resulting llvm.assume is valid insert 0039 /// if before I. This is usually what need to be done to salvage the knowledge 0040 /// contained in the instruction I. 0041 /// The AssumptionCache must be provided if it is available or the cache may 0042 /// become silently be invalid. 0043 /// The DominatorTree can optionally be provided to enable cross-block 0044 /// reasoning. 0045 /// This returns if a change was made. 0046 bool salvageKnowledge(Instruction *I, AssumptionCache *AC = nullptr, 0047 DominatorTree *DT = nullptr); 0048 0049 /// Build and return a new assume created from the provided knowledge 0050 /// if the knowledge in the assume is fully redundant this will return nullptr 0051 AssumeInst *buildAssumeFromKnowledge(ArrayRef<RetainedKnowledge> Knowledge, 0052 Instruction *CtxI, 0053 AssumptionCache *AC = nullptr, 0054 DominatorTree *DT = nullptr); 0055 0056 /// This pass attempts to minimize the number of assume without loosing any 0057 /// information. 0058 struct AssumeSimplifyPass : public PassInfoMixin<AssumeSimplifyPass> { 0059 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 0060 }; 0061 0062 /// This pass will try to build an llvm.assume for every instruction in the 0063 /// function. Its main purpose is testing. 0064 struct AssumeBuilderPass : public PassInfoMixin<AssumeBuilderPass> { 0065 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 0066 }; 0067 0068 /// canonicalize the RetainedKnowledge RK. it is assumed that RK is part of 0069 /// Assume. This will return an empty RetainedKnowledge if the knowledge is 0070 /// useless. 0071 RetainedKnowledge simplifyRetainedKnowledge(AssumeInst *Assume, 0072 RetainedKnowledge RK, 0073 AssumptionCache *AC, 0074 DominatorTree *DT); 0075 0076 } // namespace llvm 0077 0078 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|