This is an archive of the discontinued LLVM Phabricator instance.

[AIX][TLS][clang] Add -maix-small-local-exec-tls clang option.
ClosedPublic

Authored by amyk on Jul 17 2023, 10:27 PM.

Details

Summary

This patch adds the clang portion of an AIX-specific option to inform
the compiler that it can use a faster access sequence for the local-exec
TLS model (formally named aix-small-local-exec-tls).

This patch only adds the frontend portion of the option, building upon:

  • Backend portion of the option (D156203)
  • Backend patch that utilizes this option to actually produce the faster access sequence (D155600)

Diff Detail

Event Timeline

amyk created this revision.Jul 17 2023, 10:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 10:27 PM
amyk requested review of this revision.Jul 17 2023, 10:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 10:27 PM
DiggerLin added a subscriber: DiggerLin.
DiggerLin added inline comments.
llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll
15 ↗(On Diff #541320)

since the patch only add a new option "aix-small-local-exec-tls" , the the backend implementation for this option in not in the patch, the behavior of the CodeGen do not change in the patch, I do not think we need the test case.

stefanp accepted this revision as: stefanp.Jul 21 2023, 11:23 AM

I think this patch makes sense to me.
LGTM.

llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll
15 ↗(On Diff #541320)

I would actually prefer to have a test case here. We do need to check to make sure that the backend produces the correct error on Linux and produces valid codegen on AIX.

This revision is now accepted and ready to land.Jul 21 2023, 11:23 AM

Patch should not land before back-end patch. I also suggest having the patch incorporate the new option into the Clang release notes before it lands.

llvm/lib/Target/PowerPC/PPC.td
324 ↗(On Diff #541320)

As agreed offline:
thread pointer value -> TLS base

llvm/lib/Target/PowerPC/PPCSubtarget.cpp
127 ↗(On Diff #541320)

There should be no confusion over how tightly ! binds over &&.

clang/include/clang/Driver/Options.td
4729

Same comment: use "TLS base".

clang/test/Driver/aix-small-local-exec-tls.c
3

It was agreed in offline discussion that 32-bit AIX should generate a message about the option because the general semantics are meaningful in that context but there is no implementation.

llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll
6 ↗(On Diff #541320)

Same comment re: 32-bit AIX.

amyk added a comment.Jul 21 2023, 2:22 PM

Patch should not land before back-end patch. I also suggest having the patch incorporate the new option into the Clang release notes before it lands.

I'm currently addressing reviews for the back-end patch but just wanted to clarify because I might be misunderstanding something.

Wouldn't this patch need to land before the back-end patch, because I introduce the option here, and then I use it in the backend patch?
In terms of checking for a 32-bit diagnostic within check-aix-small-local-exec-tls-opt.ll, the RUN lines in that test currently are 64-bit RUN lines. Perhaps in the backend patch, I should just add the 32-bit lines to show the diagnostic?

Wouldn't this patch need to land before the back-end patch, because I introduce the option here, and then I use it in the backend patch?

Please move the llvm/ changes into the back-end patch or land them separately first.

In terms of checking for a 32-bit diagnostic within check-aix-small-local-exec-tls-opt.ll, the RUN lines in that test currently are 64-bit RUN lines. Perhaps in the backend patch, I should just add the 32-bit lines to show the diagnostic?

This seems to be the test designed to cover the non-codegen aspects of the attribute. In that light, the 32-bit run line belongs here.

amyk updated this revision to Diff 543818.Jul 24 2023, 10:12 PM
amyk retitled this revision from [AIX][TLS] Add -maix-small-local-exec-tls option. to [AIX][TLS][clang[ Add -maix-small-local-exec-tls clang option..
amyk edited the summary of this revision. (Show Details)
amyk retitled this revision from [AIX][TLS][clang[ Add -maix-small-local-exec-tls clang option. to [AIX][TLS][clang] Add -maix-small-local-exec-tls clang option..
amyk marked 5 inline comments as done.

Address review comments from Hubert and update this patch to be only the clang portion of the option.

amyk marked an inline comment as done.Jul 24 2023, 10:13 PM
hubert.reinterpretcast edited the summary of this revision. (Show Details)Jul 25 2023, 12:13 PM

LGTM for landing after D156203 and D155600.