[PATCH] D12087: always_inline codegen rewrite

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 15:37:27 PDT 2015


eugenis added inline comments.

================
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!");
----------------
rnk wrote:
> 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)`
This is a very good idea. It's not exactly as easy as that, but it works, see the new code.

================
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('
 
----------------
rnk wrote:
> FileCheck?
Actually, this chunk is not needed with your proposed change.
Reverted.


Repository:
  rL LLVM

http://reviews.llvm.org/D12087





More information about the cfe-commits mailing list