[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 14:45:45 PDT 2024


================
@@ -2799,9 +2799,30 @@ CodeGenFunction::EmitLoadOfReference(LValue RefLVal,
   llvm::LoadInst *Load =
       Builder.CreateLoad(RefLVal.getAddress(), RefLVal.isVolatile());
   CGM.DecorateInstructionWithTBAA(Load, RefLVal.getTBAAInfo());
-  return makeNaturalAddressForPointer(Load, RefLVal.getType()->getPointeeType(),
-                                      CharUnits(), /*ForPointeeType=*/true,
-                                      PointeeBaseInfo, PointeeTBAAInfo);
+  QualType PTy = RefLVal.getType()->getPointeeType();
+  if (!PTy->isIncompleteType() && PTy->isConstantSizeType()) {
----------------
efriedma-quic wrote:

What's the point of the isConstantSizeType() check?

https://github.com/llvm/llvm-project/pull/98746


More information about the cfe-commits mailing list