This is an archive of the discontinued LLVM Phabricator instance.

Add support for Bazel builds on Windows with `clang-cl`.
ClosedPublic

Authored by chandlerc on Oct 16 2021, 1:05 AM.

Details

Reviewers
GMNGeoffrey
Summary

Adds basic --config=clang-cl to set up the basic options needed, and
then fix a number of issues that surface in Windows builds for me.

With these fixes, //llvm/... builds cleanly. One unittest still fails,
but its just due to running out of stack space due to creating a large
number of short-lived stack variables. The test should probably be
decomposed into a set of tests (LegalizerInfoTest::RuleSets), but that
seemed like too invasive of a change here and with everything building
cleanly this isn't disrupting me experimenting with Windows builds.

Diff Detail

Event Timeline

chandlerc created this revision.Oct 16 2021, 1:05 AM
chandlerc requested review of this revision.Oct 16 2021, 1:05 AM
chandlerc updated this revision to Diff 380150.Oct 16 2021, 1:20 AM

Add at least one obvious fix needed in Clang's build rules as well.

GMNGeoffrey added inline comments.Oct 18 2021, 2:53 PM
utils/bazel/llvm-project-overlay/clang/BUILD.bazel
31–32

Is it actually these files that need dl? Previously we decided it was better to add it the root library that used it. We're already setting it in llvm:Support, which this depends on, so I don't think this should be necessary (https://github.com/llvm/llvm-project/blob/0eed292fbae22a8856682b07e1cb968424b49941/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel#L211)

utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
115

Hmmm unfortunate that these have to increase specifically for windows. Do windows tests take longer overall? We could change the actual timeouts corresponding to the timeout names instead.

chandlerc updated this revision to Diff 381769.Oct 23 2021, 5:52 PM
chandlerc marked an inline comment as done.

Update based on review...

Updated, PTAL

utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
115

Tests aren't generally slower, just certain *kinds* of tests. =/

Specifically, GoogleTest's "death tests" are both much slower and have much higher variability on Windows AFAICT.

I can defer these if you want and try to get statistics on how important they are, and where. I just added these when during testing I got some timeouts.

chandlerc added a subscriber: llvm-commits.
GMNGeoffrey accepted this revision.Oct 25 2021, 11:38 AM
GMNGeoffrey added inline comments.
utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
115

Bleh. Seems like no good solution. This is fine.

This revision is now accepted and ready to land.Oct 25 2021, 11:38 AM
chandlerc closed this revision.Oct 30 2021, 3:49 PM