Skip to content

Enable LTO on the Linux Clang build on CI#3491

Merged
dschuff merged 6 commits into
masterfrom
ltotest
Jan 14, 2021
Merged

Enable LTO on the Linux Clang build on CI#3491
dschuff merged 6 commits into
masterfrom
ltotest

Conversation

@dschuff

@dschuff dschuff commented Jan 14, 2021

Copy link
Copy Markdown
Member

No description provided.

@dschuff

dschuff commented Jan 14, 2021

Copy link
Copy Markdown
Member Author

@sbc100 @kripken it looks like thinLTO pretty much just works on both the linux and mac builders here. Should we just turn it on for our existing clang and/or mac builders?

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sgtm

@kripken kripken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm % comments

Comment thread CMakeLists.txt
option(BYN_ENABLE_LTO "Build with LTO" Off)
if(BYN_ENABLE_LTO)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this needed? docs say it allows regexes, but the right side isn't one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Apple's clang has the compiler ID AppleClang which MATCHES clang but isn't STREQUAL. Using MATCHES with bare strings seems pretty common in CMake files (it definitely is in LLVM's)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see, sgtm.

Comment thread .github/workflows/ci.yml Outdated

- name: cmake (macos)
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install -DBYN_ENABLE_LTO=ON

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd suggest not changing the mac build since it's what we ship to users atm.

(The linux "clang" build sgtm to change to LTO, since we do have a bunch of other non-LTO builds on linux anyhow.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

OK yeah, that's sort of what I had in mind for now too.
I think we do want to ship this to users eventually though if it doesn't end up being too much trouble.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, yeah, would be good to ship this. (And switch testing then - but I don't feel strongly about the meantime either.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Speaking of, I noticed that we still force assertions on. Are we close to no longer requiring that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

(also our current command line puts a -O2 and overrides the default -O3)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the status is not changed from #3065 - we were thinking of testing with assertions but shipping to users without, which would need more work. LTO is probably a bigger deal though than assertions, from your data.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I found it to be fairly evenly split between them, actually. Although those numbers were probably dominated by LLVM rather than Binaryen. For emscripten-releases I think we do want to test with assertions for LLVM as well. Not sure how much difference it makes on the standalone releases.

@dschuff dschuff changed the title [WIP] try out LTO on CI Enable LTO on the Linux Clang build on CI Jan 14, 2021
@dschuff dschuff marked this pull request as ready for review January 14, 2021 23:42
@dschuff dschuff merged commit f18c18e into master Jan 14, 2021
@dschuff dschuff deleted the ltotest branch January 14, 2021 23:57
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.

3 participants