Skip to content

Commit 69ead9d

Browse files
committed
[Apple Silicon] [Platform] Default arm64 macOS and arm64 simulators to "vortex" CPU.
1 parent 2ef95d3 commit 69ead9d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,20 @@ addCommonInvocationArguments(std::vector<std::string> &invocationArgStrs,
722722
invocationArgStrs.push_back("-mcpu=" + importerOpts.TargetCPU);
723723

724724
} else if (triple.isOSDarwin()) {
725-
// Special case: arm64 defaults to the "cyclone" CPU for Darwin,
726-
// and arm64e defaults to the "vortex" CPU for Darwin,
727-
// but Clang only detects this if we use -arch.
725+
// Special case CPU based on known deployments:
726+
// - arm64 deploys to cyclone
727+
// - arm64 on macOS
728+
// - arm64 for iOS/tvOS/watchOS simulators
729+
// - arm64e deploys to vortex
730+
// and arm64e (everywhere) and arm64e macOS defaults to the "vortex" CPU
731+
// for Darwin, but Clang only detects this if we use -arch.
728732
if (triple.getArchName() == "arm64e")
729733
invocationArgStrs.push_back("-mcpu=vortex");
734+
else if (triple.isAArch64() && triple.isMacOSX())
735+
invocationArgStrs.push_back("-mcpu=vortex");
736+
else if (triple.isAArch64() && triple.isSimulatorEnvironment() &&
737+
(triple.isiOS() || triple.isWatchOS()))
738+
invocationArgStrs.push_back("-mcpu=vortex");
730739
else if (triple.getArch() == llvm::Triple::aarch64 ||
731740
triple.getArch() == llvm::Triple::aarch64_be) {
732741
invocationArgStrs.push_back("-mcpu=cyclone");

0 commit comments

Comments
 (0)