[PATCH] D45122: [DebugInfo] Add a new DI flag to record if a C++ record is a trivial type

Aaron Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 12:42:22 PDT 2018


asmith added a comment.

I don't think those DWARF flags help in this case but let's check.
Here are the results of changing the flag as suggested and rerunning
the test from https://reviews.llvm.org/D45123. We can see that several places that are not
marked as Trivial are marked as PassByValue meaning that we cannot
rely on PassByValue to mean Trivial.

$ grep ByValue function-options.ll

// These are not Trivial but they are PassByValue

!19 = distinct !DICompositeType(tag: DW_TAG_class_type, name:
"BClass", file: !9, line: 10, size: 8, flags: DIFlagTypePassByValue,
elements: !20, identifier: ".?AVBClass@@")
!43 = distinct !DICompositeType(tag: DW_TAG_class_type, name:
"C2Class", file: !9, line: 25, size: 8, flags: DIFlagTypePassByValue,
elements: !44, identifier: ".?AVC2Class@@")
!55 = distinct !DICompositeType(tag: DW_TAG_class_type, name:
"DClass", file: !9, line: 32, size: 8, flags: DIFlagTypePassByValue,
elements: !56, identifier: ".?AVDClass@@")
!107 = distinct !DICompositeType(tag: DW_TAG_structure_type, name:
"BStruct", file: !9, line: 63, size: 8, flags: DIFlagTypePassByValue,
elements: !108, identifier: ".?AUBStruct@@")

If you look at the corresponding change to clang in https://reviews.llvm.org/D45124 you will
see that Trivial and PassByValue/Reference are a bit different.

  if (auto CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
    if (CGM.getCXXABI().getRecordArgABI(CXXRD) == CGCXXABI::RAA_Indirect)
      Flags |= llvm::DINode::FlagTypePassByReference;
    else
      Flags |= llvm::DINode::FlagTypePassByValue;
  
    // When emitting codeview, record if a C++ record is trivial type.
    if (CGM.getCodeGenOpts().EmitCodeView) {
      if (CXXRD->isTrivial())
        Flags |= llvm::DINode::FlagTrivial;
    }
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D45122





More information about the llvm-commits mailing list