[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


================
@@ -148,11 +149,13 @@ static bool CouldBecomeSafePoint(Instruction *I) {
       isa<LoadInst>(I))
     return false;
 
-  // llvm.gcroot is safe because it doesn't do anything at runtime.
+  // llvm.gcroot is safe because it doesn't do anything at runtime.  A memset
+  // is safe because it cannot collect; it is also how roots are initialized
+  // below, so exempting it keeps this pass idempotent.
   if (CallInst *CI = dyn_cast<CallInst>(I))
     if (Function *F = CI->getCalledFunction())
       if (Intrinsic::ID IID = F->getIntrinsicID())
-        if (IID == Intrinsic::gcroot)
+        if (IID == Intrinsic::gcroot || IID == Intrinsic::memset)
----------------
isuckatcs wrote:

I'm not sure we want to introduce `memset` as a safe point. If it is ever lowered to a `memset()` call, it is no longer safe IIUC. I suggest preserving the current behavior.

IIUC the goal is to treat `llvm.memset` as an initializer as well besides `store`.

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


More information about the llvm-commits mailing list