platform/upstream/llvm.git
4 years agoDebugInfo: Fix rangesBaseAddress DICompileUnit bitcode serialization/deserialization
David Blaikie [Sat, 28 Dec 2019 01:18:50 +0000 (17:18 -0800)]
DebugInfo: Fix rangesBaseAddress DICompileUnit bitcode serialization/deserialization

Follow-up to r346788 review feedback from Adrian Prantl.

4 years agoAMDGPU: Adjust test so it will work with GlobalISel
Matt Arsenault [Sat, 28 Dec 2019 00:35:00 +0000 (19:35 -0500)]
AMDGPU: Adjust test so it will work with GlobalISel

This is mostly a workaround for not handling the mubuf store path yet.

4 years ago[ELF] Improve the condition to create .interp
Fangrui Song [Fri, 27 Dec 2019 21:24:41 +0000 (13:24 -0800)]
[ELF] Improve the condition to create .interp

This restores commit 1417558e4a61794347c6bfbafaff7cd96985b2c3 and its follow-up, reverted by commit c3dbd782f1e0578c7ebc342f2e92f54d9644cff7.

After this commit:

clang -fuse-ld=bfd -no-pie -nostdlib a.c => .interp not created
clang -fuse-ld=bfd -pie -fPIE -nostdlib a.c => .interp created

clang -fuse-ld=gold -no-pie -nostdlib a.c => .interp not created
clang -fuse-ld=gold -pie -fPIE -nostdlib a.c => .interp created

clang -fuse-ld=lld -no-pie -nostdlib a.c => .interp created
clang -fuse-ld=lld -pie -fPIE -nostdlib a.c => .interp created

4 years ago[sanitizer] Link Sanitizer-x86_64-Test-Nolibc with -static
Fangrui Song [Fri, 27 Dec 2019 23:08:10 +0000 (15:08 -0800)]
[sanitizer] Link Sanitizer-x86_64-Test-Nolibc with -static

Pass -static so that clang will not pass -Wl,--dynamic-linker,... to the
linker. The test is not expected to run under a ld.so. (Technically it
works under a ld.so but glibc expects to see a PT_DYNAMIC. lld
intentionally does not follow GNU ld's complex rules regarding
PT_DYNAMIC.)

This allows commit 1417558e4a61794347c6bfbafaff7cd96985b2c3 to be
relanded.

4 years agoAMDGPU/GlobalISel: Use SReg_32 for readfirstlane constraining
Matt Arsenault [Fri, 27 Dec 2019 22:41:16 +0000 (17:41 -0500)]
AMDGPU/GlobalISel: Use SReg_32 for readfirstlane constraining

This matches the DAG behavior where we don't use SReg_32_XM0
everywhere anymore, and fixes not coalescing the copies into m0.

4 years agoHexagon: Fix missing tablegen mode comment
Matt Arsenault [Sat, 17 Aug 2019 21:35:47 +0000 (17:35 -0400)]
Hexagon: Fix missing tablegen mode comment

4 years agoTII: Fix using Register for a subregister index argument
Matt Arsenault [Fri, 27 Dec 2019 20:46:10 +0000 (15:46 -0500)]
TII: Fix using Register for a subregister index argument

4 years agoAMDGPU: Use Register
Matt Arsenault [Fri, 27 Dec 2019 20:21:44 +0000 (15:21 -0500)]
AMDGPU: Use Register

4 years ago[mlir][spirv] Add basic definitions for supporting availability
Lei Zhang [Fri, 27 Dec 2019 21:24:33 +0000 (16:24 -0500)]
[mlir][spirv] Add basic definitions for supporting availability

SPIR-V has a few mechanisms to control op availability: version,
extension, and capabilities. These mechanisms are considered as
different availability classes.

This commit introduces basic definitions for modelling SPIR-V
availability classes. Specifically, an `Availability` class is
added to SPIRVBase.td, along with two subclasses: MinVersion
and MaxVersion for versioning. SPV_Op is extended to take a
list of `Availability`. Each `Availability` instance carries
information for generating op interfaces for the corresponding
availability class and also the concrete availability
requirements.

With the availability spec on ops, we can now auto-generate the
op interfaces of all SPIR-V availability classes and also
synthesize the op's implementations of these interfaces. The
interface generation is done via new TableGen backends
-gen-avail-interface-{decls|defs}. The op's implementation is
done via -gen-spirv-avail-impls.

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

4 years agoRevert "[ELF] Improve the condition to create .interp"
Reid Kleckner [Fri, 27 Dec 2019 21:02:23 +0000 (13:02 -0800)]
Revert "[ELF] Improve the condition to create .interp"

This reverts commit 1417558e4a61794347c6bfbafaff7cd96985b2c3.
Also reverts commit 019a92bb2832447092bb5c1faf9d03bb03b8c9c8.

This causes check-sanitizer to fail. The "-Nolib" variant of the test
crashes on startup in the loader.

4 years agoSupport powerpc and sparc when building without init_array.
Sterling Augustine [Fri, 27 Dec 2019 19:52:12 +0000 (11:52 -0800)]
Support powerpc and sparc when building without init_array.

Summary: Support powerpc and sparc when building without init_array.

Reviewers: rdhindsa, gribozavr

Subscribers: jyknight, nemanjai, fedor.sergeev, jsji, shchenz, steven.zhang, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[PowerPC][LoopVectorize]Add floating point reg usage test
Jinsong Ji [Fri, 27 Dec 2019 19:29:13 +0000 (19:29 +0000)]
[PowerPC][LoopVectorize]Add floating point reg usage test

Copied two tests from x86 to test floating point reg usage.

4 years ago[mlir][spirv] Update docs regarding how to define new ops and types
Lei Zhang [Fri, 27 Dec 2019 20:28:45 +0000 (15:28 -0500)]
[mlir][spirv] Update docs regarding how to define new ops and types

