This is an archive of the discontinued LLVM Phabricator instance.

[LTO][clang] Using Single Dash Consistently when Passing LTO Options
ClosedPublic

Authored by qiongsiwu1 on Sep 26 2022, 12:44 PM.

Details

Summary

The following three static functions in clang/lib/Driver/ToolChains/CommonArgs.cpp

static void renderRpassOptions(...)
static void renderRemarksOptions(...)
static void renderRemarksHotnessOptions(...)

use --plugin-opt for the plugin option prefix, while the function tools::addLTOOptions uses -plugin-opt. This patch makes sure that we only use -plugin-opt (single dash) everywhere. It is not clear to me that why we decided to use --plugin-opt in https://reviews.llvm.org/D85810. If using --plugin-opt is intended, I'd love to hear the reason and I will close this patch.

We intend to followup this patch with a few other patches that teach clang to pass plugin options to the AIX linker, which uses a different prefix (-bplugin_opt:).

Diff Detail

Event Timeline

qiongsiwu1 created this revision.Sep 26 2022, 12:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2022, 12:44 PM
qiongsiwu1 requested review of this revision.Sep 26 2022, 12:44 PM
qiongsiwu1 edited the summary of this revision. (Show Details)Sep 26 2022, 12:46 PM
qiongsiwu1 edited the summary of this revision. (Show Details)
w2yehia accepted this revision.Sep 26 2022, 7:31 PM
This revision is now accepted and ready to land.Sep 26 2022, 7:31 PM

I think I want to revert this change. --plugin-opt= is entirely fine with lld and GNU gold/ld... And generally the double-dash long options are preferred.

qiongsiwu1 added a comment.EditedOct 6 2022, 2:20 PM

I think I want to revert this change. --plugin-opt= is entirely fine with lld and GNU gold/ld... And generally the double-dash long options are preferred.

Sure. What we are aiming at is using single or double dashes consistently, so that when the AIX plugin prefix is introduced, we don't deal with an arbitrary mixture of one or two dashes. I can work on a patch to change all -plugin-opt= to --plugin-opt=. How does having two dashes consistently sound?

Err since -plugin-opt= was used a lot of before this change, I think this is fine for consistency.

Err since -plugin-opt= was used a lot of before this change, I think this is fine for consistency.

Ah ok this sounds good to me as well! Just to make sure I understand, we will need https://reviews.llvm.org/D135400 then. Is this correct?