Don't suppress the emission of available_externally functions marked
with always_inline attribute. Thanks to Howard for the tip. llvm-svn: 108469
This commit is contained in:
parent
b3026df9fa
commit
8997690ff1
|
@ -816,7 +816,8 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
|
|||
if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
|
||||
// At -O0, don't generate IR for functions with available_externally
|
||||
// linkage.
|
||||
if (CodeGenOpts.OptimizationLevel == 0 &&
|
||||
if (CodeGenOpts.OptimizationLevel == 0 &&
|
||||
!Function->hasAttr<AlwaysInlineAttr>() &&
|
||||
getFunctionLinkage(Function)
|
||||
== llvm::Function::AvailableExternallyLinkage)
|
||||
return;
|
||||
|
|
|
@ -10,3 +10,17 @@ inline void f0(int y) { x = y; }
|
|||
void test() {
|
||||
f0(17);
|
||||
}
|
||||
|
||||
inline int __attribute__((always_inline)) f1(int x) {
|
||||
int blarg = 0;
|
||||
for (int i = 0; i < x; ++i)
|
||||
blarg = blarg + x * i;
|
||||
return blarg;
|
||||
}
|
||||
|
||||
int test1(int x) {
|
||||
// CHECK: br i1
|
||||
// CHECK-NOT: call
|
||||
// CHECK: ret i32
|
||||
return f1(x);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue