[Mlir-commits] [mlir] [mlir][func] Fix a crash in DuplicateFunctionEliminationPass (PR #209667)
Longsheng Mou
llvmlistbot at llvm.org
Sun Jul 19 20:37:47 PDT 2026
================
@@ -101,12 +101,12 @@ struct DuplicateFunctionEliminationPass
// Update all symbol uses to reference unique func op
// representants and erase redundant func ops.
- SymbolTableCollection symbolTable;
- SymbolUserMap userMap(symbolTable, module);
for (auto it : toBeErased) {
StringAttr oldSymbol = it.getSymNameAttr();
StringAttr newSymbol = getRepresentant[oldSymbol].getSymNameAttr();
- userMap.replaceAllUsesWith(it, newSymbol);
----------------
CoTinker wrote:
In this case , when the redundant caller1 is replaced first
```
func.func @callee0() {
return
}
func.func @caller0() {
call @callee1() : () -> ()
return
}
func.func @caller1() {
call @callee1() : () -> ()
return
}
func.func @callee1() {
return
}
```
--->
```
func.func @callee0() {
return
}
func.func @caller0() {
call @callee1() : () -> ()
return
}
func.func @callee1() {
return
}
```
And then the callee1 replace callee0, but the symbol table is not updated, when the callee1 try to replace callee0 in caller1 fucntion, it will crash, becase the caller1 op is actully erased.
https://github.com/llvm/llvm-project/pull/209667
More information about the Mlir-commits
mailing list