This commit expands on the steps of defining a new SPIR-V op and
also provides pointers on how to define a new SPIR-V specific type.

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

4 years agoRevert "CWG2352: Allow qualification conversions during reference binding."
David Blaikie [Fri, 27 Dec 2019 20:17:01 +0000 (12:17 -0800)]
Revert "CWG2352: Allow qualification conversions during reference binding."

This reverts commit de21704ba96fa80d3e9402f12c6505917a3885f4.

Regressed/causes this to error due to ambiguity:

  void f(const int * const &);
  void f(int *);
  int main() {
    int * x;
    f(x);
  }

(in case it's important - the original case where this turned up was a
member function overload in a class template with, essentially:

  f(const T1&)
  f(T2*)

(where T1 == X const *, T2 == X))

It's not super clear to me if this ^ is expected behavior, in which case
I'm sorry about the revert & happy to look into ways to fix the original
code.

4 years ago[mlir] Convert std.and/std.or ops to spv.LogicalAnd/spv.LogicalOr
MaheshRavishankar [Thu, 26 Dec 2019 00:29:17 +0000 (16:29 -0800)]
[mlir] Convert std.and/std.or ops to spv.LogicalAnd/spv.LogicalOr

The conversion from std.and/std.or to spv.LogicalAnd/spv.LogicalOr is
only valid for boolean (i1) types. Modify BinaryOpPattern in
StandardToSPIRV.td to allow limiting the type of the operands for
which the pattern is applied.

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

4 years agoReland "[msan] Intercept qsort, qsort_r."
Reid Kleckner [Fri, 27 Dec 2019 19:29:00 +0000 (11:29 -0800)]
Reland "[msan] Intercept qsort, qsort_r."

This reverts commit 8fcce5ac73d49981656d9126e6c88391c1f6bf01.

I spoke too soon, the revert does not actually cause the startup crash
to go away.

4 years agoRevert "[msan] Intercept qsort, qsort_r."
Reid Kleckner [Fri, 27 Dec 2019 19:24:07 +0000 (11:24 -0800)]
Revert "[msan] Intercept qsort, qsort_r."

This reverts commit 7a9ebe95125ea87a494d0c18f44f10bd70e12188, and
dependent commit 54c522420347e58aa7bae1892cf5c5672b57c875, which
disables qsort interception for some iOS platforms.

After this change, the -Nolibc sanitizer common test binary crashes on
startup on my regular Linux workstation, as well as on our bots:
https://ci.chromium.org/p/chromium/builders/try/linux_upload_clang/740

 ********************
  Failing Tests (1):
       SanitizerCommon-Unit ::
       ./Sanitizer-x86_64-Test/SanitizerCommon.NolibcMain

Loading it up in gdb shows that it crashes during relocation processing,
which suggests that some glibc loader versions do not support the
THREADLOCAL data added in this interceptor.

4 years agoTailDuplication: Clear NoPHIs property
Matt Arsenault [Fri, 27 Dec 2019 16:26:24 +0000 (11:26 -0500)]
TailDuplication: Clear NoPHIs property

The early tail duplicator pass introduces new ones, so a MIR test that
infers no phis since there were none on the input would fail the
verifier after running.

4 years ago[VFS] Don't run symlink test on Windows, it may pass or fail
Reid Kleckner [Fri, 27 Dec 2019 18:37:07 +0000 (10:37 -0800)]
[VFS] Don't run symlink test on Windows, it may pass or fail

This test was XFAILed because of symlinks, but some versions of ln -s
seem to work on Windows, so the test was unexpectedly passing on our
bot:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13233
Unexpected Passing Tests (1):
    Clang :: VFS/subframework-symlink.m

I don't know how or why, but it seems dependent on system configuration,
and is not something worth debugging. Avoid the problem by marking the
test UNSUPPORTED: system-windows instead of XFAIL: system-windows.

4 years ago[compiler-rt] [netbsd] Add support for versioned statvfs interceptors
Kamil Rytarowski [Fri, 27 Dec 2019 00:12:44 +0000 (01:12 +0100)]
[compiler-rt] [netbsd] Add support for versioned statvfs interceptors

Summary:
Add support for NetBSD 9.0 and newer versions of interceptors
operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo,
getvfsstat, statvfs, statvfs1.

The default promoted interceptors are for NetBSD 9.99.26. Older
ones (currently 9.0) are kept in a new NetBSD specific file:
/sanitizer_common_interceptors_netbsd_compat.inc. This file
defines compat interceptors and mangles `INIT_*` macros,
concatenating the current interceptors and the compat ones.
This redefinition is not elegant, but it avoids preprocessor madness.

Define struct_statvfs90_sz for the compat purposes.

Reviewers: mgorny, kcc, vitalybuka, joerg

Reviewed By: mgorny

Subscribers: dberris, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

4 years ago[ConstantRange] Respect destination bitwidth for cast results.
Florian Hahn [Fri, 27 Dec 2019 17:38:18 +0000 (17:38 +0000)]
[ConstantRange] Respect destination bitwidth for cast results.

We returning a full set, we should use ResultBitWidth. Otherwise we might
it assertions when the resulting constant ranges are used later on.

Reviewers: nikic, spatel, reames

Reviewed By: nikic

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

4 years ago[OpenCL] Fixed printing of __private in AMDGPU test
Anastasia Stulova [Fri, 27 Dec 2019 17:07:48 +0000 (17:07 +0000)]
[OpenCL] Fixed printing of __private in AMDGPU test

Tags: #clang

4 years ago[OpenCL] Fix inconsistency between opencl and c11 atomic fetch max/min
Yaxun (Sam) Liu [Thu, 19 Dec 2019 20:27:02 +0000 (15:27 -0500)]
[OpenCL] Fix inconsistency between opencl and c11 atomic fetch max/min

There is some inconsistency between opencl and c11 atomic fetch max/min after

https://reviews.llvm.org/D46386

https://reviews.llvm.org/D55562

