Change llvm.gcroot to not init the root to null at runtime, this prevents
authorChris Lattner <sabre@nondot.org>
Wed, 12 Sep 2007 17:53:10 +0000 (17:53 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Sep 2007 17:53:10 +0000 (17:53 +0000)
using it for live-in values etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41879 91177308-0d34-0410-b5e6-96231b3b80d8

docs/GarbageCollection.html
lib/Transforms/Scalar/LowerGC.cpp

index 0accd0c78a09796cb876e7eea47086c36e42a8b7..e39e85ce3cd22b09ae33641e74f9cee6a2531e23 100644 (file)
@@ -166,9 +166,7 @@ interface that front-end authors should generate code for.
 The <tt>llvm.gcroot</tt> intrinsic is used to inform LLVM of a pointer variable
 on the stack.  The first argument contains the address of the variable on the
 stack, and the second contains a pointer to metadata that should be associated
-with the pointer (which <b>must</b> be a constant or global value address).  At
-runtime, the <tt>llvm.gcroot</tt> intrinsic stores a null pointer into the
-specified location to initialize the pointer.</p>
+with the pointer (which <b>must</b> be a constant or global value address).</p>
 
 <p>
 Consider the following fragment of Java code:
@@ -193,6 +191,9 @@ Entry:
    %X = alloca %Object*
    ...
 
+   ;; Java null-initializes pointers.
+   store %Object* null, %Object** %X
+
    ;; "CodeBlock" is the block corresponding to the start
    ;;  of the scope above.
 CodeBlock:
index 98070995afc1a676ea718969a6cc7e5a5b74afe1..bac7ac799bdc849eb9bfa1a03e7b2785afc41052 100644 (file)
@@ -284,10 +284,7 @@ bool LowerGC::runOnFunction(Function &F) {
     new StoreInst(Null, RootPtrPtr, IP);
 
     // Each occurrance of the llvm.gcroot intrinsic now turns into an
-    // initialization of the slot with the address and a zeroing out of the
-    // address specified.
-    new StoreInst(Constant::getNullValue(PtrLocTy->getElementType()),
-                  GCRoots[i]->getOperand(1), GCRoots[i]);
+    // initialization of the slot with the address.
     new StoreInst(GCRoots[i]->getOperand(1), RootPtrPtr, GCRoots[i]);
   }