This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Simplify handling of /arch: flag.
ClosedPublic

Authored by thakis on Jan 24 2018, 12:13 PM.

Details

Reviewers
rnk
hans
Summary

r213083 initially implemented /arch: support by mapping it to CPU features. Then r241077 additionally mapped it to CPU, which made the feature flags redundant (if harmless). This change here removes the redundant mapping to feature flags, and rewrites test/Driver/cl-x86-flags.c to be a bit more of an integration test that checks for preprocessor defines like AVX (like documented on MSDN) instead of for driver flags.

To keep emitting warn_drv_unused_argument, use getLastArgNoClaim() followed by an explicit claim() if needed.

No intended behavior change.

This is in preparation for adding support for /arch:AVX512(F).

Diff Detail

Event Timeline

thakis created this revision.Jan 24 2018, 12:13 PM
hans added a subscriber: hans.Jan 25 2018, 1:37 AM

Thanks for looking into this!

lib/Driver/ToolChains/Arch/X86.cpp
42–43

I wonder if it would work to do Args.getLastArgNoClaim() here instead, then do A->claim() if we actually use the argument, and let the general unused argument mechanism warn otherwise. Maybe that way we could avoid passing the Driver around.

144

Won't we need to set features for /arch:AVX512 though, or how will that work?

hans removed a subscriber: hansw.Jan 25 2018, 1:37 AM
thakis updated this revision to Diff 131428.Jan 25 2018, 6:10 AM
thakis edited the summary of this revision. (Show Details)
thakis added inline comments.
lib/Driver/ToolChains/Arch/X86.cpp
42–43

Hey that seems to work, nice.Passing the driver around is still kind of nice since it allows addressing the FIXME: above, but it shouldn't be part of this patch then. Done.

144

I'll just have to add

.Case("AVX512F", "knl")
.Case("AVX512", "skylake-avx512")

to the CPU switch above.

hans accepted this revision.Jan 25 2018, 6:38 AM

lgtm

This revision is now accepted and ready to land.Jan 25 2018, 6:38 AM
thakis closed this revision.Jan 25 2018, 6:40 AM

r323426, thanks!