It is not reasonable to have such inconsistencies. This patch fixes that.

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

4 years ago[Matrix] Propagate and use shape info for binary operators.
Florian Hahn [Fri, 27 Dec 2019 15:44:00 +0000 (15:44 +0000)]
[Matrix] Propagate and use shape info for binary operators.

This patch extends the current shape propagation and shape aware
lowering to also support binary operators. Those operators are uniform
with respect to their shape (shape of the input operands is the same as
the shape of their result).

Reviewers: anemet, Gerolf, reames, hfinkel, andrew.w.kaylor

Reviewed By: anemet

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

4 years agoAllow newlines in AST Matchers in clang-query files
Stephen Kelly [Wed, 18 Dec 2019 22:35:46 +0000 (22:35 +0000)]
Allow newlines in AST Matchers in clang-query files

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[NFC][DA] Remove duplicate code in checkSrcSubscript and checkDstSubscript
Danilo Carvalho Grael [Fri, 27 Dec 2019 15:05:28 +0000 (10:05 -0500)]
[NFC][DA] Remove duplicate code in checkSrcSubscript and checkDstSubscript

Summary:
[DA] Move common code in checkSrcSubscript and checkDstSubscript to a
new function checkSubscript. This avoids duplicate code and possible
out of sync in the future.

Reviewers: sebpop, jmolloy, reames

Reviewed By: sebpop

Subscribers: bmahjour, hiraditya, llvm-commits, amehsan

Tags: #llvm

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

Patch by zhongduo.

4 years ago[OpenMP] Implementation of OMPT reduction callbacks
protze@itc.rwth-aachen.de [Fri, 27 Dec 2019 13:39:50 +0000 (14:39 +0100)]
[OpenMP] Implementation of OMPT reduction callbacks

Including two tests
These callbacks were added late to the 5.0 specification, an implementation is missing.

Reviewed By: jdoerfert

Differential Review: https://reviews.llvm.org/D70395

4 years ago[MLIR][spirv] Fix links in docs after repo migration
Lei Zhang [Fri, 27 Dec 2019 13:34:26 +0000 (08:34 -0500)]
[MLIR][spirv] Fix links in docs after repo migration

Summary:
This commit updates links to SPIR-V dialect code to LLVM monorepo
on GitHub. It also points to the operation doc on mlir.llvm.org.

Reviewers: mravishankar, denis13, ftynse

Reviewed By: ftynse

Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, llvm-commits

Tags: #llvm

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

4 years agoAMDGPU/GlobalISel: Fix extra result register in fdiv64 lowering
Matt Arsenault [Wed, 25 Dec 2019 12:48:37 +0000 (07:48 -0500)]
AMDGPU/GlobalISel: Fix extra result register in fdiv64 lowering

There ended up being two result registers, which would fail on
select. It was really defing a new temp register in the correct def
position, instead of the correct result register.

4 years agoAMDGPU/GlobalISel: Select some 128-bit load/stores
Matt Arsenault [Wed, 25 Dec 2019 14:43:02 +0000 (09:43 -0500)]
AMDGPU/GlobalISel: Select some 128-bit load/stores

4 years agoAMDGPU: Use correct DebugLoc
Matt Arsenault [Fri, 27 Dec 2019 13:28:30 +0000 (08:28 -0500)]
AMDGPU: Use correct DebugLoc

4 years ago[OpenCL] Pretty print __private addr space
Anastasia Stulova [Fri, 27 Dec 2019 13:38:48 +0000 (13:38 +0000)]
[OpenCL] Pretty print __private addr space

Add printing of __private address space to TypePrinter to allow
it appears in diagnostics and AST dumps as all other language
addr spaces.

Tags: #clang

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

4 years ago[lldb] Silent random xpass on aarch64-linux buildbot
Muhammad Omair Javaid [Fri, 27 Dec 2019 12:01:52 +0000 (17:01 +0500)]
[lldb] Silent random xpass on aarch64-linux buildbot

This patch adds skipif decorator to TestWatchLocationWithWatchSet.py.
Decorator will trigger for aarch64-linux as this test passes randomly
causing buildbot failure.

4 years ago[mlir] fix typo in a comment
wyzhao [Mon, 23 Dec 2019 08:11:29 +0000 (16:11 +0800)]
[mlir] fix typo in a comment

Trivial patch, reviewed and accepted on
https://github.com/tensorflow/mlir/pull/336 before MLIR merge.

4 years ago[MLIR] [NFC] fix unused var warning
Uday Bondhugula [Fri, 27 Dec 2019 11:04:09 +0000 (12:04 +0100)]
[MLIR] [NFC] fix unused var warning

Summary:
Fix this warning:
`
[69/106] Building CXX object tools/mlir/lib/Dialect/StandardOps/CMakeFiles/MLIRStandardOps.dir/Ops.cpp.o
/home/uday/llvm-project/mlir/lib/Dialect/StandardOps/Ops.cpp: In member function ‘virtual mlir::PatternMatchResult {anonymous}::ViewOpShapeFolder::matchAndRewrite(mlir::ViewOp, mlir::PatternRewriter&) const’:
/home/uday/llvm-project/mlir/lib/Dialect/StandardOps/Ops.cpp:2575:14: warning: variable ‘dynamicOffsetOperandCount’ set but not used [-Wunused-but-set-variable]
 2575 |     unsigned dynamicOffsetOperandCount = 0;
`

Reviewers: rriddle, mehdi_amini, ftynse

Reviewed By: ftynse

Subscribers: jpienaar, burmako, shauheen, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Floating constants for import-llvm
Alex Zinenko [Fri, 27 Dec 2019 09:54:01 +0000 (10:54 +0100)]
[mlir] Floating constants for import-llvm

Summary:
`mlir-translate -import-llvm test.ll`  was going into segmentation fault if `test.ll` had `float` or `double` constants.
For example,
```
%3 = fadd double 3.030000e+01, %0
```
Now, it is handled in `Importer::getConstantAsAttr` (similar behaviour as normal integers)
Added tests for FP arithmetic

