73 const llvm::SmallPtrSetImpl<Block *> ¬ForAnalysis_,
74 llvm::DenseMap<Operation *, bool> &readOnlyCache_,
76 const llvm::SmallPtrSetImpl<Value> &ConstantValues,
77 const llvm::SmallPtrSetImpl<Value> &ActiveValues,
79 : notForAnalysis(notForAnalysis_), readOnlyCache(readOnlyCache_),
81 ConstantValues(ConstantValues.begin(), ConstantValues.end()),
82 ActiveValues(ActiveValues.begin(), ActiveValues.end()) {}
96 DenseMap<Operation *, llvm::SmallPtrSet<Value, 4>>
97 ReEvaluateValueIfInactiveOp;
98 DenseMap<Value, llvm::SmallPtrSet<Value, 4>> ReEvaluateValueIfInactiveValue;
99 DenseMap<Value, llvm::SmallPtrSet<Operation *, 4>>
100 ReEvaluateOpIfInactiveValue;
102 void InsertConstantOperation(MTypeResults
const &TR, Operation *op);
103 void InsertConstantValue(MTypeResults
const &TR, Value V);
108 : notForAnalysis(Other.notForAnalysis),
110 directions(directions), ConstantOperations(Other.ConstantOperations),
111 ActiveOperations(Other.ActiveOperations),
112 ConstantValues(Other.ConstantValues), ActiveValues(Other.ActiveValues) {
114 assert(directions != 0);
115 assert((directions & Other.directions) == directions);
116 assert((directions & Other.directions) != 0);
120 void insertConstantsFrom(MTypeResults
const &TR,
122 for (
auto I : Hypothesis.ConstantOperations) {
123 InsertConstantOperation(TR, I);
125 for (
auto V : Hypothesis.ConstantValues) {
126 InsertConstantValue(TR, V);
133 insertConstantsFrom(TR, Hypothesis);
134 for (
auto I : Hypothesis.ActiveOperations) {
135 bool inserted = ActiveOperations.insert(I).second;
136 if (inserted && directions == 3) {
137 ReEvaluateOpIfInactiveValue[Orig].insert(I);
140 for (
auto V : Hypothesis.ActiveValues) {
141 bool inserted = ActiveValues.insert(V).second;
142 if (inserted && directions == 3) {
143 ReEvaluateValueIfInactiveValue[Orig].insert(V);
149 bool isFunctionArgumentConstant(mlir::CallOpInterface CI, Value val);
154 bool isValueInactiveFromOrigin(
155 MTypeResults
const &TR, Value val,
156 llvm::SmallPtrSetImpl<mlir::Value> *inactArg =
nullptr);
160 bool isOperationInactiveFromOrigin(
161 MTypeResults
const &TR, Operation *op,
162 std::optional<unsigned> resultNo = std::nullopt,
163 llvm::SmallPtrSetImpl<mlir::Value> *inactArg =
nullptr);
185 Operation **FoundInst =
nullptr);
189 bool outside =
false);
194 std::map<std::pair<bool, Value>,
bool> StoredOrReturnedCache;
199inline bool operator<(
const Value &lhs,
const Value &rhs) {
200 return lhs.getAsOpaquePointer() < rhs.getAsOpaquePointer();