Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore -enable-cross-module-inlining if inlining is generally disabled #3664

Merged
merged 1 commit into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gen/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ bool willInline() {
}

bool willCrossModuleInline() {
return enableCrossModuleInlining == llvm::cl::BOU_TRUE;
return enableCrossModuleInlining == llvm::cl::BOU_TRUE && willInline();
}

#if LDC_LLVM_VER >= 800 && LDC_LLVM_VER < 1000
Expand Down
17 changes: 7 additions & 10 deletions tests/codegen/inlining_disablecross.d
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
// Test disabling/enabling of cross-module inlining
// Test disabling of cross-module inlining

// RUN: %ldc %s -I%S -c -output-ll -enable-cross-module-inlining -O0 -of=%t.ENA.ll && FileCheck %s --check-prefix ENABLED < %t.ENA.ll
// RUN: %ldc %s -I%S -c -output-ll -disable-cross-module-inlining -O3 -of=%t.DIS.ll && FileCheck %s --check-prefix DISABLED < %t.DIS.ll
// RUN: %ldc %s -I%S -c -output-ll -enable-cross-module-inlining -O0 -of=%t.ENA.ll && FileCheck %s < %t.ENA.ll
// RUN: %ldc %s -I%S -c -output-ll -disable-cross-module-inlining -O3 -of=%t.DIS.ll && FileCheck %s < %t.DIS.ll

import inputs.inlinables;

extern (C): // simplify mangling for easier matching

// DISABLED-LABEL: define{{.*}} @call_easily_inlinable(
// ENABLED-LABEL: define{{.*}} @call_easily_inlinable(
// CHECK-LABEL: define{{.*}} @call_easily_inlinable(
int call_easily_inlinable(int i)
{
// DISABLED: call {{.*}} @easily_inlinable(
// CHECK: call {{.*}} @easily_inlinable(
return easily_inlinable(i);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call was previously there for -enable-cross-module-inlining -O0 too.

// DISABLED: ret
// ENABLED: ret
// CHECK: ret
}

// ENABLED-DAG: define {{.*}} @easily_inlinable(
// DISABLED-DAG: declare {{.*}} @easily_inlinable(
// CHECK-DAG: declare {{.*}} @easily_inlinable(