Reviewers: ftynse, mehdi_amini

Reviewed By: ftynse, mehdi_amini

Subscribers: shauheen, mehdi_amini, rriddle, jpienaar, burmako, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Reformat `HoverTests.cpp` NFC
Ilya Biryukov [Fri, 27 Dec 2019 08:26:39 +0000 (09:26 +0100)]
[clangd] Reformat `HoverTests.cpp` NFC

I accidentally broke formatting in the previous revision.

4 years ago[X86] Allow v2i32->v2f32 strict and non-strict uint_to_fp to be widened to v4i32...
Craig Topper [Fri, 27 Dec 2019 08:15:45 +0000 (00:15 -0800)]
[X86] Allow v2i32->v2f32 strict and non-strict uint_to_fp to be widened to v4i32->v4f32 under avx512.

With avx512vl we get v4i32->v4f32 uint_to_fp instructions. With
avx512f we get v16i32->v16f32 instructions which we can use to
emulate v4i32->v4f32.

4 years ago[X86] Add v2i32->v2f32 non-strict sint_to_fp/uint_to_fp tests. NFC
Craig Topper [Fri, 27 Dec 2019 08:13:30 +0000 (00:13 -0800)]
[X86] Add v2i32->v2f32 non-strict sint_to_fp/uint_to_fp tests. NFC

4 years ago[X86] Custom widen v2i32->v2f32 strict_sint_to_fp to avoid scalarization.
Craig Topper [Fri, 27 Dec 2019 07:57:33 +0000 (23:57 -0800)]
[X86] Custom widen v2i32->v2f32 strict_sint_to_fp to avoid scalarization.

4 years ago[llvm-readobj][llvm-objdump][test] - Improve dynamic section testing.
Georgii Rymar [Thu, 26 Dec 2019 11:01:05 +0000 (14:01 +0300)]
[llvm-readobj][llvm-objdump][test] - Improve dynamic section testing.

This adds --strict-whitespace --match-full-lines flags to
improve the testing and reveal formatting issues we have.

Differential revision: https://reviews.llvm.org/D71895

4 years ago[clangd] Fix crash in hover
Ilya Biryukov [Fri, 27 Dec 2019 08:11:03 +0000 (09:11 +0100)]
[clangd] Fix crash in hover

4 years agoDelete llvm.{sig,}{setjmp,longjmp} remnant after r136821
Fangrui Song [Fri, 27 Dec 2019 07:32:53 +0000 (23:32 -0800)]
Delete llvm.{sig,}{setjmp,longjmp} remnant after r136821

  Intrinsic has incorrect argument type!
  i32 (i32*)* @llvm.setjmp

*wipes tear*

4 years ago[X86] Custom widen 128/256-bit vXi32 fp_to_uint on avx512f targets without avx512vl...
Craig Topper [Fri, 27 Dec 2019 05:46:29 +0000 (21:46 -0800)]
[X86] Custom widen 128/256-bit vXi32 fp_to_uint on avx512f targets without avx512vl. Similar for vXi64 on avx512dq without avx512vl.

Summary:
Previously we did this with isel patterns that used garbage in
the widened part of the source. But that's not valid for strictfp.
So now we custom widen and use zeroes for the widened elemens for
strictfp.

This replaces D71864.

Reviewers: RKSimon, spatel, andrew.w.kaylor, pengfei, LiuChen3

Reviewed By: pengfei

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86] Custom widen strict v2f32->v2i32 by padding with zeroes.
Craig Topper [Fri, 27 Dec 2019 05:25:22 +0000 (21:25 -0800)]
[X86] Custom widen strict v2f32->v2i32 by padding with zeroes.

For non-strict, generic type legalization will take care of this,
but that doesn't happen currently for strict nodes.

4 years ago[X86] Fix -Wmisleading-indentation after D71892
Fangrui Song [Fri, 27 Dec 2019 05:40:48 +0000 (21:40 -0800)]
[X86] Fix -Wmisleading-indentation after D71892

4 years ago[X86][FPEnv] Promote some float strictfp operations to double on i686-pc-windows...
Craig Topper [Fri, 27 Dec 2019 04:21:23 +0000 (20:21 -0800)]
[X86][FPEnv] Promote some float strictfp operations to double on i686-pc-windows-msvc to match what we do for non-strict.

The float libcalls are inlined in MSVC's math header where they
just cast to double and use the double libcall. Do the same when
we emit libcalls.

4 years ago[X86] Add tests for constrained float intrinsics on i686-pc-windows-msvc. NFC
Craig Topper [Fri, 27 Dec 2019 04:09:32 +0000 (20:09 -0800)]
[X86] Add tests for constrained float intrinsics on i686-pc-windows-msvc. NFC

We need to promote these to double due to missing libcalls on
Windows.

4 years ago[X86] Add custom legalization for strict_uint_to_fp v2i32->v2f32.
Craig Topper [Fri, 27 Dec 2019 01:27:44 +0000 (17:27 -0800)]
[X86] Add custom legalization for strict_uint_to_fp v2i32->v2f32.

I believe the algorithm we use for non-strict is exception safe
for strict. The fsub won't generate any exceptions. After it we
will have an exact version of the i32 integer in a double. Then
we just round it to f32. That rounding will generate a precision
exception if it can't be represented exactly.

4 years ago[X86] Add test cases for v2i32->v2f32 strict_sint_to_fp/strict_uint_to_fp. NFC
Craig Topper [Fri, 27 Dec 2019 00:41:42 +0000 (16:41 -0800)]
[X86] Add test cases for v2i32->v2f32 strict_sint_to_fp/strict_uint_to_fp. NFC

