This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Simplify unifying target features
ClosedPublic

Authored by jhuber6 on Jun 13 2022, 7:10 PM.

Details

Summary

This patch simplifies how we unify target features. Now we simply
iterate the input in reverse and only insert the feature if it hasn't
been seen yet. The only reason we need to reverse this at the end is to
keep the features in order for the existing tests.

Diff Detail

Event Timeline

jhuber6 created this revision.Jun 13 2022, 7:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2022, 7:10 PM
jhuber6 requested review of this revision.Jun 13 2022, 7:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2022, 7:10 PM
tra accepted this revision.Jun 14 2022, 10:02 AM
tra added inline comments.
clang/lib/Driver/ToolChains/CommonArgs.cpp
153

Nit: You could use UnifiedFeatures.insert(UnifiedFeatures.begin(), Feature) and that would make the following std::reverse unnecessary. Up to you.
The code is not performance critical, so we don't care that we have to copy the elements.

This revision is now accepted and ready to land.Jun 14 2022, 10:02 AM
jhuber6 marked an inline comment as done.Jun 14 2022, 10:36 AM
This revision was landed with ongoing or failed builds.Jun 14 2022, 12:58 PM
This revision was automatically updated to reflect the committed changes.