[Mlir-commits] [mlir] [mlir] support non-interprocedural dataflow analyses (PR #75583)

Markus Böck llvmlistbot at llvm.org
Tue Jan 23 00:59:09 PST 2024


================
@@ -116,8 +116,27 @@ void AbstractSparseForwardDataFlowAnalysis::visitOperation(Operation *op) {
                                  resultLattices);
   }
 
-  // The results of a call operation are determined by the callgraph.
+  // Grab the lattice elements of the operands.
+  SmallVector<const AbstractSparseLattice *> operandLattices;
+  operandLattices.reserve(op->getNumOperands());
+  for (Value operand : op->getOperands()) {
+    AbstractSparseLattice *operandLattice = getLatticeElement(operand);
+    operandLattice->useDefSubscribe(this);
+    operandLattices.push_back(operandLattice);
+  }
+
   if (auto call = dyn_cast<CallOpInterface>(op)) {
+    // If the call operation is to an external function, attempt to infer the
+    // results from the call arguments.
+    auto callable =
+        dyn_cast_if_present<CallableOpInterface>(call.resolveCallable());
+    if (!getSolverConfig().isInterprocedural() ||
+        (callable && !callable.getCallableRegion())) {
+      return visitExternalCallImpl(call, operandLattices, resultLattices);
+    }
----------------
zero9178 wrote:

After bumping MLIR version I am getting TSAN errors here when scheduling the `SCCP` pass on a `func` operation as it accesses state of a sibling operation when calling `getCallableRegion` (checks whether the block is empty).

Should the interprocedural option be set in SCCP if not scheduled on a module or should the framework check that it only accesses operations nested underneath a root operation?

https://github.com/llvm/llvm-project/pull/75583


More information about the Mlir-commits mailing list