4 years agoAdd an __attribute__((unused)) to populateWithGenerated since it might
Eric Christopher [Fri, 27 Dec 2019 02:48:59 +0000 (18:48 -0800)]
Add an __attribute__((unused)) to populateWithGenerated since it might
not be used where defined and is autogenerated.

4 years agoTemporarily Revert "[compiler-rt] [netbsd] Add support for versioned statvfs intercep...
Eric Christopher [Fri, 27 Dec 2019 02:40:20 +0000 (18:40 -0800)]
Temporarily Revert "[compiler-rt] [netbsd] Add support for versioned statvfs interceptors"
as it's failing the netbsd specific linter parts of the sanitizer linter:

llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc:23:  Lines should be <= 80 characters long  [whitespace/line_length]
llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:2450:  Do not use variable-length arrays.  Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size.

This reverts commit 78f714f824fac8aa3fdd85908c41538bccefb959.

4 years agoFix a -Wcovered-switch-default warning by moving the unreachable out of the
Eric Christopher [Fri, 27 Dec 2019 02:34:41 +0000 (18:34 -0800)]
Fix a -Wcovered-switch-default warning by moving the unreachable out of the
covered switch.

4 years agoRemove an unused static function.
Eric Christopher [Fri, 27 Dec 2019 02:34:14 +0000 (18:34 -0800)]
Remove an unused static function.

4 years agoFix a -Wcovered-switch-default warning by moving the unreachable out of the
Eric Christopher [Fri, 27 Dec 2019 02:29:54 +0000 (18:29 -0800)]
Fix a -Wcovered-switch-default warning by moving the unreachable out of the
covered switch.

4 years agoRemove unused static function.
Eric Christopher [Fri, 27 Dec 2019 02:19:48 +0000 (18:19 -0800)]
Remove unused static function.

4 years agoRevert "Allow newlines in AST Matchers in clang-query files" + 1
Evgenii Stepanov [Fri, 27 Dec 2019 02:05:25 +0000 (18:05 -0800)]
Revert "Allow newlines in AST Matchers in clang-query files" + 1

Revert "Fix -Wunused-lambda-capture warnings."
This reverts commit 2369560f4a7720b19edfbf9de14ef061307ff773.
This reverts commit 522ee29a4fb3814db604b585c8637247477ec057.

clang/lib/ASTMatchers/Dynamic/Parser.cpp:610:13: warning: implicit conversion turns string literal into bool: 'const char [35]' to 'bool' [-Wstring-conversion]
    assert(!"Newline should never be found here");

4 years agoadd custom operation for strict fpextend/fpround
Liu, Chen3 [Thu, 26 Dec 2019 09:47:37 +0000 (17:47 +0800)]
add custom operation for strict fpextend/fpround

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

4 years ago[compiler-rt] [netbsd] Add support for versioned statvfs interceptors
Kamil Rytarowski [Fri, 27 Dec 2019 00:12:44 +0000 (01:12 +0100)]
[compiler-rt] [netbsd] Add support for versioned statvfs interceptors

Summary:
Add support for NetBSD 9.0 and newer versions of interceptors
operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo,
getvfsstat, statvfs, statvfs1.

The default promoted interceptors are for NetBSD 9.99.26. Older
ones (currently 9.0) are kept in a new NetBSD specific file:
/sanitizer_common_interceptors_netbsd_compat.inc. This file
defines compat interceptors and mangles `INIT_*` macros,
concatenating the current interceptors and the compat ones.
This redefinition is not elegant, but it avoids preprocessor madness.

Define struct_statvfs90_sz for the compat purposes.

Reviewers: mgorny, kcc, vitalybuka, joerg

Reviewed By: mgorny

Subscribers: dberris, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

4 years agoRemove SrcVT only used in an assert and propagate query.
Eric Christopher [Thu, 26 Dec 2019 23:28:32 +0000 (15:28 -0800)]
Remove SrcVT only used in an assert and propagate query.

4 years agoFix -Wunused-lambda-capture warnings.
Eric Christopher [Thu, 26 Dec 2019 23:27:21 +0000 (15:27 -0800)]
Fix -Wunused-lambda-capture warnings.

4 years agoMake lazyload_metadata.ll resilient to the addition of new metadata kinds
David Herzka [Thu, 26 Dec 2019 18:56:07 +0000 (13:56 -0500)]
Make lazyload_metadata.ll resilient to the addition of new metadata kinds

Summary: The specific number of records loaded depends on the number of kinds, but the difference between the lazy and not lazy cases does not.

Reviewers: modocache

Subscribers: llvm-commits, dexonsmith, steven_wu, hiraditya, mehdi_amini

Tags: #llvm

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

4 years ago[X86] Custom widen 128/256-bit vXi32 uint_to_fp on avx512f targets without avx512vl...
Craig Topper [Thu, 26 Dec 2019 22:43:33 +0000 (14:43 -0800)]
[X86] Custom widen 128/256-bit vXi32 uint_to_fp on avx512f targets without avx512vl. Similar for vXi64 sint_to_fp/uint_to_fp on avx512dq without avx512vl.

Previously we widened these through isel patterns, but that
didn't work for STRICT_ nodes. Those need to be padded with
zeroes in the upper bits which is harder to do in isel patterns.

4 years agoRevert "Make lazyload_metadata.ll resilient to the addition of new metadata kinds"
Reid Kleckner [Thu, 26 Dec 2019 22:29:11 +0000 (14:29 -0800)]
Revert "Make lazyload_metadata.ll resilient to the addition of new metadata kinds"

This reverts commit be4704bd41a4dd8bb5c4dd5a614744c69fb3cf8e.

This test fails on Windows without awk.

4 years ago[ELF][test] Fix dynamic-linker.s
Fangrui Song [Thu, 26 Dec 2019 21:44:31 +0000 (13:44 -0800)]
[ELF][test] Fix dynamic-linker.s

4 years agoAdd a clang-tidy configuration file for MLIR, it is using camelBack for naming at...
Mehdi Amini [Thu, 26 Dec 2019 21:41:25 +0000 (21:41 +0000)]
Add a clang-tidy configuration file for MLIR, it is using camelBack for naming at the moment

