[Mlir-commits] [mlir] [MLIR][RemoveDeadValues] Privatize public function with NonLive arguments before RDV. (PR #162038)
Mehdi Amini
llvmlistbot at llvm.org
Tue Oct 28 09:13:04 PDT 2025
================
@@ -869,10 +870,151 @@ struct RemoveDeadValues : public impl::RemoveDeadValuesBase<RemoveDeadValues> {
};
} // namespace
+/// If the target of CallOp is a public function and at least one argument is
+/// NonLive, privatize the function. Our strategy here is separation interface
+/// and implementation. eg.
+///
+/// public void foo(int unused){...}
+/// =>
+/// public void foo(int unused) { // old function, interface
+/// return __foo_privatized(unused);
+/// }
+///
+/// private void __foo_privatized(int unused) { // the new private function, or
+/// implementation.
+/// ... // the function body of the
+/// original function.
+/// }
+///
+/// Returns true if any IR changes were made, false otherwise.
+static bool processCallOp(CallOpInterface callOp, ModuleOp moduleOp,
+ RunLivenessAnalysis &la) {
+ Operation *callableOp = callOp.resolveCallable();
----------------
joker-eph wrote:
Yes I meant create a symbol table once for the duration of the pass and reuse it here to accelerate the queries.
https://github.com/llvm/llvm-project/pull/162038
More information about the Mlir-commits
mailing list