[flang-commits] [flang] [flang] Use outermost fir.dummy_scope for TBAA of local allocations. (PR #146006)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Fri Jun 27 08:05:00 PDT 2025
================
@@ -119,9 +124,8 @@ void PassState::processFunctionScopes(mlir::func::FuncOp func) {
}
}
-// For the given fir.declare returns the dominating fir.dummy_scope
-// operation.
-fir::DummyScopeOp PassState::getDeclarationScope(fir::DeclareOp declareOp) {
+fir::DummyScopeOp
+PassState::getDeclarationScope(fir::DeclareOp declareOp) const {
----------------
vzakhari wrote:
> moving the fir.declare of the result before the call
Right, I got the same idea while writing the commit message :) this will definitely resolve the issue in the test, but I do not want to introduce such a requirement on the placement of `fir.declare`. So using the outer scope seems to be a more sustainable solution.
I think using `getOutermostScope` for dummy arguments would be incorrect. E.g. if we create TBAA tags for the dummies of the callee in the same tree as the caller's dummy TBAA tags, that will tell that all the dummies do not conflict. This would be incorrect in many cases.
https://github.com/llvm/llvm-project/pull/146006
More information about the flang-commits
mailing list