4 years ago[X86] Add custom widening for v2i32->v2f64 strict_uint_to_fp with AVX512F, but not...
Craig Topper [Thu, 26 Dec 2019 21:18:24 +0000 (13:18 -0800)]
[X86] Add custom widening for v2i32->v2f64 strict_uint_to_fp with AVX512F, but not AVX512VL.

Previously we were widening with isel patterns, but that wasn't
exception safe for strict FP. So now we widen to v4i32->v4f64
during type legalization. And then let op legalization further
widen to v8i32->v8f64.

The vec_int_to_fp.ll changes are caused by us no longer narrowing
extracts of strict_uint_to_fp to the v4i32->v2f64 instruction
without AVX512VL only to have isel rewiden it. Now we just keep
it wide throughout. So we don't have an opportunity to narrow
the load.

4 years ago[ELF] Improve the condition to create .interp
Fangrui Song [Mon, 3 Jun 2019 05:25:03 +0000 (05:25 +0000)]
[ELF] Improve the condition to create .interp

Similar to rL362355, but with the `!config->shared` guard.

(1) {gcc,clang} -fuse-ld=bfd -pie -fPIE -nostdlib a.c => .interp created
(2) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c => .interp not created
(3) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c a.so => .interp created

The inconsistency of (2) is due to the condition `!Config->SharedFiles.empty()`.
To make lld behave more like ld.bfd, we could change the condition to:

    config->hasDynSymTab && !config->dynamicLinker.empty() && script->needsInterpSection();

However, that would bring another inconsistency as can be observed with:

(4) {gcc,clang} -fuse-ld=bfd -no-pie -nostdlib a.c => .interp not created

4 years ago[X86] Add custom widening for v2f64->v2i32 strict_fp_to_uint with avx512f, but not...
Craig Topper [Thu, 26 Dec 2019 20:26:39 +0000 (12:26 -0800)]
[X86] Add custom widening for v2f64->v2i32 strict_fp_to_uint with avx512f, but not avx512vl.

AVX512F added instruction for vector fp_to_uint conversions. With
AVX512VL we can use a specific instruction that does v2f64->v4i32 with
zeroes in the 2 extra elements. For non-strict nodes without AVX512VL
we relied on type legalization to turn it to v4f64->v4i32 which would
later be widened by op legalization to v8f64->v8i32. But type legalization
doesn't currently widen strict nodes since it doesn't know how to
safely and efficiently pad the extra elements. But for X86 we know
padding with zeroes is safe and efficient so do that ourselves.

4 years agoAllow newlines in AST Matchers in clang-query files
Stephen Kelly [Wed, 18 Dec 2019 22:35:46 +0000 (22:35 +0000)]
Allow newlines in AST Matchers in clang-query files

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agoRevert "[msan] Check qsort input."
Evgenii Stepanov [Thu, 26 Dec 2019 20:27:29 +0000 (12:27 -0800)]
Revert "[msan] Check qsort input."

This change breaks LLVM bootstrap with ASan and MSan.

FAILED: lib/ToolDrivers/llvm-lib/Options.inc
OptParser.td:137:1: error: Option is equivalent to
def INPUT : Option<[], "<input>", KIND_INPUT>;
^
OptParser.td:137:1: error: Other defined here
def INPUT : Option<[], "<input>", KIND_INPUT>;

This reverts commit caa48a6b88aeed8ae80e6ddb1eae8c6a7cbe260b.

4 years agoRevert "Allow newlines in AST Matchers in clang-query files"
Stephen Kelly [Thu, 26 Dec 2019 20:16:23 +0000 (20:16 +0000)]
Revert "Allow newlines in AST Matchers in clang-query files"

This reverts commit 6a3ecf4dc7ec299394e71b3124df2b3a34ed4ac3.

4 years agoAllow newlines in AST Matchers in clang-query files
Stephen Kelly [Wed, 18 Dec 2019 22:35:46 +0000 (22:35 +0000)]
Allow newlines in AST Matchers in clang-query files

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agoMake lazyload_metadata.ll resilient to the addition of new metadata kinds
David Herzka [Thu, 26 Dec 2019 18:56:07 +0000 (13:56 -0500)]
Make lazyload_metadata.ll resilient to the addition of new metadata kinds

Summary: The specific number of records loaded depends on the number of kinds, but the difference between the lazy and not lazy cases does not.

Reviewers: modocache

Subscribers: llvm-commits, dexonsmith, steven_wu, hiraditya, mehdi_amini

Tags: #llvm

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

4 years ago[DebugInfo][SelectionDAG] Change order while transferring SDDbgValue to another node
Kristina Bessonova [Thu, 5 Dec 2019 20:26:21 +0000 (23:26 +0300)]
[DebugInfo][SelectionDAG] Change order while transferring SDDbgValue to another node

SelectionDAG::transferDbgValues() can 'reattach' SDDbgValue from one to
another node, but doesn't change its source order. If the destination node has
the order greater than the SDDbgValue, there are two possible issues
revealed later:

* If debug info is attached to an instruction that is the first definition
of a register, this ends up with a def-after-use and the debug info
gets 'undef' later.

* If MIR has another definition of a register above the debug info,
the debug info may represent a source variable incorrectly because
it appears (significantly) before an instruction corresponded
to this debug info.

So, the patch changes the order of an SDDbgValue when it is moved
to a node with greater order.

Reviewers: dblaikie, jmorse, aprantl

Reviewed By: aprantl

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ELF] Support input section description .gnu.version* in /DISCARD/
Fangrui Song [Sun, 22 Dec 2019 22:50:14 +0000 (14:50 -0800)]
[ELF] Support input section description .gnu.version* in /DISCARD/

