Order file generation support in swiftc

Order file generation appears to be supported by clang via -cc1 -forder-file-instrumentation, and in turn LLVM has an option --enable-order-file-instrumentation. Is this option currently supported for swiftc via -Xllvm? If not, it would be great to have it, or better yet a flag within swiftc. I've seen order files reduce startup time by ~5% for large apps.

Note that there is support in swiftc to instrument all function calls with -sanitize-coverage but using it for order file generation is much less convenient and obvious.

1 Like

I looked into this a little bit by chatting with @vedantk.

My understanding is that this is something where one only needs to set an option in LLVM. If my understanding is correct then this should just be a matter of creating a driver option like clang has to expose this to the user. Patches welcome?

To be more specific, I would add something like this:

I think you would add it here: https://github.com/apple/swift/blob/8c70a9625879a9a72ae17fcf9fa3f42f2113e951/lib/Driver/ToolChains.cpp#L158.

Beyond that you just need a driver option to cause this code to trigger and some tests.

That being said, that is just how I would do it naively. Maybe there are better places/etc. @jrose @brentdax @Douglas_Gregor

1 Like

That looks pretty straight-forward, if this is likely to be accepted into the repo, I can take a stab at it (who makes those decisions?)

Terms of Service

Privacy Policy

Cookie Policy