This is an archive of the discontinued LLVM Phabricator instance.

[lli] Make lli support -mcpu=native for CPU autodetection
ClosedPublic

Authored by craig.topper on Jan 8 2018, 12:37 PM.

Details

Summary

llc, opt, and clang can all autodetect the CPU and supported features. lli cannot as far as I could tell.

This patch uses the getCPUStr() and introduces a new getCPUFeatureList() and uses those in lli in place of MCPU and MAttrs.

Ideally, we should merge getCPUFeatureList and getCPUFeatureStr, but opt and llc need a string and lli wanted a list. Maybe we should just return the SubtargetFeature object and let the caller decide what it needs?

Diff Detail

Event Timeline

craig.topper created this revision.Jan 8 2018, 12:37 PM
davide requested changes to this revision.Jan 8 2018, 12:49 PM
davide added a subscriber: davide.

This change looks fine, but can you add a unit test (if possible)?

This revision now requires changes to proceed.Jan 8 2018, 12:49 PM

Do you have any suggestions of how to do that? Not sure what features I could guarantee from the build bots.

davide added a comment.Jan 8 2018, 1:12 PM

hmm, native makes this a pain. Probably not worth the trouble.

davide accepted this revision.Jan 8 2018, 1:12 PM
This revision is now accepted and ready to land.Jan 8 2018, 1:12 PM
This revision was automatically updated to reflect the committed changes.