Linux powerpc discards `*(.gnu.version*)` (arch/powerpc/kernel/vmlinux.lds.S)
to suppress --orphan-handling=warn warnings in the -pie output `.tmp_vmlinux1`

The support is simple. Just add isLive() to:

1) Fix an assertion in SectionBase::getPartition() called by VersionTableSection::isNeeded().
2) Suppress DT_VERSYM, DT_VERDEF, DT_VERNEED and DT_VERNEEDNUM, if the relevant section is discarded.

Reviewed By: grimar

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

4 years ago[Attributor] Add helper to change an instruction to `unreachable` inst
Hideto Ueno [Thu, 26 Dec 2019 17:39:37 +0000 (02:39 +0900)]
[Attributor] Add helper to change an instruction to `unreachable` inst

Summary: Calling `changeToUnreachable` in `manifest` from different places might cause really unpredictable problems. As other deleting functions are doing, we need to change these instructions after all `manifest`.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[BPF] Enable relocation location for load/store/shifts
Yonghong Song [Thu, 19 Dec 2019 23:21:53 +0000 (15:21 -0800)]
[BPF] Enable relocation location for load/store/shifts

Previous btf field relocation is always at assignment like
   r1 = 4
which is converted from an ld_imm64 instruction.

This patch did an optimization such that relocation
instruction might be load/store/shift. Specically, the
following insns may also have relocation, except BPF_MOV:
  LDB, LDH, LDW, LDD, STB, STH, STW, STD,
  LDB32, LDH32, LDW32, STB32, STH32, STW32,
  SLL, SRL, SRA

To accomplish this, a few BPF target specific
codegen only instructions are invented. They
are generated at backend BPF SimplifyPatchable phase,
which is at early llc phase when SSA form is available.
The new codegen only instructions will be converted to
real proper instructions at the codegen and BTF emission stage.

Note that, as revealed by a few tests, this optimization might
be actual generating more relocations:
Scenario 1:
  if (...) {
    ... __builtin_preserve_field_info(arg->b2, 0) ...
  } else {
    ... __builtin_preserve_field_info(arg->b2, 0) ...
  }
  Compiler could do CSE to only have one relocation. But if both
  of the above is translated into codegen internal instructions,
  the compiler will not be able to do that.
Scenario 2:
  offset = ... __builtin_preserve_field_info(arg->b2, 0) ...
  ...
  ...  offset ...
  ...  offset ...
  ...  offset ...
  For whatever reason, the compiler might be temporarily do copy
  propagation of the righthand of "offset" assignment like
  ...  __builtin_preserve_field_info(arg->b2, 0) ...
  ...  __builtin_preserve_field_info(arg->b2, 0) ...
  and CSE will be able to deduplicate later.
  But if these intrinsics are converted to BPF pseudo instructions,
  they will not be able to get deduplicated.

I do not expect we have big instruction count difference.
It may actually reduce instruction count since now relocation
is in deeper insn dependency chain.
For example, for test offset-reloc-fieldinfo-2.ll, this patch
generates 7 instead of 6 relocations for non-alu32 mode, but it
actually reduced instruction count from 29 to 26.

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

4 years ago[OpenMP][NFCI] Use the libFrontend ProcBindKind in Clang
Johannes Doerfert [Thu, 26 Dec 2019 00:15:36 +0000 (18:15 -0600)]
[OpenMP][NFCI] Use the libFrontend ProcBindKind in Clang

This removes the OpenMPProcBindClauseKind enum in favor of
llvm::omp::ProcBindKind which lives in OpenMPConstants.h and was
introduced in D70109.

No change in behavior is expected.

Reviewed By: JonChesterfield

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

4 years ago[X86] Merge the SINT_TO_FP/UINT_TO_FP handlers in ReplaceNodeResults since the AVX512...
Craig Topper [Thu, 26 Dec 2019 08:23:31 +0000 (00:23 -0800)]
[X86] Merge the SINT_TO_FP/UINT_TO_FP handlers in ReplaceNodeResults since the AVX512DQ+AVX512VL code is very similar in both. NFC

4 years ago[X86] Add custom lowering for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp for...
Craig Topper [Thu, 26 Dec 2019 08:04:37 +0000 (00:04 -0800)]
[X86] Add custom lowering for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp for avx512dq+avx512vl targets.

With avx512dq+avx512vl we have instruction that implements this and
places zeroes in the upper 64-bits of the destination xmm register.

4 years ago[X86] Add test cases for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp.
Craig Topper [Thu, 26 Dec 2019 07:46:05 +0000 (23:46 -0800)]
[X86] Add test cases for v2i64->v2f32 strict_sint_to_fp/strict_uint_to_fp.

4 years ago[X86] Add avx512f and avx512dq+vl command lines to the vector strictfp int<->fp tests.
Craig Topper [Thu, 26 Dec 2019 07:34:32 +0000 (23:34 -0800)]
[X86] Add avx512f and avx512dq+vl command lines to the vector strictfp int<->fp tests.

4 years agoPartially revert "Add initial tests for update_{llc_,cc_,}test_checks.py"
Reid Kleckner [Thu, 26 Dec 2019 16:46:29 +0000 (08:46 -0800)]
Partially revert "Add initial tests for update_{llc_,cc_,}test_checks.py"

This reverts part of commit 240aff80e0e59b79779d046b3275904fc0750d59.
It reverts cc802ea67beb66d2f8a935e647c3aedcf7848211.

We currently run LLVM tests in environments where python3 exists on
PATH, but it is broken. I don't think PATH discovery is a strong enough
signal that a working Python 3 installation exists.

If this will be the way forward, IMO we should follow the direction of
debug-info-tests, and use CMake's PYTHON_EXECUTABLE, which in the near
future will be a known-to-work Python 3 executable. If it's not Python
3, then we don't have to run this test.

4 years ago[libcxx] Fix a typo in config.py
Sergej Jaskiewicz [Thu, 26 Dec 2019 09:31:12 +0000 (12:31 +0300)]
[libcxx] Fix a typo in config.py

