[AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu
authorPeter Smith <peter.smith@linaro.org>
Tue, 24 Oct 2017 09:51:55 +0000 (09:51 +0000)
committerPeter Smith <peter.smith@linaro.org>
Tue, 24 Oct 2017 09:51:55 +0000 (09:51 +0000)
commit820e46f3b2b3edbf86315185ea403deb6f5b623c
tree70c78a3e6b34cebe2c7d9ffa9a303c873def5549
parentce256a3a01b9f207f9a5eba6b313c008fa373241
[AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu

When -mtune is used on AArch64 the -target-cpu is passed the value of the
cpu given to -mtune. As well as setting micro-architectural features of the
-mtune cpu, this will also add the architectural features such as support
for instructions. This can result in the backend using instructions that
are supported in the -mtune cpu but not supported in the target
architecture. For example use of the v8.1-a LSE extensions with -march=v8.

This change removes the setting of -target-cpu for -mtune, the -mcpu must
be used to set -target-cpu. This has the effect of removing all non-hard
coded benefits of mtune but it does produce correct output when -mtune cpu
with a later architecture than v8 is used.

Fixes PR34625

Differential Revision: https://reviews.llvm.org/D39179

llvm-svn: 316424
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/aarch64-cpus.c