Page MenuHomePhabricator

[Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS
ClosedPublic

Authored by chh on Mar 1 2018, 12:56 PM.

Details

Summary

Since LLVM r326341, default EmulatedTLS mode is decided in backend according to target triple. Any front-end should pass -f[no]-emulated-tls to backend and set up ExplicitEmulatedTLS only when the flags are used.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Mar 1 2018, 12:56 PM
chh commandeered this revision.Mar 1 2018, 1:39 PM
chh edited reviewers, added: mstorsjo; removed: chh.

I will upload a different fix soon.
We should set ExplicitEmulatedTLS only when -f[no-]emulated-tls flag is found at command line.
Any front-end should only pass the flag and let backend decide the default based on target.

Ok, thanks. Yes, this should probably only set it if some of those flags are set here.

FWIW, clang also has got a list of targets where emulated TLS is enabled by default - could this be omitted somehow, now that LLVM can handle that on its own?

chh updated this revision to Diff 136601.Mar 1 2018, 2:02 PM
chh retitled this revision from [CodeGen] Force the backend to follow clang's EmulatedTLS flag to [Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS.
chh edited the summary of this revision. (Show Details)
chh added a reviewer: srhines.
mstorsjo accepted this revision.Mar 1 2018, 2:11 PM

LGTM (although I didn't test run it).

This revision is now accepted and ready to land.Mar 1 2018, 2:11 PM
chh added a comment.Mar 1 2018, 2:12 PM

Martin, thanks for finding this problem.
Please review/accept my new change if it passes your tests.
After this and D42999, the default emulated TLS mode should only be decided in
llvm/trunk/include/llvm/ADT/Triple.h hasDefaultEmulatedTLS().

Tested on the case that was broken before, and seems to work fine. Thanks!

This revision was automatically updated to reflect the committed changes.