Reviewers: ldionne, jroelofs, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[lldb][test] Don't include "test_common.h" in the debug macros test
Tatyana Krasnukha [Thu, 26 Dec 2019 15:21:30 +0000 (18:21 +0300)]
[lldb][test] Don't include "test_common.h" in the debug macros test

GCC produces incorrect .debug_macro section when "-include" option is used:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93075.

4 years ago[lldb] Specify unsigned underlying type for an enumeration explicitly
Tatyana Krasnukha [Thu, 26 Dec 2019 12:48:50 +0000 (15:48 +0300)]
[lldb] Specify unsigned underlying type for an enumeration explicitly

The enumeration EntryType is used as a bit field of DebugMacroEntry:
```
  EntryType m_type : 3
```

Since underlying type of enumeration is implementation-dependent, a signed integer is
converted to the 3-bit value by some compilers (MSVC).

That's why a DebugMacroEntry instance that was created with EntryType value > 3 (END_FILE or INDIRECT)
contains incorrect negative value in its m_type data-member.

4 years ago[lldb][NFC] Move lock scope where it should begin
Tatyana Krasnukha [Thu, 26 Dec 2019 12:31:14 +0000 (15:31 +0300)]
[lldb][NFC] Move lock scope where it should begin

4 years ago[lldb][NFC] Add "lldb-vscode" to all_categories
Tatyana Krasnukha [Wed, 11 Dec 2019 14:34:55 +0000 (17:34 +0300)]
[lldb][NFC] Add "lldb-vscode" to all_categories

Required to make the category manually disableable.

4 years ago[lldb][NFC] Simplify if-return
Tatyana Krasnukha [Wed, 11 Dec 2019 14:16:38 +0000 (17:16 +0300)]
[lldb][NFC] Simplify if-return

4 years ago[lldb][tests] Platform triple can be None
Tatyana Krasnukha [Tue, 10 Dec 2019 15:00:50 +0000 (18:00 +0300)]
[lldb][tests] Platform triple can be None

If a remote target is not connected, SBPlatform's GetTriple function returns None.

4 years ago[lldb][tests] Posix function strdup requires macro _POSIX_C_SOURCE
Tatyana Krasnukha [Fri, 29 Nov 2019 11:11:39 +0000 (14:11 +0300)]
[lldb][tests] Posix function strdup requires macro _POSIX_C_SOURCE

4 years ago[lldb][NFC] Use ClangASTContext in AppleObjCRuntime interfaces
Raphael Isemann [Thu, 26 Dec 2019 13:52:43 +0000 (14:52 +0100)]
[lldb][NFC] Use ClangASTContext in AppleObjCRuntime interfaces

This code actually needs a ClangASTContext but instead takes a
clang::ASTContext and then retrieves the original ClangASTContext
via the global map of ClangASTContexts. Let's change it so
that it takes a ClangASTContext which is simpler and faster.

4 years ago[compiler-rt] Disable QSORT interception on watchOS and tvOS.
Florian Hahn [Thu, 26 Dec 2019 09:37:08 +0000 (10:37 +0100)]
[compiler-rt] Disable QSORT interception on watchOS and tvOS.

Building the sanitizers for watchOS currently fails with
    sanitizer_common_interceptors.inc:9656:8: error: thread-local storage is not supported for the current target
    static THREADLOCAL SIZE_T qsort_size;

I've also speculatively disabled QSORT interception for tvOS to unblock
failing builds. I'll ask someone with more sanitizer knowledge to check
after the holidays.

4 years ago[lldb] Remove some calls to GetASTContext
Raphael Isemann [Wed, 25 Dec 2019 22:43:52 +0000 (23:43 +0100)]
[lldb] Remove some calls to GetASTContext

GetASTContext is really expensive to call as it makes use of the global
mapping from ASTContext to ClangASTContext. This replaces all calls where
we already have the ClangASTContext around and don't need to call
GetASTContext again.

4 years ago[clang][test] Minor fixes in testcase absolute-paths-symlinks.c
Karl-Johan Karlsson [Thu, 26 Dec 2019 08:30:08 +0000 (09:30 +0100)]
[clang][test] Minor fixes in testcase absolute-paths-symlinks.c

This is a follow up commit to address post-commit comment in D70527.

4 years agoFix the MLIR Vim syntax file: the keyword group was missing
chelxom [Fri, 20 Dec 2019 15:02:11 +0000 (23:02 +0800)]
Fix the MLIR Vim syntax file: the keyword group was missing

4 years ago[PowerPC] stop folding if result rlwinm mask is wrap while original rlwinm is not.
czhengsz [Thu, 26 Dec 2019 02:52:56 +0000 (21:52 -0500)]
[PowerPC] stop folding if result rlwinm mask is wrap while original rlwinm is not.

%1:g8rc = RLWINM8 %0:g8rc, 0, 16, 9
%2:g8rc = RLWINM8 killed %1:g8rc, 0, 0, 31
->
%2:g8rc = RLWINM8 %0:g8rc, 0, 16, 9

The above folding is wrong. Before transformation, %2:g8rc is 32 bit value. After
transformation, %2:g8rc becomes a 64 bit value.
This patch fixes above issue.

Reviewed by: steven.zhang

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

4 years ago[Bitstream] Delete skipAbbreviatedField which duplicates readAbbreviatedField
Fangrui Song [Thu, 26 Dec 2019 02:40:21 +0000 (18:40 -0800)]
[Bitstream] Delete skipAbbreviatedField which duplicates readAbbreviatedField

4 years ago[NFC][PowerPC] Add a function tryAndWithMask to handle all the cases
QingShan Zhang [Thu, 26 Dec 2019 02:48:30 +0000 (02:48 +0000)]
[NFC][PowerPC] Add a function tryAndWithMask to handle all the cases
that 'and' with constant

More patches will be committed later to exploit more about 'and' with
constant.

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