[all-commits] [llvm/llvm-project] 47c1ab: [flang][debug] Fix array lower bounds in derived t...

Abid Qadeer via All-commits all-commits at lists.llvm.org
Thu Oct 24 05:22:50 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47c1abf4afd9120921001ef4bc04492cf949dce7
      https://github.com/llvm/llvm-project/commit/47c1abf4afd9120921001ef4bc04492cf949dce7
  Author: Abid Qadeer <haqadeer at amd.com>
  Date:   2024-10-24 (Thu, 24 Oct 2024)

  Changed paths:
    M flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
    A flang/test/Transforms/debug-derived-type-2.fir

  Log Message:
  -----------
  [flang][debug] Fix array lower bounds in derived type members. (#113183)

The lower bound information for the array members of a derived type
can't be obtained from the `DeclareOp`. It has to be extracted from the
`TypeInfoOp`. That was left as FIXME in the code. This PR adds the
missing functionality to fix the issue.

I tried the following approaches before settling on the current one that
is to generate `DITypeAttr` for array members right where the components
are being processed.

1. Generate a temp XDeclareOp with the shift information obtained from
the `TypeInfoOp`. This caused a few issues mostly related to
`unrealized_conversion_cast`.

2. Change the shift operands in the `declOp` that was passed in the
function before calling `convertType`. The code can be seen in the
abcf031a8e5a02f0081e7f293858302e7bf47bec. It essentially looked like the
following. It works correctly but I was not sure if temporarily changing
the `declOp` is the safe thing to do.

```
mlir::OperandRange originalShift = declOp.getShift();
mlir::MutableOperandRange mutableOpRange = declOp.getShiftMutable();
mutableOpRange.assign(shiftOpers);
elemTy = convertType(fieldTy, fileAttr, scope, declOp);
mutableOpRange.assign(originalShift);
```

Fixes #113178.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list