This is an archive of the discontinued LLVM Phabricator instance.

[asan][test][win] Port trivial tests to not use clang-cl on MinGW
ClosedPublic

Authored by alvinhochun on Apr 3 2023, 3:39 AM.

Details

Summary

Use clang driver on MinGW where clang-cl is not usable. MSVC target
still uses clang-cl to minimize changes to existing test runners.

Diff Detail

Event Timeline

alvinhochun created this revision.Apr 3 2023, 3:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 3:39 AM
Herald added a subscriber: Enna1. · View Herald Transcript
alvinhochun requested review of this revision.Apr 3 2023, 3:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 3:39 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Add a missing chnage

vitalybuka requested changes to this revision.Apr 3 2023, 1:46 PM
vitalybuka added inline comments.
compiler-rt/test/asan/lit.cfg.py
148–149

please use substitutions instead

This revision now requires changes to proceed.Apr 3 2023, 1:46 PM

Use substitution to map clang-cl command and flags to clang gcc-style flags on MinGW

IIUC -Od in MSVC (disable optimizations) is the default. -O0 is the default in Clang. Can we remove %Od from RUN lines?

IIUC -Od in MSVC (disable optimizations) is the default. -O0 is the default in Clang. Can we remove %Od from RUN lines?

I'm not sure. Digging through the history shows they were previously using -O0 until that flag was replaced in https://reviews.llvm.org/D64506. The first instance of -O0 being added to the asan tests was https://reviews.llvm.org/D3767 with no explanation why it was needed. Curiously it seems only Windows tests using clang-cl had this flag. Was the default opt level for clang-cl different back then?

For cl.exe, https://learn.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=msvc-170 seems to indicate that /Ot is the default. Of course clang-cl doesn't have to match that, but I wonder if there is a possibility it may change in the future.

vitalybuka accepted this revision.Apr 19 2023, 4:04 PM

Thanks, I like this version better.

This revision is now accepted and ready to land.Apr 19 2023, 4:04 PM