[PATCH] When generating llvm.used, we may need an addrspacecast instead of a bitcast.

Jingyue Wu jingyue at google.com
Mon Feb 2 09:55:21 PST 2015


Only two minor comments. Thanks!


================
Comment at: lib/CodeGen/CodeGenModule.cpp:939
@@ +938,3 @@
+      llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
+                                                cast<llvm::Constant>(&*List[i]),
+                                                CGM.Int8PtrTy);
----------------
The indentation can be improved :)

================
Comment at: test/CodeGenCUDA/llvm-used.cu:8
@@ +7,2 @@
+// CHECK: @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(1)* bitcast ([0 x i32] addrspace(1)* @a to i8 addrspace(1)*) to i8*)], section "llvm.metadata"
+__attribute__((device)) __attribute__((__used__)) int a[] = {};
----------------
Is __attribute__((__used__)) necessary for this test?

http://reviews.llvm.org/D7345

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list