[PATCH] D12087: always_inline codegen rewrite

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 14:02:39 PDT 2015


rnk added a subscriber: rnk.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:469-470
@@ +468,4 @@
+  llvm::LLVMContext &Ctx = getModule().getContext();
+  llvm::Function *StubFn =
+      llvm::Function::Create(FT, Fn->getLinkage(), Name, &getModule());
+  assert(StubFn->getName() == Name && "name was uniqued!");
----------------
This is a lot of work to do for every always_inline function that got called. Can we do this like:
1. Build SmallVector<Use*> of all non-direct call uses of Fn
2. Return if there are no such uses
3. Build the stub function replacement
4. `for (Use *U : IndirectUses) U->set(StubFn)`

================
Comment at: test/CodeGen/2008-05-19-AlwaysInline.c:1
@@ -1,2 +1,2 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | not grep sabrina
+// RUN: %clang_cc1 %s -emit-llvm -o - | not grep 'call.*sabrina('
 
----------------
FileCheck?

================
Comment at: test/CodeGenCXX/dllimport.cpp:247-250
@@ -246,1 +246,6 @@
 // MSC2-NOT: @"\01?alwaysInline@@YAXXZ"()
+// MSC2:     declare dllimport void @"\01?alwaysInline@@YAXXZ"()
+// MSC2-NOT: @"\01?alwaysInline@@YAXXZ"()
+
+// GNU2-NOT: @_Z12alwaysInlinev()
+// GNU2:     define linkonce_odr void @_Z12alwaysInlinev()
----------------
This change will go away if you only create the decl when its used indirectly.


http://reviews.llvm.org/D12087





More information about the cfe-commits mailing list