[llvm] [IR][CodeGen] Specify llvm.gcroot contents are an opaque zero-initialized blob (PR #222333)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 21:54:50 PDT 2026


================
@@ -326,9 +327,8 @@ bool ShadowStackGCLoweringImpl::runOnFunction(Function &F,
   // Compute frame layout using byte offsets first.
   auto [FrameSize, FrameAlign] = ComputeFrameLayout(F);
 
-  // Build the constant map with frame size in pointer-sized units.
-  uint64_t PtrSize = DL.getPointerSize();
-  Value *FrameMap = GetFrameMap(F, FrameSize / PtrSize - 2);
+  // Build the constant map describing the roots in this frame.
----------------
isuckatcs wrote:

This comments is a bit vague I guess.

This is how the map looks like currently. It describes more than just roots.
```c
  /// The map for a single function's stack frame.  One of these is
  ///        compiled as constant data into the executable for each function.
  ///
  /// Storage of metadata values is elided if the %metadata parameter to
  /// @llvm.gcroot is null.
  struct FrameMap {
    int32_t NumRoots;    //< Number of roots in stack frame.
    int32_t NumMeta;     //< Number of metadata entries.  May be < NumRoots.
    const void *Meta[0]; //< Metadata for each root.
  };
```

https://llvm.org/docs/GarbageCollection.html#the-shadow-stack-gc

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


More information about the llvm-commits mailing list