[Mlir-commits] [mlir] Allow SymbolUserOpInterface operators to be used in RemoveDeadValues Pass (PR #117405)
Renat Idrisov
llvmlistbot at llvm.org
Fri Nov 22 19:50:06 PST 2024
================
@@ -577,10 +577,8 @@ void RemoveDeadValues::runOnOperation() {
WalkResult acceptableIR = module->walk([&](Operation *op) {
if (op == module)
return WalkResult::advance();
- if (isa<BranchOpInterface>(op) ||
- (isa<SymbolUserOpInterface>(op) && !isa<CallOpInterface>(op))) {
- op->emitError() << "cannot optimize an IR with "
- "non-call symbol user ops or branch ops\n";
+ if (isa<BranchOpInterface>(op)) {
----------------
parsifal-47 wrote:
I just checked the details, it uses LivenessAnalysis:
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Analysis/DataFlow/LivenessAnalysis.cpp#L51
and it is not designed to miss live values. The definition explicitly accounts for Control Flow in Branches: It considers non-forwarded branch operands and whether they lead to blocks with memory effects (1.b).
Transitive Dependencies: It ensures that all values contributing to the computation of live values (those with memory effects or returned by public functions) are also marked as live (3.a, 3.b).
Therefore, I recommend to drop this condition as well and add or modify the test.
https://github.com/llvm/llvm-project/pull/117405
More information about the Mlir-commits
mailing list