Vendor import of clang release_60 branch r323948:

https://llvm.org/svn/llvm-project/cfe/branches/release_60@323948
This commit is contained in:
Dimitry Andric 2018-02-01 21:14:15 +00:00
parent 520a89e9d3
commit bddbc598a7
9 changed files with 126 additions and 5 deletions

View File

@ -213,7 +213,49 @@ Objective-C Language Changes in Clang
OpenCL C Language Changes in Clang
----------------------------------
...
- Added subgroup builtins to enqueue kernel support.
- Added CL2.0 atomics as Clang builtins that now accept
an additional memory scope parameter propagated to atomic IR instructions
(this is to align with the corresponding change in LLVM IR) (see `spec s6.13.11.4
<https://www.khronos.org/registry/OpenCL/specs/opencl-2.0-openclc.pdf#107>`_).
- Miscellaneous fixes in the CL header.
- Allow per target selection of address space during CodeGen of certain OpenCL types.
Default target implementation is provided mimicking old behavior.
- Macro ``__IMAGE_SUPPORT__`` is now automatically added (as per `spec s6.10
<https://www.khronos.org/registry/OpenCL/specs/opencl-2.0-openclc.pdf#55>`_).
- Added ``cl_intel_subgroups`` and ``cl_intel_subgroups_short`` extensions.
- All function calls are marked by `the convergent attribute
<https://clang.llvm.org/docs/AttributeReference.html#convergent-clang-convergent>`_
to prevent optimizations that break SPMD program semantics. This will be removed
by LLVM passes if it can be proved that the function does not use convergent
operations.
- Create a kernel wrapper for enqueued blocks, which simplifies enqueue support by
providing common functionality.
- Added private address space explicitly in AST and refactored address space support
with several simplifications and bug fixes (`PR33419 <https://llvm.org/pr33419>`_
and `PR33420 <https://llvm.org/pr33420>`_).
- OpenCL now allows functions with empty parameters to be treated as if they had a
void parameter list (inspired from C++ support). OpenCL C spec update to follow.
- General miscellaneous refactoring and cleanup of blocks support for OpenCL to
remove unused parts inherited from Objective C implementation.
- Miscellaneous improvements in vector diagnostics.
- Added half float load and store builtins without enabling half as a legal type
(``__builtin_store_half for double``, ``__builtin_store_halff`` for double,
``__builtin_load_half for double``, ``__builtin_load_halff`` for float).
OpenMP Support in Clang
----------------------------------

View File

@ -354,4 +354,12 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
def note_drv_verify_prefix_spelling : Note<
"-verify prefixes must start with a letter and contain only alphanumeric"
" characters, hyphens, and underscores">;
def warn_drv_experimental_isel_incomplete : Warning<
"-fexperimental-isel support for the '%0' architecture is incomplete">,
InGroup<ExperimentalISel>;
def warn_drv_experimental_isel_incomplete_opt : Warning<
"-fexperimental-isel support is incomplete for this architecture at the current optimization level">,
InGroup<ExperimentalISel>;
}

View File

@ -985,3 +985,6 @@ def UnknownArgument : DiagGroup<"unknown-argument">;
// A warning group for warnings about code that clang accepts when
// compiling OpenCL C/C++ but which is not compatible with the SPIR spec.
def SpirCompat : DiagGroup<"spir-compat">;
// Warning for the experimental-isel options.
def ExperimentalISel : DiagGroup<"experimental-isel">;

View File

@ -1031,6 +1031,8 @@ def finline_functions : Flag<["-"], "finline-functions">, Group<f_clang_Group>,
def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Inline functions which are (explicitly or implicitly) marked inline">;
def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>;
def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group<f_clang_Group>,
HelpText<"Enables the experimental global instruction selector">;
def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">,
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Enables an experimental new pass manager in LLVM.">;
@ -1237,6 +1239,8 @@ def fno_exceptions : Flag<["-"], "fno-exceptions">, Group<f_Group>;
def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group<f_Group>, Flags<[CC1Option]>;
def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_Group>,
HelpText<"Disables the experimental global instruction selector">;
def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">,
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Disables an experimental new pass manager in LLVM.">;

View File

