Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] Fixed -g compilation issues caused by #90484. #90683

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

vzakhari
Copy link
Contributor

No description provided.

@vzakhari vzakhari requested review from abidh and klausler April 30, 2024 23:07
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Apr 30, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 30, 2024

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

Author: Slava Zakharin (vzakhari)

Changes

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

1 Files Affected:

  • (modified) flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp (+5-1)
diff --git a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
index 227dc978897de7..e5b4050dfb2426 100644
--- a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
+++ b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
@@ -45,9 +45,13 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
   if (Ty.isInteger()) {
     return genBasicType(context, mlir::StringAttr::get(context, "integer"),
                         Ty.getIntOrFloatBitWidth(), llvm::dwarf::DW_ATE_signed);
-  } else if (mlir::isa<mlir::FloatType>(Ty) || mlir::isa<fir::RealType>(Ty)) {
+  } else if (mlir::isa<mlir::FloatType>(Ty)) {
     return genBasicType(context, mlir::StringAttr::get(context, "real"),
                         Ty.getIntOrFloatBitWidth(), llvm::dwarf::DW_ATE_float);
+  } else if (auto realTy = mlir::dyn_cast_or_null<fir::RealType>(Ty)) {
+    return genBasicType(context, mlir::StringAttr::get(context, "real"),
+                        kindMapping.getRealBitsize(realTy.getFKind()),
+                        llvm::dwarf::DW_ATE_float);
   } else if (auto logTy = mlir::dyn_cast_or_null<fir::LogicalType>(Ty)) {
     return genBasicType(context,
                         mlir::StringAttr::get(context, logTy.getMnemonic()),

@vzakhari
Copy link
Contributor Author

I am going to merge this without waiting for pre-commit checks. @abidh please add a LIT tests for this case:

complex*16 expct
abserror = cdabs(expct)
end

@vzakhari vzakhari changed the title [flang] Fixed -g compilations caused by #90484. [flang] Fixed -g compilation issues caused by #90484. Apr 30, 2024
@vzakhari vzakhari merged commit 85f28cf into llvm:main Apr 30, 2024
6 of 7 checks passed
abidh added a commit to abidh/llvm-project that referenced this pull request May 1, 2024
This is an accompanying test for the fix done in llvm#90683.
It checks that fir.real conversion works ok.

The failing fortran source in the llvm#90683 generates fir.real type in
the target-rewrite pass which caused the original issue.
@abidh
Copy link
Contributor

abidh commented May 1, 2024

Thanks for the fix @vzakhari. I have opened #90726 which adds a tests. Please have a look.

abidh added a commit that referenced this pull request May 2, 2024
This is an accompanying test for the fix done in #90683. It checks that
fir.real conversion works ok.

The failing fortran source in the #90683 generates fir.real type in the
target-rewrite pass which caused the original issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants