This is an archive of the discontinued LLVM Phabricator instance.

[TargetInfo] Sort target features before passing them to the backend
ClosedPublic

Authored by efriedma on Apr 24 2018, 3:24 PM.

Details

Summary

Passing the features in random order will lead to unpredictable results when some of the features are related (like the architecture-version feature on ARM).

It might be possible to fix this particular case in the ARM target code, to avoid adding overlapping target features. But we should probably be sorting in any case: the behavior shouldn't depend on StringMap's hashing algorithm.

Diff Detail

Repository
rC Clang

Event Timeline

efriedma created this revision.Apr 24 2018, 3:24 PM
efriedma updated this revision to Diff 143821.Apr 24 2018, 3:27 PM

Add REQUIRES line to testcase.

fhahn accepted this revision.Apr 25 2018, 2:01 AM

Thanks Eli, LGTM!

lib/Basic/Targets.cpp
641

Could you add a comment here briefly explaining why we sort here?

This revision is now accepted and ready to land.Apr 25 2018, 2:01 AM
This revision was automatically updated to reflect the committed changes.