[PATCH] D16664: [CUDA] Generate CUDA's printf alloca in its function's entry block.

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 28 11:54:51 PST 2016


echristo added inline comments.

================
Comment at: lib/CodeGen/CGCUDABuiltin.cpp:109
@@ -106,1 +108,3 @@
+    // stacksave/stackrestore intrinsics, which cause our nvvm backend to choke.
+    auto *Alloca = new llvm::AllocaInst(
         llvm::Type::getInt8Ty(Ctx), llvm::ConstantInt::get(Int32Ty, BufSize),
----------------
rnk wrote:
> You can still use CreateTempAlloca by making an `[i8 x N]` LLVM type. You'll have to use CreateStructGEP below for forming GEPs. Overall I think that'd be nicer, since you don't need to worry about insertion at all.
+1 :)

================
Comment at: lib/CodeGen/CGCUDABuiltin.cpp:112
@@ +111,3 @@
+        BufAlign, "printf_arg_buf");
+    Alloca->insertAfter(AllocaInsertPt);
+    BufferPtr = Alloca;
----------------
Also you'd have wanted to insert it before anyhow. 


http://reviews.llvm.org/D16664





More information about the cfe-commits mailing list