platform/upstream/llvm.git
4 years ago[lldb] [testsuite] TestGdbRemoteLibrariesSvr4Support: Fix symlinked builddir
Jan Kratochvil [Sun, 9 Feb 2020 13:49:38 +0000 (14:49 +0100)]
[lldb] [testsuite] TestGdbRemoteLibrariesSvr4Support: Fix symlinked builddir

When I have symlinked builddir on Fedora 31 x86_64 I get:

FAIL: test_libraries_svr4_libs_present (TestGdbRemoteLibrariesSvr4Support.TestGdbRemoteLibrariesSvr4Support)
----------------------------------------------------------------------
...
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py", line 106, in
libraries_svr4_libs_present
    self.assertIn(self.getBuildDir() + "/" + lib, libraries_svr4_names)
AssertionError:
'/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_a.so' not found in ['/home/jkratoch/redhat/llvm-monorepo/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/linux-vdso.so.1', '/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_a.so', '/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_b".so', '/usr/lib64/libdl-2.30.so', '/usr/lib64/libstdc++.so.6.0.27', '/usr/lib64/libm-2.30.so', '/usr/lib64/libgcc_s-9-20190827.so.1', '/usr/lib64/libc-2.30.so', '/usr/lib64/ld-2.30.so']
Config=x86_64-/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/bin/clang-11
----------------------------------------------------------------------

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

4 years agoFix signed/unsigned warning.
Simon Pilgrim [Sun, 9 Feb 2020 13:35:03 +0000 (13:35 +0000)]
Fix signed/unsigned warning.

4 years ago[X86] Recognise ROTLI/ROTRI rotations as faux shuffles
Simon Pilgrim [Sun, 9 Feb 2020 12:25:19 +0000 (12:25 +0000)]
[X86] Recognise ROTLI/ROTRI rotations as faux shuffles

Allows us to combine rotations with shuffles.

One of many things necessary to fix PR44379 (lowering shuffles to rotations)

4 years ago[LoopExtractor] Convert LoopExtractor from LoopPass to ModulePass
Ehud Katz [Sun, 9 Feb 2020 10:25:21 +0000 (12:25 +0200)]
[LoopExtractor] Convert LoopExtractor from LoopPass to ModulePass

The LoopExtractor created new functions (by definition), which violates
the restrictions of a LoopPass.
The correct implementation of this pass should be as a ModulePass.
Includes reverting rL82990 implications on the LoopExtractor.

Fixes PR3082 and PR8929.

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

