This is an archive of the discontinued LLVM Phabricator instance.

[clang][PPC] Supporting -mcpu=405
ClosedPublic

Authored by qiongsiwu1 on Dec 14 2022, 6:20 PM.

Details

Summary

The ClangBuiltLinux project relies on -mcpu=405. Before https://reviews.llvm.org/D139720, clang treated -mcpu=405 implicitly in the same way as -mcpu=generic, because 405 was an unknown value and clang did not validate unknown input values. https://reviews.llvm.org/D139720 added the validation of -mcpu input value, and clang now generates an error with -mcpu=405. For further details of the problem, see https://github.com/ClangBuiltLinux/linux/issues/1771.

This patch adds support of -mcpu=405 explicitly, and treats it as an equivalent of -mcpu=generic.

Diff Detail

Event Timeline

qiongsiwu1 created this revision.Dec 14 2022, 6:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2022, 6:20 PM
qiongsiwu1 requested review of this revision.Dec 14 2022, 6:20 PM
qiongsiwu1 edited the summary of this revision. (Show Details)Dec 14 2022, 6:23 PM
qiongsiwu1 edited the summary of this revision. (Show Details)Dec 14 2022, 6:25 PM
nemanjai accepted this revision.Dec 15 2022, 5:34 AM

I don't think the comments require another round of review. Thanks for fixing this.

clang/lib/Driver/ToolChains/Arch/PPC.cpp
23–29

While I understand the motivation here, I think that this is overkill. We in fact hope not to have to grow the set of CPU ID's that we treat as generic.

42

I think we should change this to check for generic or 405 and add a comment similar to the following:

// Clang/LLVM does not actually support code generation
// for the 405 CPU. However, there are uses of this CPU ID
// in projects that previously used GCC and rely on Clang
// accepting it. Clang has always ignored it and passed the
// generic CPU ID to the back end.
This revision is now accepted and ready to land.Dec 15 2022, 5:34 AM

Addressing review comments. Thanks for the review @nemanjai !!

qiongsiwu1 marked 2 inline comments as done.Dec 15 2022, 5:47 AM

The pre-commit CI crashes do not seem to relate to this patch. I will land it soon.

This revision was landed with ongoing or failed builds.Dec 15 2022, 7:56 AM
This revision was automatically updated to reflect the committed changes.