File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -901,18 +901,15 @@ bool
901
901
CodeGenModule::shouldEmitFunction (const FunctionDecl *F) {
902
902
if (getFunctionLinkage (F) != llvm::Function::AvailableExternallyLinkage)
903
903
return true ;
904
- if (F->hasAttr <AlwaysInlineAttr>())
905
- return true ;
906
- if (CodeGenOpts.OptimizationLevel == 0 )
904
+ if (CodeGenOpts.OptimizationLevel == 0 &&
905
+ !F->hasAttr <AlwaysInlineAttr>())
907
906
return false ;
908
907
// PR9614. Avoid cases where the source code is lying to us. An available
909
908
// externally function should have an equivalent function somewhere else,
910
909
// but a function that calls itself is clearly not equivalent to the real
911
910
// implementation.
912
911
// This happens in glibc's btowc and in some configure checks.
913
- if (isTriviallyRecursiveViaAsm (F))
914
- return false ;
915
- return true ;
912
+ return !isTriviallyRecursiveViaAsm (F);
916
913
}
917
914
918
915
void CodeGenModule::EmitGlobalDefinition (GlobalDecl GD) {
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
2
2
3
- extern int foo_alias (void ) __asm ("foo" );
4
- inline int foo (void ) {
3
+ extern void foo_alias (void ) __asm ("foo" );
4
+ inline void foo (void ) {
5
5
return foo_alias ();
6
6
}
7
- int f (void ) {
8
- return foo ();
7
+ extern void bar_alias (void ) __asm ("bar" );
8
+ inline __attribute__ ((__always_inline__ )) void bar (void ) {
9
+ return bar_alias ();
9
10
}
11
+ void f (void ) {
12
+ foo ();
13
+ bar ();
14
+ }
15
+
16
+ // CHECK: define void @f()
17
+ // CHECK-NEXT: entry:
18
+ // CHECK-NEXT: call void @foo()
19
+ // CHECK-NEXT: call void @bar()
20
+ // CHECK-NEXT: ret void
10
21
11
- // CHECK-NOT: define
12
- // CHECK: define i32 @f()
13
- // CHECK: call i32 @foo()
14
- // CHECK-NEXT: ret i32
15
- // CHECK-NOT: define
22
+ // CHECK: declare void @foo()
23
+ // CHECK: declare void @bar()
You can’t perform that action at this time.
0 commit comments