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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 11 09:30:57 PDT 2018


rnk added a comment.

In https://reviews.llvm.org/D45122#1063889, @asmith wrote:

> Only considering DIFlagPassByReference for CxxReturnUdt will not cover all
>  cases. There are times when DIFlagPassByValue is also CxxReturnUdt.


Can you describe them? Sorry, I can't investigate myself right now because my Windows workstation died over the weekend.

I'm guessing the issue is in this code:

  if (auto CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
    if (CGM.getCXXABI().getRecordArgABI(CXXRD) == CGCXXABI::RAA_Indirect)
      Flags |= llvm::DINode::FlagTypePassByReference;
    else
      Flags |= llvm::DINode::FlagTypePassByValue;
  }

getRecordArgABI returns three possible results, and this code only effectively handles two. I think it would be correct to:

1. Rename FlagTypePassByReference to FlagPassNonTrivial (or something like that but less terrible)
2. Set the flag when the RAA is either indirect or RAA_DirectInMemory.

Truly, the minimal change is to invert the logic of the `if` to check for `RAA_Default` and set FlagTypePassByReference in all other cases. That's how LLVM sees inalloca anyway. =p


Repository:
  rL LLVM

https://reviews.llvm.org/D45122





More information about the llvm-commits mailing list