<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[flang][debug] Make common blocks data extraction more robust. (#168752)</title>
<updated>2025-11-20T14:28:56+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-11-20T14:28:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0e8222b84b60c022b2cee308f79a185a943ff514'/>
<id>0e8222b84b60c022b2cee308f79a185a943ff514</id>
<content type='text'>
Our current implementation for extracting information about common block
required traversal of FIR which was not ideal but previously there was
no other way to obtain that information. The `[hl]fir.declare` was
extended in commit https://github.com/llvm/llvm-project/pull/155325 to
include storage and storage_offset. This commit adds these operands in
`fircg.ext_declare` and then use them in `AddDebugInfoPass` to create
debug data for common blocks.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our current implementation for extracting information about common block
required traversal of FIR which was not ideal but previously there was
no other way to obtain that information. The `[hl]fir.declare` was
extended in commit https://github.com/llvm/llvm-project/pull/155325 to
include storage and storage_offset. This commit adds these operands in
`fircg.ext_declare` and then use them in `AddDebugInfoPass` to create
debug data for common blocks.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][debug] handle inlined dummy_scope after #167489 (#168039)</title>
<updated>2025-11-14T11:57:05+00:00</updated>
<author>
<name>jeanPerier</name>
<email>jperier@nvidia.com</email>
</author>
<published>2025-11-14T11:57:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=778b85ae0369d70fdfa6b38f13ea9345d2022d09'/>
<id>778b85ae0369d70fdfa6b38f13ea9345d2022d09</id>
<content type='text'>
#167489 did not work properly when MLIR inlining is enabled
(experimental in flang, enabled with `-mllvm -inline-all`).

The reason is that inlining will cause several `fir.dummy_scope` to
coexist inside a same `func.func` (`fir.dummy_scope` of inlined
`func.func` are preserved in order to preserve the relationship between
arguments of the inlined call for better aliasing deductions).

After #167489, the debug info pass creates argument debug info for all
fir.declare with a fir.dummy_scope. This causes arguments from inlined
calls to appear as argument of the procedure where the call was inlined.

To avoid this, only consider that fir.declare are arguments of the
current function if their fir.dummy_scope is the first one created in
the function (fir.dummy_scope cannot be reorder because they have write
effects to the debug memory ressource, and the fir.dummy_scope of the
current functions is always emitted before any calls are lowered, so
before any fir.dummy_scope are inlined).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
#167489 did not work properly when MLIR inlining is enabled
(experimental in flang, enabled with `-mllvm -inline-all`).

The reason is that inlining will cause several `fir.dummy_scope` to
coexist inside a same `func.func` (`fir.dummy_scope` of inlined
`func.func` are preserved in order to preserve the relationship between
arguments of the inlined call for better aliasing deductions).

After #167489, the debug info pass creates argument debug info for all
fir.declare with a fir.dummy_scope. This causes arguments from inlined
calls to appear as argument of the procedure where the call was inlined.

