[flang-commits] [flang] [flang][debug] Allow variable from non-entry blocks. (PR #125692)

via flang-commits flang-commits at lists.llvm.org
Tue Feb 4 06:35:51 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: Abid Qadeer (abidh)

<details>
<summary>Changes</summary>

We currently drop the `DeclareOp` which are not in the entry block of the function. This was done to side step a problem with the variables in OpenMP target region. I have opened #<!-- -->118314 to address the original issue. Once that PR is merged, we can lift this restriction as well.

So this will have to wait till #<!-- -->118314 is approved and merged.

---
Full diff: https://github.com/llvm/llvm-project/pull/125692.diff


1 Files Affected:

- (modified) flang/lib/Optimizer/Transforms/AddDebugInfo.cpp (+1-5) 


``````````diff
diff --git a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
index 16404fcda57b482..ee4d14dc6ebe0cd 100644
--- a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
+++ b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
@@ -503,11 +503,7 @@ void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp,
   funcOp->setLoc(builder.getFusedLoc({l}, spAttr));
 
   funcOp.walk([&](fir::cg::XDeclareOp declOp) {
-    // FIXME: We currently dont handle variables that are not in the entry
-    // blocks of the fuctions. These may be variable or arguments used in the
-    // OpenMP target regions.
-    if (&funcOp.front() == declOp->getBlock())
-      handleDeclareOp(declOp, fileAttr, spAttr, typeGen, symbolTable);
+    handleDeclareOp(declOp, fileAttr, spAttr, typeGen, symbolTable);
   });
   // commonBlockMap ensures that we don't create multiple DICommonBlockAttr of
   // the same name in one function. But it is ok (rather required) to create

``````````

</details>


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


More information about the flang-commits mailing list