@ -409,7 +409,7 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
if (Enabled) {
switch (Level) {
case AVX512F:
Features["avx512f"] = true;
Features["avx512f"] = Features["fma"] = Features["f16c"] = true;
LLVM_FALLTHROUGH;
case AVX2:
Features["avx2"] = true;
@ -623,6 +623,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
} else if (Name == "fma") {
if (Enabled)
setSSELevel(Features, AVX, Enabled);
else
setSSELevel(Features, AVX512F, Enabled);
} else if (Name == "fma4") {
setXOPLevel(Features, FMA4, Enabled);
} else if (Name == "xop") {
@ -632,6 +634,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
} else if (Name == "f16c") {
if (Enabled)
setSSELevel(Features, AVX, Enabled);
else
setSSELevel(Features, AVX512F, Enabled);
} else if (Name == "sha") {
if (Enabled)
setSSELevel(Features, SSE2, Enabled);

View File

@ -4639,6 +4639,37 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fwhole-program-vtables");
}
if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel,
options::OPT_fno_experimental_isel)) {
CmdArgs.push_back("-mllvm");
if (A->getOption().matches(options::OPT_fexperimental_isel)) {
CmdArgs.push_back("-global-isel=1");
// GISel is on by default on AArch64 -O0, so don't bother adding
// the fallback remarks for it. Other combinations will add a warning of
// some kind.
bool IsArchSupported = Triple.getArch() == llvm::Triple::aarch64;
bool IsOptLevelSupported = false;
Arg *A = Args.getLastArg(options::OPT_O_Group);
if (Triple.getArch() == llvm::Triple::aarch64) {
if (!A || A->getOption().matches(options::OPT_O0))
IsOptLevelSupported = true;
}
if (!IsArchSupported || !IsOptLevelSupported) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-global-isel-abort=2");
if (!IsArchSupported)
D.Diag(diag::warn_drv_experimental_isel_incomplete) << Triple.getArchName();
else
D.Diag(diag::warn_drv_experimental_isel_incomplete_opt);
}
} else {
CmdArgs.push_back("-global-isel=0");
}
}
// Finally add the compile command to the compilation.
if (Args.hasArg(options::OPT__SLASH_fallback) &&
Output.getType() == types::TY_Object &&

View File

@ -46,7 +46,7 @@ static void handleHVXWarnings(const Driver &D, const ArgList &Args) {
// Handle the unsupported values passed to mhvx-length.
if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_length_EQ)) {
StringRef Val = A->getValue();
if (Val != "64B" && Val != "128B")
if (!Val.equals_lower("64b") && !Val.equals_lower("128b"))
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Val;
}

24
test/Driver/global-isel.c Normal file
View File

@ -0,0 +1,24 @@
// REQUIRES: x86-registered-target,aarch64-registered-target
// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck --check-prefix=ENABLED %s
// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck --check-prefix=DISABLED %s
// RUN: %clang -target aarch64 -fexperimental-isel -S %s -### 2>&1 | FileCheck --check-prefix=ARM64-DEFAULT %s
// RUN: %clang -target aarch64 -fexperimental-isel -S -O0 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O0 %s
// RUN: %clang -target aarch64 -fexperimental-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2 %s
// RUN: %clang -target aarch64 -fexperimental-isel -Wno-experimental-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2-NOWARN %s
// RUN: %clang -target x86_64 -fexperimental-isel -S %s -### 2>&1 | FileCheck --check-prefix=X86_64 %s
// ENABLED: "-mllvm" "-global-isel=1"
// DISABLED: "-mllvm" "-global-isel=0"
// ARM64-DEFAULT-NOT: warning: -fexperimental-sel
// ARM64-DEFAULT-NOT: "-global-isel-abort=2"
// ARM64-O0-NOT: warning: -fexperimental-sel
// ARM64-O2: warning: -fexperimental-isel support is incomplete for this architecture at the current optimization level
// ARM64-O2: "-mllvm" "-global-isel-abort=2"
// ARM64-O2-NOWARN-NOT: warning: -fexperimental-isel
// X86_64: -fexperimental-isel support for the 'x86_64' architecture is incomplete
// X86_64: "-mllvm" "-global-isel-abort=2"

View File

@ -21,6 +21,9 @@
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx \
// RUN: -mhvx-length=128B 2>&1 | FileCheck -check-prefix=CHECKHVX2 %s
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx \
// RUN: -mhvx-length=128b 2>&1 | FileCheck -check-prefix=CHECKHVX2 %s
// CHECKHVX2-NOT: "-target-feature" "+hvx-length64b"
// CHECKHVX2: "-target-feature" "+hvx-length128b"
@ -79,8 +82,10 @@
// The default mode on v60,v62 is 64B.
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx -mhvx-length=64B\
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \
// RUN: -mhvx-length=64b 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \
// RUN: -mhvx-length=64B 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s
// CHECK-HVXLENGTH-64B: "-target-feature" "+hvx{{.*}}" "-target-feature" "+hvx-length64b"
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx -mhvx-length=128B\
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-128B %s