To avoid this, only consider that fir.declare are arguments of the
current function if their fir.dummy_scope is the first one created in
the function (fir.dummy_scope cannot be reorder because they have write
effects to the debug memory ressource, and the fir.dummy_scope of the
current functions is always emitted before any calls are lowered, so
before any fir.dummy_scope are inlined).</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][debug] Track dummy argument positions explicitly. (#167489)</title>
<updated>2025-11-12T10:21:32+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-11-12T10:21:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cfc56c982fe144455db25f20576c9297fc68a8f9'/>
<id>cfc56c982fe144455db25f20576c9297fc68a8f9</id>
<content type='text'>
CHARACTER dummy arguments were treated as local variables in debug info.
This happened because our method to get the argument number was not
robust. It relied on `DeclareOp` having a direct reference to arguments
which was not the case for character arguments. This is fixed by storing
source-level argument positions in `DeclareOp`.

Fixes #112886</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
CHARACTER dummy arguments were treated as local variables in debug info.
This happened because our method to get the argument number was not
robust. It relied on `DeclareOp` having a direct reference to arguments
which was not the case for character arguments. This is fixed by storing
source-level argument positions in `DeclareOp`.

Fixes #112886</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][debug] Avoid redundant module info. (#161542)</title>
<updated>2025-10-03T09:08:35+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-10-03T09:08:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6c40c76c21266e1f6c20111317041cfbf7e9b4e7'/>
<id>6c40c76c21266e1f6c20111317041cfbf7e9b4e7</id>
<content type='text'>
Fixes https://github.com/llvm/llvm-project/issues/160907.

When a module is just being used and not defined, we generate it with
decl=true. But if the file/line fields are valid, the module is not
merged with the original and is considered different. This patch avoids
setting file/line/scope in such cases.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes https://github.com/llvm/llvm-project/issues/160907.

When a module is just being used and not defined, we generate it with
decl=true. But if the file/line fields are valid, the module is not
merged with the original and is considered different. This patch avoids
setting file/line/scope in such cases.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][debug] Generate splitDebugFilename field in DICompileUnitAttr. (#161214)</title>
<updated>2025-09-30T13:35:33+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-09-30T13:35:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c2188168cab442192121b34052a4edbf4b439f60'/>
<id>c2188168cab442192121b34052a4edbf4b439f60</id>
<content type='text'>
This PR builds on https://github.com/llvm/llvm-project/pull/160540 and
allows us to set the `splitDebugFilename` field in `DICompileUnitAttr`.
The changes are mostly mechanical.

I saw some spurious white space in a test that I have cleaned up.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR builds on https://github.com/llvm/llvm-project/pull/160540 and
allows us to set the `splitDebugFilename` field in `DICompileUnitAttr`.
The changes are mostly mechanical.

I saw some spurious white space in a test that I have cleaned up.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Add splitDebugFilename field in DIComplileUnitAttr. (#160704)</title>
<updated>2025-09-26T10:58:39+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-09-26T10:58:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e38e0bde41e084a05de6972a5a9fff81435c7f77'/>
<id>e38e0bde41e084a05de6972a5a9fff81435c7f77</id>
<content type='text'>
Mostly mechanical changes to add the missing field.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mostly mechanical changes to add the missing field.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang] Lowering support for -gdwarf-N flag. (#159137)</title>
<updated>2025-09-17T17:16:36+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-09-17T17:16:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=453e4102bd32b892e7fda2aea3f3ef9e9b038580'/>
<id>453e4102bd32b892e7fda2aea3f3ef9e9b038580</id>
<content type='text'>
This PR builds on the https://github.com/llvm/llvm-project/pull/158314
and adds the lowering support for `-gdwarf-N` flag. The changes to pass
the information to `AddDebugInfo` pass are mostly mechanical. The
`AddDebugInfo` pass adds `ModuleFlagsOp` in the module which gets
translated to correct llvm metadata during mlir-&gt;llvmir translation.

There is minor correction where the version is set to 0 in case no
-debug-version flag is provided. Previously it was set to 2 in this case
due to misreading of clang code.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR builds on the https://github.com/llvm/llvm-project/pull/158314
and adds the lowering support for `-gdwarf-N` flag. The changes to pass
the information to `AddDebugInfo` pass are mostly mechanical. The
`AddDebugInfo` pass adds `ModuleFlagsOp` in the module which gets
translated to correct llvm metadata during mlir-&gt;llvmir translation.

There is minor correction where the version is set to 0 in case no
-debug-version flag is provided. Previously it was set to 2 in this case
due to misreading of clang code.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][debug] Generate DISubprogramAttr for omp::TargetOp. (#146532)</title>
<updated>2025-07-03T09:38:28+00:00</updated>
<author>
<name>Abid Qadeer</name>
<email>haqadeer@amd.com</email>
</author>
<published>2025-07-03T09:38:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d56c06e6c9f0cf03d75fd755c099a6844ecf38e6'/>
<id>d56c06e6c9f0cf03d75fd755c099a6844ecf38e6</id>
<content type='text'>
This is combination of https://github.com/llvm/llvm-project/pull/138149
and https://github.com/llvm/llvm-project/pull/138039 which were opened
separately for ease of reviewing. Only other change is adjustments in 2
tests which have gone in since.

There are `DeclareOp` present for the variables mapped into target
region. That allow us to generate debug information for them. But the
`TargetOp` is still part of parent function and those variables get the
parent function's `DISubprogram` as a scope.
    
In `OMPIRBuilder`, a new function is created for the `TargetOp`. We also
create a new `DISubprogram` for it. All the variables that were in the
target region now have to be updated to have the correct scope. This
after the fact updating of
debug information becomes very difficult in certain cases. Take the
example of variable arrays. The type of those arrays depend on the
artificial `DILocalVariable`(s) which hold the size(s) of the array.
This new function will now require that we generate the new variable and
and new types. Similar issue exist for character type variables too.
    
To avoid this after the fact updating, this PR generates a
`DISubprogramAttr` for the `TargetOp` while generating the debug info in
`flang`. Then we don't need to generate a `DISubprogram` in
`OMPIRBuilder`. This change is made a bit more complicated by the the
fact that in new scheme, the debug location already points to the new
`DISubprogram` by the time it reaches `convertOmpTarget`. But we need
some code generation in the parent function so we have to carefully
manage the debug locations.
    
This fixes issue `#134991`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is combination of https://github.com/llvm/llvm-project/pull/138149
and https://github.com/llvm/llvm-project/pull/138039 which were opened
separately for ease of reviewing. Only other change is adjustments in 2
tests which have gone in since.

There are `DeclareOp` present for the variables mapped into target
region. That allow us to generate debug information for them. But the
`TargetOp` is still part of parent function and those variables get the
parent function's `DISubprogram` as a scope.
    
In `OMPIRBuilder`, a new function is created for the `TargetOp`. We also
create a new `DISubprogram` for it. All the variables that were in the
target region now have to be updated to have the correct scope. This
after the fact updating of
debug information becomes very difficult in certain cases. Take the
example of variable arrays. The type of those arrays depend on the
artificial `DILocalVariable`(s) which hold the size(s) of the array.
This new function will now require that we generate the new variable and
and new types. Similar issue exist for character type variables too.
    
To avoid this after the fact updating, this PR generates a
`DISubprogramAttr` for the `TargetOp` while generating the debug info in
`flang`. Then we don't need to generate a `DISubprogram` in
`OMPIRBuilder`. This change is made a bit more complicated by the the
fact that in new scheme, the debug location already points to the new
`DISubprogram` by the time it reaches `convertOmpTarget`. But we need
some code generation in the parent function so we have to carefully
manage the debug locations.
    
This fixes issue `#134991`.</pre>
</div>
</content>
</entry>
<entry>
<title>[Flang] Add missing dependency to AddDebugInfo pass (#139099)</title>
<updated>2025-05-09T11:19:53+00:00</updated>
<author>
<name>Sergio Afonso</name>
<email>safonsof@amd.com</email>
</author>
<published>2025-05-09T11:19:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4923cffc1d3333cf679dd304dd6a8e7232d77d54'/>
<id>4923cffc1d3333cf679dd304dd6a8e7232d77d54</id>
<content type='text'>
The `AddDebugInfo` pass currently has a dependency on the `DLTI` MLIR
dialect caused by a call to the `fir::support::getOrSetMLIRDataLayout()`
utility function.

This dependency is not captured in the pass definition. This patch adds
the dependency and simplifies several unit tests that had to explicitly
use the `DLTI` dialect to prevent the missing dependency from causing
compiler failures.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `AddDebugInfo` pass currently has a dependency on the `DLTI` MLIR
dialect caused by a call to the `fir::support::getOrSetMLIRDataLayout()`
utility function.

This dependency is not captured in the pass definition. This patch adds
the dependency and simplifies several unit tests that had to explicitly
use the `DLTI` dialect to prevent the missing dependency from causing
compiler failures.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][NFC] Split CG dialect and the passes. (#135240)</title>
<updated>2025-04-10T23:13:04+00:00</updated>
<author>
<name>Slava Zakharin</name>
<email>szakharin@nvidia.com</email>
</author>
<published>2025-04-10T23:13:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=27bc8a1811d417c2d38646a3473226431987e7d9'/>
<id>27bc8a1811d417c2d38646a3473226431987e7d9</id>
<content type='text'>
I am making a CG pass to depend on `FIROpenACCSupport` in #134346.
This introduces a cyclic dependency between `FIROpenACCSupport`
and `FIRCodeGen`. This patch splits `FIRCodeGen` into
`FIRCodeGenDialect` (for FIR CG dialect definition) and `FIRCodeGen`
(for the CG passes).

Now, `FIROpenACCSupport` depends on `FIRCodeGenDialect`,
and `FIRCodeGen` depends on `FIROpenACCSupport`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I am making a CG pass to depend on `FIROpenACCSupport` in #134346.
This introduces a cyclic dependency between `FIROpenACCSupport`
and `FIRCodeGen`. This patch splits `FIRCodeGen` into
`FIRCodeGenDialect` (for FIR CG dialect definition) and `FIRCodeGen`
(for the CG passes).

Now, `FIROpenACCSupport` depends on `FIRCodeGenDialect`,
and `FIRCodeGen` depends on `FIROpenACCSupport`.</pre>
</div>
</content>
</entry>
</feed>