4 years ago[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine...
Ayman Musa [Tue, 28 Jan 2020 14:31:44 +0000 (16:31 +0200)]
[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine for SELECT.

4 years agoSupport -fstack-clash-protection for x86
serge_sans_paille [Mon, 9 Sep 2019 14:59:34 +0000 (16:59 +0200)]
Support -fstack-clash-protection for x86

Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a357a8f685b3540246c5d762734e035f with proper LiveIn
declaration, better option handling and more portable testing.

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

4 years agoRevert "Support -fstack-clash-protection for x86"
serge-sans-paille [Sun, 9 Feb 2020 09:06:31 +0000 (10:06 +0100)]
Revert "Support -fstack-clash-protection for x86"

This reverts commit 0fd51a4554f5f4f90342f40afd35b077f6d88213.

Failures:

http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/4354

4 years agoSupport -fstack-clash-protection for x86
serge_sans_paille [Mon, 9 Sep 2019 14:59:34 +0000 (16:59 +0200)]
Support -fstack-clash-protection for x86

Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a357a8f685b3540246c5d762734e035f with proper LiveIn
declaration, better option handling and more portable testing.

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

4 years ago[ELF][test] Use llvm-readelf -l instead of llvm-readobj -l for some memory region...
Fangrui Song [Sun, 9 Feb 2020 06:39:09 +0000 (22:39 -0800)]
[ELF][test] Use llvm-readelf -l instead of llvm-readobj -l for some memory region tests

4 years ago[mlir][GPUToSPIRV] Modify the lowering of gpu.block_dim to be consistent with Vulkan...
MaheshRavishankar [Sun, 9 Feb 2020 02:23:09 +0000 (18:23 -0800)]
[mlir][GPUToSPIRV] Modify the lowering of gpu.block_dim to be consistent with Vulkan SPEC

The existing lowering of gpu.block_dim added a global variable with
the WorkGroupSize decoration. This raises an error within
Vulkan/SPIR-V validation since Vulkan requires this to have a constant
initializer. This is not yet supported in SPIR-V dialect. Changing the
lowering to return the workgroup size as a constant value instead,
obtained from spv.entry_point_abi attribute gets around the issue for
now. The validation goes through since the workgroup size is specified
using spv.execution_mode operation.

4 years ago[X86] Add more scalar intrinsic instructions to isNonFoldablePartialRegisterLoad.
Craig Topper [Sun, 9 Feb 2020 02:56:17 +0000 (18:56 -0800)]
[X86] Add more scalar intrinsic instructions to isNonFoldablePartialRegisterLoad.

I think this covers most if not all of the scalar intrinsic
instructions.

4 years ago[Attributor] Add an Attributor CGSCC pass and run it
Johannes Doerfert [Wed, 27 Nov 2019 06:30:12 +0000 (00:30 -0600)]
[Attributor] Add an Attributor CGSCC pass and run it

In addition to the module pass, this patch introduces a CGSCC pass that
runs the Attributor on a strongly connected component of the call graph
(both old and new PM). The Attributor was always design to be used on a
subset of functions which makes this patch mostly mechanical.

The one change is that we give up `norecurse` deduction in the module
pass in favor of doing it during the CGSCC pass. This makes the
interfaces simpler but can be revisited if needed.

Reviewed By: hfinkel

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

4 years agoFix -Wunused-lambda-capture for -DLLVM_ENABLE_ASSERTIONS=off builds after 6556c615f3c...
Fangrui Song [Sun, 9 Feb 2020 03:01:17 +0000 (19:01 -0800)]
Fix -Wunused-lambda-capture for -DLLVM_ENABLE_ASSERTIONS=off builds after 6556c615f3c3aae8af876806777065961ae20024

4 years ago[FIX] Ordering problem accidentally introduced with D72304
Johannes Doerfert [Sun, 9 Feb 2020 02:14:01 +0000 (20:14 -0600)]
[FIX] Ordering problem accidentally introduced with D72304

4 years ago[X86] Add the recently added (V)CVTSS2SI/CVTSD2SI instructions used for LRINT/LLRINT...
Craig Topper [Sun, 9 Feb 2020 01:46:59 +0000 (17:46 -0800)]
[X86] Add the recently added (V)CVTSS2SI/CVTSD2SI instructions used for LRINT/LLRINT to the load folding tables.

4 years ago[FIX] Fix warning in LazyCallGraphTest caused by D70927
Johannes Doerfert [Sun, 9 Feb 2020 00:58:16 +0000 (18:58 -0600)]
[FIX] Fix warning in LazyCallGraphTest caused by D70927

4 years ago[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.
fady [Sun, 9 Feb 2020 00:54:08 +0000 (18:54 -0600)]
[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

Add support for Master and Critical directive in the OMPIRBuilder. Both make use of a new common interface for emitting inlined OMP regions called `emitInlinedRegion` which was added in this patch as well.

Also this patch modifies clang to use the new directives when  `-fopenmp-enable-irbuilder` commandline option is passed.

Reviewed By: jdoerfert

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

4 years ago[OpenMP][Opt] Delete terminating and read-only parallel regions
Johannes Doerfert [Sun, 9 Feb 2020 00:42:24 +0000 (18:42 -0600)]
[OpenMP][Opt] Delete terminating and read-only parallel regions

Parallel regions known to be read-only, e.g., after we removed all dead
write accesses, and terminating (`willreturn`) can be removed.

Reviewed By: JonChesterfield

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

4 years ago[OpenMP][Opt] Annotate known runtime functions and deduplicate more
Johannes Doerfert [Sun, 9 Feb 2020 00:03:40 +0000 (18:03 -0600)]
[OpenMP][Opt] Annotate known runtime functions and deduplicate more

This adds ~27 more runtime calls to the OpenMPKinds.def file, all with
attributes. We deduplicate 16 of those automatically in function =
thread scope. And we annotate all of them automatically during the
OpenMPOpt discovery step. A test with all omp_XXXX runtime calls to
track annotation coverage is included.

Reviewed By: JonChesterfield

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

4 years ago[gn build] (manually) port 72277ecd62e and the LLVMBuild bit of 9548b74a83
Nico Weber [Sat, 8 Feb 2020 23:50:51 +0000 (18:50 -0500)]
[gn build] (manually) port 72277ecd62e and the LLVMBuild bit of 9548b74a83

4 years ago[X86] Use any_fadd/sub/mul/div/sqrt with the AVX512 scalar_*_patterns.
Craig Topper [Sat, 8 Feb 2020 23:52:57 +0000 (15:52 -0800)]
[X86] Use any_fadd/sub/mul/div/sqrt with the AVX512 scalar_*_patterns.

Making sure not to use them with patterns for masked instructions.

Also fix FMA patterns that were matching strict_fma+x86selects to
masked instructions.

4 years ago[mlir][DeclarativeParser] Move several missed parsers over to the declarative form.
River Riddle [Sat, 8 Feb 2020 23:46:02 +0000 (15:46 -0800)]
[mlir][DeclarativeParser] Move several missed parsers over to the declarative form.

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

4 years ago[mlir][DeclarativeParser] Add support for attributes with buildable types.
River Riddle [Sat, 8 Feb 2020 18:01:17 +0000 (10:01 -0800)]
[mlir][DeclarativeParser] Add support for attributes with buildable types.

This revision adds support in the declarative assembly form for printing attributes with buildable types without the type, and moves several more parsers over to the declarative form.

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

4 years ago[mlir][quantizer] Add gathering of per-axis statistics in quantizer.
Dmitry Murygin [Sat, 8 Feb 2020 23:07:35 +0000 (15:07 -0800)]
[mlir][quantizer] Add gathering of per-axis statistics in quantizer.

Reviewers: stellaraccident, nicolasvasilache

Reviewed By: stellaraccident

Subscribers: Joonsoo, merge_guards_bot, denis13

Tags: #llvm

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

4 years ago[mlir] Add support for generating debug locations from intermediate levels of the IR.
River Riddle [Sat, 8 Feb 2020 23:01:34 +0000 (15:01 -0800)]
[mlir] Add support for generating debug locations from intermediate levels of the IR.

Summary:
This revision adds a utility to generate debug locations from the IR during compilation, by snapshotting to a output stream and using the locations that operations were dumped in that stream. The new locations may either;
* Replace the original location of the operation.

old:
   loc("original_source.cpp":1:1)
new:
   loc("snapshot_source.mlir":10:10)

* Fuse with the original locations as NamedLocs with a specific tag.

old:
    loc("original_source.cpp":1:1)
new:
    loc(fused["original_source.cpp":1:1, "snapshot"("snapshot_source.mlir":10:10)])

This feature may be used by a debugger to display the code at various different levels of the IR. It would also be able to show the different levels of IR attached to a specific source line in the original source file.

This feature may also be used to generate locations for operations generated during compilation, that don't necessarily have a user source location to attach to.

This requires changes in the printer to track the locations of operations emitted in the stream. Moving forward we need to properly(and efficiently) track the number of newlines emitted to the stream during printing.

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

4 years ago[gn build] Add OpenMPOpt.cpp to LLVMipo after D69930/9548b74a831e
Fangrui Song [Sat, 8 Feb 2020 22:18:43 +0000 (14:18 -0800)]
[gn build] Add OpenMPOpt.cpp to LLVMipo after D69930/9548b74a831e

4 years ago[ELF] Simplify parsing of version dependency. NFC
Fangrui Song [Sat, 8 Feb 2020 22:10:29 +0000 (14:10 -0800)]
[ELF] Simplify parsing of version dependency. NFC

4 years agoFix test name typo
Simon Pilgrim [Sat, 8 Feb 2020 21:24:01 +0000 (21:24 +0000)]
Fix test name typo

4 years ago[InstCombine] Refactor foldICmpAndShift(); NFCI
Nikita Popov [Sat, 8 Feb 2020 19:41:10 +0000 (20:41 +0100)]
[InstCombine] Refactor foldICmpAndShift(); NFCI

Separate out handling for shl, lshr and ashr. The combined handling
obscured some overly pessimistic requirements for the transform.

4 years ago[FIX] Update PM tests after D69930 landed
Johannes Doerfert [Sat, 8 Feb 2020 21:22:03 +0000 (15:22 -0600)]
[FIX] Update PM tests after D69930 landed

4 years ago[X86][SSE] Add test cases from PR44379
Simon Pilgrim [Sat, 8 Feb 2020 21:02:04 +0000 (21:02 +0000)]
[X86][SSE] Add test cases from PR44379

4 years ago[X86] Test showing inability to combine ROTLI/ROTRI rotations into shuffles
Simon Pilgrim [Sat, 8 Feb 2020 20:44:41 +0000 (20:44 +0000)]
[X86] Test showing inability to combine ROTLI/ROTRI rotations into shuffles

One of many things necessary to fix PR44379 (lowering shuffles to rotations)

4 years ago[OpenMP] Introduce the OpenMPOpt transformation pass
Johannes Doerfert [Thu, 7 Nov 2019 05:20:06 +0000 (23:20 -0600)]
[OpenMP] Introduce the OpenMPOpt transformation pass

The OpenMPOpt pass is a CGSCC pass in which OpenMP specific
optimizations can reside.

The OpenMPOpt pass uses the OpenMPKinds.def file to identify runtime
calls and their uses. This allows targeted transformations and eases
their implementation.

This initial patch deduplicates `__kmpc_global_thread_num` and
`omp_get_thread_num` calls. We can also identify arguments that are
equivalent to such a call result and use it instead. Later we can
determine "gtid" arguments based on the use in kernel functions etc.

Reviewed By: JonChesterfield

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

4 years agoIntroduce a CallGraph updater helper class
Johannes Doerfert [Fri, 29 Nov 2019 19:11:24 +0000 (13:11 -0600)]
Introduce a CallGraph updater helper class

The CallGraphUpdater is a helper that simplifies the process of updating
the call graph, both old and new style, while running an CGSCC pass.

The uses are contained in different commits, e.g. D70767.

More functionality is added as we need it.

Reviewed By: modocache, hfinkel

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

4 years ago[SimplifyLibCalls] Add __strlen_chk.
George Burgess IV [Wed, 5 Feb 2020 06:10:39 +0000 (22:10 -0800)]
[SimplifyLibCalls] Add __strlen_chk.

Bionic has had `__strlen_chk` for a while. Optimizing that into a
constant is quite profitable, when possible.

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

4 years ago[InstCombine] Fix infinite min/max canonicalization loop (PR44541)
Nikita Popov [Sun, 2 Feb 2020 16:40:15 +0000 (17:40 +0100)]
[InstCombine] Fix infinite min/max canonicalization loop (PR44541)

While D72944 also fixes https://bugs.llvm.org/show_bug.cgi?id=44541,
it does so in a more roundabout manner and there might be other
loopholes to trigger the same issue. This is a more direct fix,
that prevents the transform if the min/max is based on a
non-canonical sub X, 0 instruction.

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

4 years ago[mlir] Add a utility method on CallOpInterface for resolving the callable.
River Riddle [Sat, 8 Feb 2020 18:44:15 +0000 (10:44 -0800)]
[mlir] Add a utility method on CallOpInterface for resolving the callable.

Summary: This is the most common operation performed on a CallOpInterface. This just moves the existing functionality from the CallGraph so that other users can access it.

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

4 years ago[mlir][EDSC] NFC - Move StructuredIndexed and IteratorType out of Linalg
Nicolas Vasilache [Sat, 8 Feb 2020 16:16:22 +0000 (11:16 -0500)]
[mlir][EDSC] NFC - Move StructuredIndexed and IteratorType out of Linalg

Summary:
This NFC revision will allow those classes to be reused to allow
building structured vector operations.

Reviewers: aartbik, ftynse

Subscribers: arphaman, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Add a document detailing the design of the SymbolTable.
River Riddle [Sat, 8 Feb 2020 18:40:00 +0000 (10:40 -0800)]
[mlir] Add a document detailing the design of the SymbolTable.

Summary: This document provides insight on the rationale and the design of Symbols in MLIR, and why they are necessary.

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

4 years ago[LegalizeTypes][ARM][AArch64][PowerPC][RISCV][X86] Use BUILD_PAIR to return expanded...
Craig Topper [Sat, 8 Feb 2020 07:23:42 +0000 (23:23 -0800)]
[LegalizeTypes][ARM][AArch64][PowerPC][RISCV][X86] Use BUILD_PAIR to return expanded integer results from ReplaceNodeResults instead of just returning two results.

Remove code from LegalizeTypes that allowed this to work.

We were already using BUILD_PAIR for this in some places so this
standardizes on a single way to do this.

4 years ago[X86] X86InstComments - add FMA4 comments
Simon Pilgrim [Sat, 8 Feb 2020 17:01:04 +0000 (17:01 +0000)]
[X86] X86InstComments - add FMA4 comments

These typically match the FMA3 equivalents, although the multiply operands sometimes get flipped due to the FMA3 permute variants.

4 years ago[X86] Standardize BROADCAST enum names (PR31079)
Simon Pilgrim [Sat, 8 Feb 2020 16:54:46 +0000 (16:54 +0000)]
[X86] Standardize BROADCAST enum names (PR31079)

Tweak EVEX implementation names so it matches the other variants by adding the 'r' prefix. Oddly some of the subvec broadcast ops already matched.

4 years ago[InstCombine] Remove unnecessary worklist push; NFCI
Nikita Popov [Sat, 8 Feb 2020 16:08:42 +0000 (17:08 +0100)]
[InstCombine] Remove unnecessary worklist push; NFCI

This is no longer needed after d4627b90a0462c90a834c2f7b9c9228b3ec7a45b,
should have dropped it there...

4 years ago[InstCombine] Avoid modifying instructions in-place
Nikita Popov [Sat, 8 Feb 2020 16:02:10 +0000 (17:02 +0100)]
[InstCombine] Avoid modifying instructions in-place

As discussed on D73919, this replaces a few cases where we were
modifying multiple operands of instructions in-place with the
creation of a new instruction, which we generally prefer nowadays.

This tends to be more readable and less prone to worklist management
bugs.

Test changes are only superficial (instruction naming and order).

4 years ago[InstCombine] Use swapValues(); NFC
Nikita Popov [Sat, 8 Feb 2020 15:57:28 +0000 (16:57 +0100)]
[InstCombine] Use swapValues(); NFC

Less code, and makes it more obvious that these operands do not
need to be added back to the worklist.

4 years ago[InstCombine] Fix infinite loop in min/max load/store bitcast combine (PR44835)
Nikita Popov [Sat, 8 Feb 2020 11:04:58 +0000 (12:04 +0100)]
[InstCombine] Fix infinite loop in min/max load/store bitcast combine (PR44835)

Fixes https://bugs.llvm.org/show_bug.cgi?id=44835. Skip the transform
if it wouldn't actually do anything (apart from removing and reinserting
the same instructions).

Note that the test case doesn't loop on current master anymore, only
on the LLVM 10 release branch. The issue is already mitigated on master
due to worklist order fixes, but we should fix the root cause there as well.

As a side note, we should probably assert in combineLoadToNewType()
that it does not combine to the same type. Not doing this here, because
this assertion would also be triggered in another place right now.

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

4 years agoRegenerate FMA tests
Simon Pilgrim [Sat, 8 Feb 2020 14:31:06 +0000 (14:31 +0000)]
Regenerate FMA tests

4 years agoAdd missing encoding comments from fma scalar folded intrinsics tests
Simon Pilgrim [Sat, 8 Feb 2020 14:01:36 +0000 (14:01 +0000)]
Add missing encoding comments from fma scalar folded intrinsics tests

4 years agoPut back makeArrayRef to make GCC 5 happy
Benjamin Kramer [Sat, 8 Feb 2020 15:15:09 +0000 (16:15 +0100)]
Put back makeArrayRef to make GCC 5 happy

4 years ago[X86] Standardize VPSLLDQ/VPSRLDQ enum names (PR31079)
Simon Pilgrim [Sat, 8 Feb 2020 14:51:10 +0000 (14:51 +0000)]
[X86] Standardize VPSLLDQ/VPSRLDQ enum names (PR31079)

Tweak EVEX implementation names so it matches the other variants

4 years agoDrop some uses of StringLiteral in favor of StringRef
Benjamin Kramer [Sat, 8 Feb 2020 14:45:09 +0000 (15:45 +0100)]
Drop some uses of StringLiteral in favor of StringRef

StringRef can be used in constexpr contexts, so StringLiteral isn't
necessary anymore.

4 years agoRevert "Support -fstack-clash-protection for x86"
serge-sans-paille [Sat, 8 Feb 2020 13:26:22 +0000 (14:26 +0100)]
Revert "Support -fstack-clash-protection for x86"

This reverts commit e229017732bcf1911210903ee9811033d5588e0d.

Failures:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/2604
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/4308

4 years agoRevert "[ARM] Improve codegen of volatile load/store of i64"
Victor Campos [Sat, 8 Feb 2020 11:59:46 +0000 (11:59 +0000)]
Revert "[ARM] Improve codegen of volatile load/store of i64"

This reverts commit 60e0120c913dd1d4bfe33769e1f000a076249a42.

4 years ago[DebugInfo] Allow reading an address table with a mismatched address.
Igor Kudrin [Thu, 6 Feb 2020 10:08:20 +0000 (17:08 +0700)]
[DebugInfo] Allow reading an address table with a mismatched address.

This case does not look as an unrecoverable error.

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

4 years agoSupport -fstack-clash-protection for x86
serge_sans_paille [Mon, 9 Sep 2019 14:59:34 +0000 (16:59 +0200)]
Support -fstack-clash-protection for x86

Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a357a8f685b3540246c5d762734e035f with better option
handling and more portable testing

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

4 years agoUse heterogenous lookup for std;:map<std::string with a StringRef. NFCI.
Benjamin Kramer [Sat, 8 Feb 2020 12:27:52 +0000 (13:27 +0100)]
Use heterogenous lookup for std;:map<std::string with a StringRef. NFCI.

4 years agoAdd missing encoding comments from fma4 folded intrinsics tests
Simon Pilgrim [Sat, 8 Feb 2020 11:23:05 +0000 (11:23 +0000)]
Add missing encoding comments from fma4 folded intrinsics tests

4 years agoArrayRef'ize spillCalleeSavedRegisters. NFCI.
Benjamin Kramer [Sat, 8 Feb 2020 11:14:37 +0000 (12:14 +0100)]
ArrayRef'ize spillCalleeSavedRegisters. NFCI.

4 years ago[X86][SSE] Add X86ISD::FRCP handling to isNegatibleForFree
Simon Pilgrim [Sat, 8 Feb 2020 10:56:27 +0000 (10:56 +0000)]
[X86][SSE] Add X86ISD::FRCP handling to isNegatibleForFree

Peek through X86ISD::FRCP nodes to see if there is a negatible input.

4 years ago[X86][SSE] Show isNegatibleForFree inability to peek through X86ISD::FRCP
Simon Pilgrim [Sat, 8 Feb 2020 10:40:49 +0000 (10:40 +0000)]
[X86][SSE] Show isNegatibleForFree inability to peek through X86ISD::FRCP

We can safely negate the input of RCP but we can't peek through it.

4 years ago[TargetLowering] Remove isDesirableToCombineBuildVectorToShuffleTruncate target hook...
Simon Pilgrim [Sat, 8 Feb 2020 08:55:51 +0000 (08:55 +0000)]
[TargetLowering] Remove isDesirableToCombineBuildVectorToShuffleTruncate target hook. NFC.

This hasn't been used for years, its original implementation, D35700, had bugs that caused the reversion of most of the code, and since then x86 shuffle lowering/combining has handled most cases and can deal with the rest as well.

4 years ago[Driver][test] Create empty file Inputs/basic_cross_linux_tree/usr/x86_64-unknown...
Fangrui Song [Sat, 8 Feb 2020 07:30:26 +0000 (23:30 -0800)]
[Driver][test] Create empty file Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/ld.lld

To make lto.c and lto.cu pass for systems that do not have ld.lld

4 years ago[Driver] Don't pass -plugin LLVMgold.so when the linker is ld.lld
Fangrui Song [Fri, 7 Feb 2020 22:17:36 +0000 (14:17 -0800)]
[Driver] Don't pass -plugin LLVMgold.so when the linker is ld.lld

This is does not cover the case when ld is lld (e.g. /usr/bin/ld on
modern FreeBSD systems).

4 years ago[Driver][test] Refactor LLVMgold tests
Fangrui Song [Sat, 8 Feb 2020 05:42:14 +0000 (21:42 -0800)]
[Driver][test] Refactor LLVMgold tests

LLVMgold.so tests are duplicated in several places. Deduplicate them.
Move the tests to lto.c and lto.cu
Specify -fuse-ld=bfd or -fuse-ld=gold.

In a future change, if -fuse-ld=lld or CLANG_DEFAULT_LINKER=lld without -fuse-ld=, we will remove -plugin /path/to/LLVMgold.so

4 years ago[Driver][test] Fix Driver/hexagon-toolchain-elf.c for -DCLANG_DEFAULT_LINKER=lld...
Fangrui Song [Sat, 8 Feb 2020 06:27:22 +0000 (22:27 -0800)]
[Driver][test] Fix Driver/hexagon-toolchain-elf.c for -DCLANG_DEFAULT_LINKER=lld builds after 305bf5b21dbdb2345ef86b5700285e42d992c954

4 years ago[LegalizeDAG][X86][AMDGPU] Use ANY_EXTEND instead of ZERO_EXTEND when promoting ISD...
Craig Topper [Sat, 8 Feb 2020 05:33:39 +0000 (21:33 -0800)]
[LegalizeDAG][X86][AMDGPU] Use ANY_EXTEND instead of ZERO_EXTEND when promoting ISD::CTTZ/CTTZ_ZERO_UNDEF.

Summary:
For CTTZ we place a set bit just past where the non-promoted type
stopped so the extended bits won't be used for the count. For
CTTZ_ZERO_UNDEF we don't care what happens if no bits are set in
the original type and we end up counting into the extended bits.
So we can just use ANY_EXTEND for both cases.

This matches what is done in type legalization for these operations.
We make no effort to force the upper bits to zero.

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

4 years ago[ObjC][ARC] Keep track of phis that have been discovered to avoid an
Akira Hatanaka [Sat, 8 Feb 2020 04:15:16 +0000 (20:15 -0800)]
[ObjC][ARC] Keep track of phis that have been discovered to avoid an
infinite loop

This fixes a bug introduced in 6770fbb31450db15d8d4a2ac7f0ce70eaf2acc5f.

rdar://problem/59137105

4 years ago[WebAssembly] Fix signature of __powitf2 libcall
Sam Clegg [Sat, 8 Feb 2020 02:20:03 +0000 (18:20 -0800)]
[WebAssembly] Fix signature of __powitf2 libcall

Add tests for @llvm.powi.f64/f128.

See: https://llvm.org/docs/LangRef.html#llvm-powi-intrinsic

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

4 years agoRevert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"
Jan Kratochvil [Sat, 8 Feb 2020 04:08:48 +0000 (05:08 +0100)]
Revert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"

This reverts commit cf1046c716b33ed449aa8fc26376864917c63c25.
Reverted: https://reviews.llvm.org/D74252

It fixed testsuite but broke real world functionality where is not used:
settings set symbols.enable-external-lookup false

4 years agoRevert "[clang-doc] Improving Markdown Output"
Petr Hosek [Sat, 8 Feb 2020 03:43:47 +0000 (19:43 -0800)]
Revert "[clang-doc] Improving Markdown Output"

This reverts commit dac21fdd5923730342a4bc9abc0858fb56ff8d52 as this
is failing on Windows.

4 years ago[clang-doc] Improving Markdown Output
Petr Hosek [Sat, 8 Feb 2020 02:58:57 +0000 (18:58 -0800)]
[clang-doc] Improving Markdown Output

This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

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

4 years ago[WebAssembly] Add debug info to insts in Emscripten SjLj
Heejin Ahn [Fri, 7 Feb 2020 03:29:01 +0000 (19:29 -0800)]
[WebAssembly] Add debug info to insts in Emscripten SjLj

Summary:
This makes sure all newly create instructions in Emscripten SjLj has
appropriate debug info attached. Fixes
https://github.com/emscripten-core/emscripten/issues/9797.

Reviewers: kripken

Subscribers: dschuff, aprantl, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years agoPR12350: Handle remaining cases permitted by CWG DR 244.
Richard Smith [Sat, 8 Feb 2020 00:34:08 +0000 (16:34 -0800)]
PR12350: Handle remaining cases permitted by CWG DR 244.

Also add extension warnings for the cases that are disallowed by the
current rules for destructor name lookup, refactor and simplify the
lookup code, and improve the diagnostic quality when lookup fails.

The special case we previously supported for converting
p->N::S<int>::~S() from naming a class template into naming a
specialization thereof is subsumed by a more general rule here (which is
also consistent with Clang's historical behavior and that of other
compilers): if we can't find a suitable S in N, also look in N::S<int>.

The extension warnings are off by default, except for a warning when
lookup for p->N::S::~T() looks for T in scope instead of in N (or N::S).
That seems sufficiently heinous to warn on by default, especially since
we can't support it for a dependent nested-name-specifier.

4 years ago[lldb/Plugin] Use LLDB_PLUGIN_DECLARE to forward declare plugin initializers
Jonas Devlieghere [Sat, 8 Feb 2020 01:58:30 +0000 (17:58 -0800)]
[lldb/Plugin] Use LLDB_PLUGIN_DECLARE to forward declare plugin initializers

Apparently Linux and Windows have the exact opposite behavior when it
comes to inline declarations of external functions. On Linux they're
considered to be part of the lldb_private namespace, while on Windows
they're considered to be part of the top level namespace. Somehow on
macOS, it doesn't really matter and both are fine...

At this point I don't know what to do, so I'm just adding the
LLDB_PLUGIN_DECLARE macros again as originally proposed in D74245.

4 years agoAdd a test for adding and removing Listeners from a BroadcasterManager.
Jim Ingham [Sat, 8 Feb 2020 01:48:47 +0000 (17:48 -0800)]
Add a test for adding and removing Listeners from a BroadcasterManager.

Reid found a bug in removing Listeners from a BroadcasterManager:

https://reviews.llvm.org/D74010

The bug didn't affect the case where there was only one Listener
signed up for a BroadcasterManager, which was all the extant test
case tests.  The driver also only uses one listener (the debugger)
for everything, so neither the test nor anything you do with lldb
command line would have triggered the bug.

This adds a couple more tests using more listeners, and adding and
removing them in a different way, which triggers a separate code path.

4 years agoLinker/module-max-warn.ll: Fix test to be compatible with Windows file separators
David Blaikie [Sat, 8 Feb 2020 01:13:32 +0000 (17:13 -0800)]
Linker/module-max-warn.ll: Fix test to be compatible with Windows file separators

4 years ago[lldb-vscode] remove deprecated trace option
Walter Erquinigo [Sat, 8 Feb 2020 00:25:09 +0000 (16:25 -0800)]
[lldb-vscode] remove deprecated trace option

Summary: This option is not used anymore and has been replaced by the env var LLDBVSCODE_LOG.

Reviewers: clayborg

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb-vscode] disable completions
Walter Erquinigo [Sat, 8 Feb 2020 00:04:39 +0000 (16:04 -0800)]
[lldb-vscode] disable completions

Summary:
Completion requests are causing some problems in the debugger, which is explained in the comment in the code.
I'm disabling it for now until we have time to do a good implementation of it.

Reviewers: clayborg

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb/Plugin] Don't define initializers inside lldb_private
Jonas Devlieghere [Sat, 8 Feb 2020 00:50:10 +0000 (16:50 -0800)]
[lldb/Plugin] Don't define initializers inside lldb_private

This should fix the Windows build.

4 years ago[ObjC][ARC] Delete ARC runtime calls that take inert phi values
Akira Hatanaka [Sat, 8 Feb 2020 00:24:18 +0000 (16:24 -0800)]
[ObjC][ARC] Delete ARC runtime calls that take inert phi values

This improves on the following patch, which removed ARC runtime calls
taking inert global variables:

https://reviews.llvm.org/D62433

rdar://problem/59137105

4 years agoIR Linking: Support merging Warning+Max module metadata flags
David Blaikie [Thu, 6 Feb 2020 22:37:23 +0000 (14:37 -0800)]
IR Linking: Support merging Warning+Max module metadata flags

Summary:
Debug Info Version was changed to use "Max" instead of "Warning" per the
original design intent - but this maxes old/new IR unlinkable, since
mismatched merge styles are a linking failure.

It seems possible/maybe reasonable to actually support the combination
of these two flags: Warn, but then use the maximum value rather than the
first value/earlier module's value.

Reviewers: tejohnson

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

4 years ago[GlobalISel][CallLowering] Look through bitcasts from constant function pointers.
Amara Emerson [Fri, 7 Feb 2020 18:10:43 +0000 (10:10 -0800)]
[GlobalISel][CallLowering] Look through bitcasts from constant function pointers.

Calls to ObjC's objc_msgSend function are done by bitcasting the function global
to the required function type signature. This patch looks through this bitcast
so that we can do a direct call with bl on arm64 instead of using an indirect blr.

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

4 years ago[lldb/Plugins] Use external functions to (de)initialize plugins
Jonas Devlieghere [Fri, 7 Feb 2020 22:58:18 +0000 (14:58 -0800)]
[lldb/Plugins] Use external functions to (de)initialize plugins

This is a step towards making the initialize and terminate calls be
generated by CMake, which in turn is towards making it possible to
disable plugins at configuration time.

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

4 years ago[X86] Correct the implementation of the avx512 masked fmsubadd autoupgrade code to...
Craig Topper [Fri, 7 Feb 2020 23:04:22 +0000 (15:04 -0800)]
[X86] Correct the implementation of the avx512 masked fmsubadd autoupgrade code to not leave the negate unconnected.

This was causing us to generate fmaddsub instead of fmsubadd if
rounding control is not 4.

4 years ago[X86] Add more avx512 masked fmaddsub/fmsubadd autoupgrade tests with rounding contro...
Craig Topper [Fri, 7 Feb 2020 23:01:18 +0000 (15:01 -0800)]
[X86] Add more avx512 masked fmaddsub/fmsubadd autoupgrade tests with rounding control not set to 4.

The fmsubadd upgrade doesn't insert the negate properly when the
rounding control isn't 4.

4 years ago[lldb][test][NFC] Create a separate LLDB_TEST_SRC var to allow moving tests.
Jordan Rupprecht [Fri, 7 Feb 2020 23:13:38 +0000 (15:13 -0800)]
[lldb][test][NFC] Create a separate LLDB_TEST_SRC var to allow moving tests.

Summary:
This creates a separate LLDB_TEST_SRC var to match the existing LLDB_TEST var. LLDB_TEST points to the test framework, LLDB_TEST_SRC points to the tests themselves.

The var points to the same place, but a future patch will move the tree + update var.

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: merge_guards_bot, lldb-commits

Tags: #lldb

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

4 years ago[CMake] Fix accidentally inverted condition
Jonas Devlieghere [Fri, 7 Feb 2020 23:12:05 +0000 (15:12 -0800)]
[CMake] Fix accidentally inverted condition

I unintentionally inverted the condition for excluding the tests from
check-all.

4 years agoReplace CHECK-NEXT with CHECK-DAG. The order isn't relevant we just
Adrian Prantl [Fri, 7 Feb 2020 23:09:44 +0000 (15:09 -0800)]
Replace CHECK-NEXT with CHECK-DAG. The order isn't relevant we just
want to make sure that all are present.

4 years ago[clang] Add support for __builtin_memcpy_inline
Guillaume Chatelet [Tue, 28 Jan 2020 12:01:19 +0000 (13:01 +0100)]
[clang] Add support for __builtin_memcpy_inline

Summary: This is a follow up on D61634 and the last step to implement http://lists.llvm.org/pipermail/llvm-dev/2019-April/131973.html

Reviewers: efriedma, courbet, tejohnson

Subscribers: hiraditya, cfe-commits, llvm-commits, jdoerfert, t.p.northover

Tags: #clang, #llvm

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

4 years ago[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas
Erik Pilkington [Fri, 7 Feb 2020 17:37:15 +0000 (09:37 -0800)]
[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas

These temporaries are only used in the callee, and their memory can be reused
after the call is complete.

rdar://58552124

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

4 years agoRevert "[TestConvienceVariable] Clean the directory before running the test."
Davide Italiano [Fri, 7 Feb 2020 22:32:12 +0000 (14:32 -0800)]
Revert "[TestConvienceVariable] Clean the directory before running the test."

This reverts commit 9bce9d2d65e2462140597f71a8247750b837094c, as
it breaks the bots.

4 years agoChange first test to be CHECK: to make the test run.
Jason Molenda [Fri, 7 Feb 2020 22:31:35 +0000 (14:31 -0800)]
Change first test to be CHECK: to make the test run.

4 years agoReland "[AMDGPU] Fix data race on RegisterBank initialization."
Huihui Zhang [Fri, 7 Feb 2020 22:05:52 +0000 (14:05 -0800)]
Reland "[AMDGPU] Fix data race on RegisterBank initialization."

4 years ago[mlir][Pass] Enable printing pass options as part of `-help`.
River Riddle [Fri, 7 Feb 2020 22:11:30 +0000 (14:11 -0800)]
[mlir][Pass] Enable printing pass options as part of `-help`.

Summary:
This revision adds support for printing pass options as part of the normal help description. This also moves registered passes and pipelines into different sections of the help.

Example:
```
  Compiler passes to run
    --pass-pipeline                                     -   ...
    Passes:
      --affine-data-copy-generate                       -   ...
      --convert-gpu-to-spirv                            -   ...
        --workgroup-size=<long>                         - ...
      --test-options-pass                               -   ...
        --list=<int>                                    - ...
        --string=<string>                               - ...
        --string-list=<string>                          - ...
    Pass Pipelines:
      --test-options-pass-pipeline                      -   ...
        --list=<int>                                    - ...
        --string=<string>                               - ...
        --string-list=<string>                          - ...
```

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

4 years agoReland "[ARM] Fix data race on RegisterBank initialization."
Huihui Zhang [Fri, 7 Feb 2020 22:00:44 +0000 (14:00 -0800)]
Reland "[ARM] Fix data race on RegisterBank initialization."

Update lambda function
static auto InitializeRegisterBankOnce = [this](const auto &TRI) {
with
static auto InitializeRegisterBankOnce = [&]() {

Capture reference instead of passing argument, as there are buildbot
compiling errors related when passing argument.

4 years ago[TestConvienceVariable] Clean the directory before running the test.
Davide Italiano [Fri, 7 Feb 2020 21:51:58 +0000 (13:51 -0800)]
[TestConvienceVariable] Clean the directory before running the test.

4 years ago[CMake] Use LLVM tools external project build where possible
Petr Hosek [Thu, 6 Feb 2020 03:37:50 +0000 (19:37 -0800)]
[CMake] Use LLVM tools external project build where possible

This reduces the reliance on host tools and makes the build more
hermetic. Some of the runtimes already assume that certain tools are
always available, for example libc++ and libc++abi archive merging
relies on ar to extract files out of the archive, even on Darwin.

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

4 years ago[mlir][spirv] Adding sin op in the GLSL extension
natashaknk [Fri, 7 Feb 2020 21:35:36 +0000 (16:35 -0500)]
[mlir][spirv] Adding sin op in the GLSL extension

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

4 years ago[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux
Jan Kratochvil [Fri, 7 Feb 2020 21:23:09 +0000 (22:23 +0100)]
[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux

D73303 was failing on Fedora Linux and so it was disabled by Skip the
AssertFrameRecognizer test for Linux.

On Fedora 30 x86_64 I have:
        $ readelf -Ws /lib64/libc.so.6 |grep '^Symbol\|.*assert_fail'
        Symbol table '.dynsym' contains 2362 entries:
           630: 0000000000030520    70 FUNC    GLOBAL DEFAULT   14 __assert_fail@@GLIBC_2.2.5
        Symbol table '.symtab' contains 22711 entries:
           922: 000000000002275a    15 FUNC    LOCAL  DEFAULT   14 __assert_fail_base.cold
         18044: 0000000000030520    70 FUNC    LOCAL  DEFAULT   14 __GI___assert_fail
         20081: 00000000000303a0   370 FUNC    LOCAL  DEFAULT   14 __assert_fail_base
         21766: 0000000000030520    70 FUNC    GLOBAL DEFAULT   14 __assert_fail

The patch should never expect __GI___assert_fail:

.symtab can be present or not but that should not change that
__assert_fail always wins - it is always present from .dynsym and it can
never be overriden by __GI___assert_fail as __GI___assert_fail has only
local binding. Global binding is preferred since D63540.

External debug info symbols do not matter since D55859 (and DWARF should
never be embedded in system libc.so.6).

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

4 years agoReland "[AArch64] Fix data race on RegisterBank initialization."
Huihui Zhang [Fri, 7 Feb 2020 20:57:24 +0000 (12:57 -0800)]
Reland "[AArch64] Fix data race on RegisterBank initialization."

Update lambda function
static auto InitializeRegisterBankOnce = [this](const auto &TRI) {
with
static auto InitializeRegisterBankOnce = [&]() {

Capture reference instead of passing argument, as there are buildbot
compiling errors related when passing argument.