[llvm-commits] [llvm] r155954 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/GC/cg-O0.ll

Bill Wendling isanbard at gmail.com
Tue May 1 15:50:46 PDT 2012


Author: void
Date: Tue May  1 17:50:45 2012
New Revision: 155954

URL: http://llvm.org/viewvc/llvm-project?rev=155954&view=rev
Log:
Strip the pointer casts off of allocas so that the selection DAG can find them.
PR10799

Added:
    llvm/trunk/test/CodeGen/X86/GC/cg-O0.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=155954&r1=155953&r2=155954&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue May  1 17:50:45 2012
@@ -5050,7 +5050,7 @@
   }
   case Intrinsic::gcroot:
     if (GFI) {
-      const Value *Alloca = I.getArgOperand(0);
+      const Value *Alloca = I.getArgOperand(0)->stripPointerCasts();
       const Constant *TypeMap = cast<Constant>(I.getArgOperand(1));
 
       FrameIndexSDNode *FI = cast<FrameIndexSDNode>(getValue(Alloca).getNode());

Added: llvm/trunk/test/CodeGen/X86/GC/cg-O0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/GC/cg-O0.ll?rev=155954&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/GC/cg-O0.ll (added)
+++ llvm/trunk/test/CodeGen/X86/GC/cg-O0.ll Tue May  1 17:50:45 2012
@@ -0,0 +1,17 @@
+; RUN: llc < %s -O0
+
+define i32 @main() {
+entry:
+  call void @f()
+  ret i32 0
+}
+
+define void @f() gc "ocaml" {
+entry:
+  %ptr.stackref = alloca i8*
+  %gcroot = bitcast i8** %ptr.stackref to i8**
+  call void @llvm.gcroot(i8** %gcroot, i8* null)
+  ret void
+}
+
+declare void @llvm.gcroot(i8**, i8*) nounwind





More information about the llvm-commits mailing list