[Mlir-commits] [mlir] [mlir][Transforms] --remove-dead-values: keep values used in public function calls (PR #83249)

Markus Böck llvmlistbot at llvm.org
Wed Feb 28 11:07:24 PST 2024


================
@@ -178,6 +181,17 @@ static void cleanSimpleOp(Operation *op, RunLivenessAnalysis &la) {
   if (!isMemoryEffectFree(op) || hasLive(op->getResults(), la))
     return;
 
+  for (auto &use : op->getUses()) {
+    if (auto callOp = dyn_cast<CallOpInterface>(use.getOwner())) {
+      if (auto funcOp =
+              dyn_cast<FunctionOpInterface>(callOp.resolveCallable())) {
+        if (funcOp.isPublic()) {
+          return;
+        }
+      }
+    }
+  }
----------------
zero9178 wrote:

LLVM style is to remove braces if there is only a trivial single statement. So I'd remove all these braces here

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


More information about the Mlir-commits mailing list