[flang] [llvm] [flang] Enhance show_descriptor intrinsic to avoid extra copies and extra descriptor creation (PR #173461)
Razvan Lupusoru via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 24 09:29:19 PST 2025
================
@@ -7893,9 +7893,24 @@ void IntrinsicLibrary::genShowDescriptor(
assert(args.size() == 1 && "expected single argument for show_descriptor");
const mlir::Value descriptor = fir::getBase(args[0]);
- assert(fir::isa_box_type(descriptor.getType()) &&
- "argument must have been lowered to box type");
- fir::runtime::genShowDescriptor(builder, loc, descriptor);
+ // If it's already a reference to a box, pass it directly.
+ if (fir::isa_ref_type(descriptor.getType()) &&
----------------
razvanlupusoru wrote:
Could you also add a test where the descriptor being passed in is the member of a derived type? I am hopeful it falls into the "isa_ref_type" case here not the "isa_box_type" case below. Thank you :)
https://github.com/llvm/llvm-project/pull/173461
More information about the llvm-commits
mailing list