Skip to content

Avoid triggering a pathological case in the LLVM inliner #28354

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

Merged
merged 1 commit into from
Sep 11, 2015

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Sep 11, 2015

When the inliner has to decided if it wants to inline a function A into an
internal function B, it first checks whether it would be more profitable
to inline B into its callees instead. This means that it has to analyze
B, which involves checking the assumption cache. Building the assumption
cache requires scanning the whole function, and because inlining
currently clears the assumption cache, this scan happens again and
again, getting even slower as the function grows from inlining.

As inlining the huge find functions isn't really useful anyway, we can
mark them as noinline, which skips the cost analysis and reduces compile
times by as much as 70%.

cc #28273

When the inliner has to decided if it wants to inline a function A into an
internal function B, it first checks whether it would be more profitable
to inline B into its callees instead. This means that it has to analyze
B, which involves checking the assumption cache. Building the assumption
cache requires scanning the whole function, and because inlining
currently clears the assumption cache, this scan happens again and
again, getting even slower as the function grows from inlining.

As inlining the huge find functions isn't really useful anyway, we can
mark them as noinline, which skips the cost analysis and reduces compile
times by as much as 70%.

cc rust-lang#28273
@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member

eddyb commented Sep 11, 2015

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 11, 2015

📌 Commit 9104a90 has been approved by eddyb

@bors
Copy link
Collaborator

bors commented Sep 11, 2015

⌛ Testing commit 9104a90 with merge fbeef72...

bors added a commit that referenced this pull request Sep 11, 2015
When the inliner has to decided if it wants to inline a function A into an
internal function B, it first checks whether it would be more profitable
to inline B into its callees instead. This means that it has to analyze
B, which involves checking the assumption cache. Building the assumption
cache requires scanning the whole function, and because inlining
currently clears the assumption cache, this scan happens again and
again, getting even slower as the function grows from inlining.

As inlining the huge find functions isn't really useful anyway, we can
mark them as noinline, which skips the cost analysis and reduces compile
times by as much as 70%.

cc #28273
@alexcrichton
Copy link
Member

In the future, could you also add a comment indicating why these are inline(never)? git blame certainly works but it's also nice to have it in the source :)

@bors bors merged commit 9104a90 into rust-lang:master Sep 11, 2015
@ranma42
Copy link
Contributor

ranma42 commented Sep 11, 2015

The files are automatically generated, so this change will be lost next time they are updated. The correct place to perform the change seems to be https://github.com/dotdash/rust/blob/9104a902c052c1ad7fd5c1245cb1e03f88aa2f70/src/etc/platform-intrinsics/generator.py#L740

@ranma42
Copy link
Contributor

ranma42 commented Sep 11, 2015

In addition to the DO NOT EDIT warning, maybe we should avoid keeping auto-generated files in git and ensure that they are generated during the build process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants