platform/upstream/llvm.git
4 years agoRecommit [libc++] Move abs and div into stdlib.h to fix header cycle.
Eric Fiselier [Sat, 15 Feb 2020 23:55:07 +0000 (18:55 -0500)]
Recommit [libc++] Move abs and div into stdlib.h to fix header cycle.

This relands this commit as it broke the LLDB bot the first time it landed.
See also the discussion on https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be

Since D74892 this code should now also work on macOS.

Original description:

libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.

Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.

Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.

To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.

4 years ago[DebugInfo] Fix crash caused by unhandled error.
Xing GUO [Tue, 28 Apr 2020 13:38:50 +0000 (21:38 +0800)]
[DebugInfo] Fix crash caused by unhandled error.

Summary: This patch helps fix LLVM crash caused by unhandled error.

Reviewers: clayborg, aprantl

Reviewed By: clayborg

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agorecommit c77a4078e01033aa2206c31a579d217c8a07569b with fix
Yaxun (Sam) Liu [Fri, 24 Apr 2020 20:41:24 +0000 (16:41 -0400)]
recommit c77a4078e01033aa2206c31a579d217c8a07569b with fix

https://reviews.llvm.org/D77954 caused a regression about ambiguity of new operator
in file scope.

This patch recovered the previous behavior for comparison without a caller.

This is a workaround. For real fix we need D71227

https://reviews.llvm.org/D78970

4 years ago[clang-format] Improved parser for C# properties
Jonathan Coe [Tue, 28 Apr 2020 13:11:09 +0000 (14:11 +0100)]
[clang-format] Improved parser for C# properties

Summary:
Added some examples of properties from Microsoft documentation as test cases.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties

Configuration support will be added in a follow up patch to address whether automatic properties are formatted as

```
Type MyType { get; set }
```

or

```
Type MyType
{ get; set }
```

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

4 years ago[SveEmitter] Add builtins for zero/sign extension and bit/byte reversal.
Sander de Smalen [Tue, 28 Apr 2020 12:56:44 +0000 (13:56 +0100)]
[SveEmitter] Add builtins for zero/sign extension and bit/byte reversal.

This patch adds builtins for predicated unary builtins
svext[bhw] and svrev[bhw] and svrbit.

4 years ago[lldb][cmake] Also use local submodule visibility on Darwin
Raphael Isemann [Mon, 27 Apr 2020 12:58:50 +0000 (14:58 +0200)]
[lldb][cmake] Also use local submodule visibility on Darwin

Summary:
Currently building LLVM on macOS and on other platforms with LLVM_ENABLE_MODULES is using different module flags,
which means that a passing modules build on macOS might fail on Linux and vice versa. -fmodules-local-submodule-visibility
is the mode that has clearer semantics and is closer to the actual C++ module standard, so let's make this the default everywhere.

We can still test building without local submodule visibility on an additional bot by just changing the respective CMake flag. However,
if building without local-submodule-visibility breaks we won't revert other commits and we won't loose LLDB's/Clang's test run
information.

Reviewers: aprantl, bruno, Bigcheese

Reviewed By: Bigcheese

Subscribers: abidh, dexonsmith, JDevlieghere, lldb-commits, mgorny, llvm-commits

Tags: #llvm, #lldb

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

4 years agoFix Wparentheses gcc warning. NFC.
Simon Pilgrim [Tue, 28 Apr 2020 12:57:47 +0000 (13:57 +0100)]
Fix Wparentheses gcc warning. NFC.

Wrap the 'anyof' hasAttribute checks so that we don't get precedence warnings with the assertion message.

4 years ago[SveEmitter] Add builtins for bitcount operations
Sander de Smalen [Tue, 28 Apr 2020 12:48:16 +0000 (13:48 +0100)]
[SveEmitter] Add builtins for bitcount operations

This patch adds builtins for svcls, svclz and svcnt.

For merging (_m), zeroing (_z) and don't-care (_x) predication.

4 years agoRevert "[MLIR] Introduce op trait PolyhedralScope"
Dmitri Gribenko [Tue, 28 Apr 2020 12:39:46 +0000 (14:39 +0200)]
Revert "[MLIR] Introduce op trait PolyhedralScope"

This reverts commit dd2c639c3cd397dfef941186fb85c82e4e918425. It broke a
few things -- the explanation will be posted to the review thread.

4 years ago[SveEmitter] Add builtins for permutations and selection
Sander de Smalen [Tue, 28 Apr 2020 12:38:41 +0000 (13:38 +0100)]
[SveEmitter] Add builtins for permutations and selection

This patch adds builtins for:
- svlasta and svlastb
- svclasta and svclastb
- svunpkhi and svunpklo
- svuzp1 and svuzp2
- svzip1 and svzip2
- svrev
- svsel
- svcompact
- svsplice
- svtbl

4 years agoRevert: [libc++] Create a small DSL for defining Lit features and parameters
David Zarzycki [Tue, 28 Apr 2020 12:09:45 +0000 (08:09 -0400)]
Revert: [libc++] Create a small DSL for defining Lit features and parameters

This reverts commit 6d58030c8c7d481d08a549246fd3103aceb61c7b due to lack
of Python 3 support. As a reminder, the Python community ended their
support for 2.x at the start of 2020.

4 years ago[LLD][ELF] Eliminate symbols of merged .ARM.exidx sections.
Igor Kudrin [Fri, 24 Apr 2020 03:32:49 +0000 (10:32 +0700)]
[LLD][ELF] Eliminate symbols of merged .ARM.exidx sections.

GNU tools generate mapping symbols "$d" for .ARM.exidx sections. The
symbols are added to the symbol table much earlier than the merging
takes place, and after that, they become dangling. Before the patch,
LLD output those symbols as SHN_ABS with the value of 0. The patch
removes such symbols from the symbol table.

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

4 years ago[OpenCL] Fixed test for the cast operators.
Anastasia Stulova [Tue, 28 Apr 2020 10:49:31 +0000 (11:49 +0100)]
[OpenCL] Fixed test for the cast operators.

The test had unused variable because it missed to cover
case with __constant address space. This change now
completes the testing fully.

4 years ago[lldb/unittest] Adjust CheckIPSupport function to avoid double-consume of llvm::Error
Pavel Labath [Tue, 28 Apr 2020 11:33:52 +0000 (13:33 +0200)]
[lldb/unittest] Adjust CheckIPSupport function to avoid double-consume of llvm::Error

The problem caught by clang-tidy and reported by Tobias Bosch.

4 years ago[lldb-vscode] A couple of small style fixes
Pavel Labath [Tue, 28 Apr 2020 11:13:45 +0000 (13:13 +0200)]
[lldb-vscode] A couple of small style fixes

to make the code conform to llvm style better:
- avoid use of auto where the type is not obivous
- avoid StringRef::data where it is not needed

No functional change intended.

4 years ago[Flang][CMake] Add explicit libFortranCommon dependency for f18 etc.
Rainer Orth [Tue, 28 Apr 2020 11:28:41 +0000 (13:28 +0200)]
[Flang][CMake] Add explicit libFortranCommon dependency for f18 etc.

When I tried Solaris builds with `-DBUILD_SHARED_LIBS=ON`, some commands failed
to link:

  [ 94%] Linking CXX executable ../../../../bin/f18
  Undefined                       first referenced
   symbol                             in file
  Fortran::common::IntrinsicTypeDefaultKinds::set_sizeIntegerKind(int) CMakeFiles/f18.dir/f18.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
  Fortran::common::IntrinsicTypeDefaultKinds::set_subscriptIntegerKind(int) CMakeFiles/f18.dir/f18.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
  Fortran::common::EnumIndexToString[abi:cxx11](int, char const*) CMakeFiles/f18.dir/f18.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
  Fortran::common::IntrinsicTypeDefaultKinds::set_defaultIntegerKind(int) CMakeFiles/f18.dir/f18.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
  Fortran::common::IntrinsicTypeDefaultKinds::IntrinsicTypeDefaultKinds() CMakeFiles/f18.dir/f18.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
  Fortran::common::IntrinsicTypeDefaultKinds::set_defaultRealKind(int) CMakeFiles/f18.dir/f18.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-shared-gcc8-make/lib/libFortranCommon.so.11git)
  ld: fatal: symbol referencing errors

This patch fixes this by adding explicit dependencies on `libFortranCommon`
to the affected commands.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86-64-pc-linux-gnu`.

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

4 years ago[gcov][test] Work around PR45673 - NFC
KAWASHIMA Takahiro [Tue, 28 Apr 2020 11:16:24 +0000 (20:16 +0900)]
[gcov][test] Work around PR45673 - NFC

Work around PR45673 until the test code is fixed.

4 years ago[SveEmitter] Add builtins for ternary ops (fmla, fmad, etc)
Sander de Smalen [Tue, 28 Apr 2020 09:59:38 +0000 (10:59 +0100)]
[SveEmitter] Add builtins for ternary ops (fmla, fmad, etc)

This patch adds builtins for:
- svmad, svmla, svmls, svmsb
  svnmad, svnmla, svnmls, svnmsb
  svmla_lane, svmls_lane

These builtins come in several flavours:
- Merge into first source vector (`_m`)
- False lanes are undef (`_x`)
- False lanes are zeroed (`_z`)

And can also have `_n` to indicate the last operand is a scalar.

For example:

  svint32_t svmla[_n_s32]_z(svbool_t pg, svint32_t op1, svint32_t op2, int32_t op3)

Reviewed By: efriedma

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

4 years ago[Powerpc] add triple for new added qpx test case - NFC
Chen Zheng [Tue, 28 Apr 2020 09:27:06 +0000 (05:27 -0400)]
[Powerpc] add triple for new added qpx test case - NFC

4 years ago[PowerPC] Fix downcast from nullptr for target streamer
Ng Zhi An [Tue, 28 Apr 2020 09:20:10 +0000 (09:20 +0000)]
[PowerPC] Fix downcast from nullptr for target streamer

getTargetStreamer() might return null (e.g. when running inlined-strings.ll test),
downcasting to a reference will be wrong. This is detectable with -fsanitize=null.

Reviewed By: steven.zhang

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

4 years ago[PowerPC] add test case for reorder operands of qpx fma instr - nfc.
Chen Zheng [Tue, 28 Apr 2020 08:28:23 +0000 (04:28 -0400)]
[PowerPC] add test case for reorder operands of qpx fma instr - nfc.

4 years ago[mlir][flang] use OpBuilder& instead of Builder* in <Op>::build methods
Alex Zinenko [Thu, 23 Apr 2020 14:02:46 +0000 (16:02 +0200)]
[mlir][flang] use OpBuilder& instead of Builder* in <Op>::build methods

As we start defining more complex Ops, we increasingly see the need for
Ops-with-regions to be able to construct Ops within their regions in
their ::build methods. However, these methods only have access to
Builder, and not OpBuilder. Creating a local instance of OpBuilder
inside ::build and using it fails to trigger the operation creation
hooks in derived builders (e.g., ConversionPatternRewriter). In this
case, we risk breaking the logic of the derived builder. At the same
time, OpBuilder::create, which is by far the largest user of ::build
already passes "this" as the first argument, so an OpBuilder instance is
already available.

Update all ::build methods in all Ops in MLIR and Flang to take
"OpBuilder &" instead of "Builder *". Note the change from pointer and
to reference to comply with the common style in MLIR, this also ensures
all other users must change their ::build methods.

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

4 years agoProviding buffer assignment for MLIR
Ehsan Toosi [Mon, 20 Apr 2020 10:41:14 +0000 (12:41 +0200)]
Providing buffer assignment for MLIR

We have provided a generic buffer assignment transformation ported from
TensorFlow. This generic transformation pass automatically analyzes the values
and their aliases (also in other blocks) and returns the valid positions for
Alloc and Dealloc operations. To find these positions, the algorithm uses the
block Dominator and Post-Dominator analyses. In our proposed algorithm, we have
considered aliasing, liveness, nested regions, branches, conditional branches,
critical edges, and independency to custom block terminators. This
implementation doesn't support block loops. However, we have considered this in
our design. For this purpose, it is only required to have a loop analysis to
insert Alloc and Dealloc operations outside of these loops in some special
cases.

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

4 years agoRevert f8990feb125a "[libclang] Install both libclang.a and libclang.so when LIBCLANG...
Hans Wennborg [Tue, 28 Apr 2020 08:10:33 +0000 (10:10 +0200)]
Revert f8990feb125a "[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON"

This broke builds configured with

$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release '-DLLVM_ENABLE_PROJECTS=clang' '-DLLVM_TARGETS_TO_BUILD=X86' -DLLVM_ENABLE_PIC=OFF ../llvm

CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type

This reverts commit f8990feb125a0f8d3f2892a589bc6fad3c430858.

4 years ago[analyzer] StdLibraryFunctionsChecker: Associate summaries to FunctionDecls
Gabor Marton [Tue, 7 Apr 2020 09:44:33 +0000 (11:44 +0200)]
[analyzer] StdLibraryFunctionsChecker: Associate summaries to FunctionDecls

Summary:
Currently we map function summaries to names (i.e. strings). We can
associate more summaries with different signatures to one name, this way
we support overloading. During a call event we check whether the
signature of the summary matches the signature of the callee and we
apply the summary only in that case.

In this patch we change this mapping to associate a summary to a
FunctionDecl. We do lookup operations when the summary map is
initialized. We lookup the given name and we match the signature of the
given summary against the lookup results. If the summary matches the
FunctionDecl (got from the lookup result) then we add that to the
summary map. During a call event we compare FunctionDecl pointers.
Advantages of this new refactor:
- Cleaner mapping and structure for the checker.
- Possibly way more efficient handling of call events.
- A summary is added only if that is relevant for the given TU.
- We can get the concrete FunctionDecl by the time when we create the
  summary, this opens up possibilities of further sanity checks
  regarding the summary cases and argument constraints.
- Opens up to future work when we'd like to store summaries from IR to a
  FunctionDecl (or from the Attributor results of the given
  FunctionDecl).

Note, we cannot support old C functions without prototypes.

Reviewers: NoQ, Szelethus, balazske, jdoerfert, sstefan1, uenoku

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, uenoku, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[TTI] Add TargetCostKind argument to getUserCost
Sam Parker [Mon, 27 Apr 2020 08:02:14 +0000 (09:02 +0100)]
[TTI] Add TargetCostKind argument to getUserCost

There are several different types of cost that TTI tries to provide
explicit information for: throughput, latency, code size along with
a vague 'intersection of code-size cost and execution cost'.

The vectorizer is a keen user of RecipThroughput and there's at least
'getInstructionThroughput' and 'getArithmeticInstrCost' designed to
help with this cost. The latency cost has a single use and a single
implementation. The intersection cost appears to cover most of the
rest of the API.

getUserCost is explicitly called from within TTI when the user has
been explicit in wanting the code size (also only one use) as well
as a few passes which are concerned with a mixture of size and/or
a relative cost. In many cases these costs are closely related, such
as when multiple instructions are required, but one evident diverging
cost in this function is for div/rem.

This patch adds an argument so that the cost required is explicit,
so that we can make the important distinction when necessary.

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

4 years agoUse components instead of libraries in Polly linkage step
serge-sans-paille [Sat, 18 Apr 2020 06:14:52 +0000 (08:14 +0200)]
Use components instead of libraries in Polly linkage step

As a side effect, this tests (and fix a bug) in the compiler extension handling
of components.

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

4 years ago[SystemZ] Fix test case.
Jonas Paulsson [Tue, 28 Apr 2020 07:37:43 +0000 (09:37 +0200)]
[SystemZ] Fix test case.

Remove bad kill flags fom load-and-test.mir as discovered by
https://reviews.llvm.org/D78586: "[MachineVerifier] Add more checks for
registers in live-in lists".

Review: Ulrich Weigand

4 years ago[VE] Update branch instructions
Kazushi (Jam) Marukawa [Tue, 28 Apr 2020 07:41:01 +0000 (09:41 +0200)]
[VE] Update branch instructions

Summary:
Changing all mnemonic to match assembly instructions to simplify mnemonic
naming rules. This time update all branch instructions.  This also change
to use %s10 register consistently.

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

4 years ago[VE] Support floating point immediate values
Kazushi (Jam) Marukawa [Tue, 28 Apr 2020 07:35:58 +0000 (09:35 +0200)]
[VE] Support floating point immediate values

Summary:
Add simm7fp/mimmfp to represent floating point immediate values.
Also clean multiclasses to define floating point arithmetic instructions
to handle simm7fp/mimmfp operands.  Also add several regression tests
for new operands.

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

4 years ago[PowerPC] use inst-level fast-math-flags to drive MachineCombiner
Chen Zheng [Tue, 28 Apr 2020 07:31:12 +0000 (03:31 -0400)]
[PowerPC] use inst-level fast-math-flags to drive MachineCombiner

Currently, on PowerPC target, it uses function scope UnsafeFPMath
option to drive Machine Combiner pass.

This is not accurate in two ways:
1: the scope is not accurate. Machine Combiner pass only requires
   instruction-level flags instead of the function scope.
2: the float point flag is not accurate. Machine Combiner pass
   only requires float point flags reassoc and nsz.

Reviewed By: steven.zhang

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

4 years agoFix the -Wunused-variable warning.
Haojian Wu [Tue, 28 Apr 2020 06:44:15 +0000 (08:44 +0200)]
Fix the -Wunused-variable warning.

4 years ago[SelectionDAGBuilder] Use CallBase::isInlineAsm in a couple places. NFC
Craig Topper [Tue, 28 Apr 2020 05:36:25 +0000 (22:36 -0700)]
[SelectionDAGBuilder] Use CallBase::isInlineAsm in a couple places. NFC

These lines were just changed from using CallBase::getCalledValue
to getCallledOperand. Go aheand change them to isInlineAsm.

4 years ago[IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().
Craig Topper [Tue, 28 Apr 2020 03:15:59 +0000 (20:15 -0700)]
[IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().

This method has been commented as deprecated for a while. Remove
it and replace all uses with the equivalent getCalledOperand().

I also made a few cleanups in here. For example, to removes use
of getElementType on a pointer when we could just use getFunctionType
from the call.

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

4 years ago[AMDGPU] DWARF proposal review feedback
Tony [Mon, 20 Apr 2020 20:55:34 +0000 (16:55 -0400)]
[AMDGPU] DWARF proposal review feedback

- Rename DW_OP_LLVM_offset_constu to DW_OP_LLVM_offset_uconst to
  matches DW_OP_plus_uconst.
- Correct DW_OP_LLVM_call_ref to be DW_OP_call_ref.
- Move proposed changes to a separate section to clarify that the
  introduction section is not part of the changes.
- Fix formatting typos and add missing reference.
- Clarify why DW_OP_LLVM_offset et al do not wrap on overflow.
- Correct syntax of augmentation string.

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

4 years ago[MLIR] Introduce op trait PolyhedralScope
Uday Bondhugula [Sat, 25 Apr 2020 04:24:18 +0000 (09:54 +0530)]
[MLIR] Introduce op trait PolyhedralScope

Introduce op trait `PolyhedralScope` for ops to define a new scope for
polyhedral optimization / affine dialect purposes, thus generalizing
such scopes beyond FuncOp. Ops to which this trait is attached will
define a new scope for the consideration of SSA values as valid symbols
for the purposes of polyhedral analysis and optimization. Update methods
that check for dim/symbol validity to work based on this trait.

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

4 years agoFix missing namespace in API implementation.
Mircea Trofin [Tue, 28 Apr 2020 04:05:33 +0000 (21:05 -0700)]
Fix missing namespace in API implementation.

4 years ago[llvm][NFC] Use CallBase instead of Instruction in ProfileSummaryInfo
Mircea Trofin [Mon, 27 Apr 2020 16:07:18 +0000 (09:07 -0700)]
[llvm][NFC] Use CallBase instead of Instruction in ProfileSummaryInfo

Summary:
getProfileCount requires the parameter be a valid CallBase, and its uses
reflect that.

Reviewers: dblaikie, craig.topper, wmi

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[gn build] (manually) merge cd84bfb8142bc7ff3a0"
Nico Weber [Tue, 28 Apr 2020 03:31:07 +0000 (23:31 -0400)]
Revert "[gn build] (manually) merge cd84bfb8142bc7ff3a0"

This reverts commit 825f583c86ca856e930b434c6e3462398461eb9a.
This reverts commit 45417ecbc1cddb667d044c709ee980c9426d5eb2.

cd84bfb8142bc7ff3a0 was reverted in be884b79352de89

4 years ago[PowerPC] Fix the liveins for ppc-expand-isel pass
Kang Zhang [Tue, 28 Apr 2020 03:22:48 +0000 (03:22 +0000)]
[PowerPC] Fix the liveins for ppc-expand-isel pass

Summary:
In the ppc-expand-isel pass, we use stepForward() to update the
liveins, this function is not recommended, because it needs the
accurate kill info.

This patch uses the function computeAndAddLiveIns() to update the
liveins, it's the recommended method and can fix the liveins bug for
ppc-expand-isel pass..

Reviewed By: efriedma, lkail

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

4 years agoRevert "build: use `find_package(Python3)` if available"
Saleem Abdulrasool [Tue, 28 Apr 2020 03:03:32 +0000 (20:03 -0700)]
Revert "build: use `find_package(Python3)` if available"

This reverts commit cd84bfb8142bc7ff3a07a188ffb809f1d86d1fd7.  Although
this passed the CI in phabricator, some of the bots are missing python3
packages, revert it temporarily.

4 years ago[gn build] (manually) merge cd84bfb8142bc7ff3a0 more precisely
Nico Weber [Tue, 28 Apr 2020 01:55:02 +0000 (21:55 -0400)]
[gn build] (manually) merge cd84bfb8142bc7ff3a0 more precisely

4 years ago[gn build] (manually) merge cd84bfb8142bc7ff3a0
Nico Weber [Tue, 28 Apr 2020 01:45:49 +0000 (21:45 -0400)]
[gn build] (manually) merge cd84bfb8142bc7ff3a0

4 years agoMake MLIR Pass Timing output configurable through injection
Mehdi Amini [Mon, 27 Apr 2020 23:38:17 +0000 (23:38 +0000)]
Make MLIR Pass Timing output configurable through injection

This makes it possible for the client to control where the pass timings will
be printed.

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

4 years agobuild: use `find_package(Python3)` if available
Saleem Abdulrasool [Thu, 23 Apr 2020 20:46:47 +0000 (20:46 +0000)]
build: use `find_package(Python3)` if available

This is primarily motivated by the desire to move from Python2 to
Python3.  `PYTHON_EXECUTABLE` is ambiguous.  This explicitly identifies
the python interpreter in use.  Since the LLVM build seems to be able to
completed successfully with python3, use that across the build.  The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.

4 years ago[llvm-objcopy][MachO] Fix build
Alexander Shaposhnikov [Tue, 28 Apr 2020 01:20:01 +0000 (18:20 -0700)]
[llvm-objcopy][MachO] Fix build

Some compilers are confused when the same name is used in different contexts.
Rename the field Section to unbreak the build.
(Caught by the buildbot http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/22374)

4 years ago[llvm-objcopy][MachO] Handle relocation entries where r_extern is zero
Alexander Shaposhnikov [Mon, 27 Apr 2020 05:39:50 +0000 (22:39 -0700)]
[llvm-objcopy][MachO] Handle relocation entries where r_extern is zero

Fix handling of relocations with r_extern == 0.
If r_extern == 0 then r_symbolnum is an index of a section rather than a symbol index.

Patch by Seiya Nuta and Alexander Shaposhnikov.

Test plan: make check-all

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

4 years ago[flang] Upstream recent work on FIR to llvm-project.
Eric Schweitz [Fri, 24 Apr 2020 22:24:20 +0000 (15:24 -0700)]
[flang] Upstream recent work on FIR to llvm-project.

Summary:

Reviewers: DavidTruby, sscalpone, jeanPerier

Subscribers: mgorny, aartbik, llvm-commits

Tags: #llvm

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

4 years ago[X86] remove derived method w/ same impl as base
Nick Desaulniers [Tue, 28 Apr 2020 00:40:01 +0000 (17:40 -0700)]
[X86] remove derived method w/ same impl as base

Summary:
While looking into issues with IfConverter, I noticed that
X86InstrInfo::isUnpredicatedTerminator matched its overriden
implementation in TargetInstrInfo::isUnpredicatedTerminator.

Reviewers: craig.topper, hfinkel, MaskRay, echristo

Reviewed By: MaskRay, echristo

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

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

4 years ago[mlir][LLVMDebugTranslation] Only insert the location mapping after translation
River Riddle [Mon, 27 Apr 2020 23:42:58 +0000 (16:42 -0700)]
[mlir][LLVMDebugTranslation] Only insert the location mapping after translation

This fixes an iteration invalidation bug when the map grows beyond capacity and the iterator for the location to translate becomes invalid.

4 years ago[llvm/DebugInfo] Fix typo in DWARFTypeUnit ctor call
Jonas Devlieghere [Mon, 27 Apr 2020 22:51:37 +0000 (15:51 -0700)]
[llvm/DebugInfo] Fix typo in DWARFTypeUnit ctor call

We were passing the AppleObjCSection instead of the AddrSection. Maybe
the API changed and this remained unnoticed because the types are the
same, or maybe it's just a typo.

4 years ago[llvm/DebugInfo] Print DW_AT_ranges offset as part of verifier error.
Jonas Devlieghere [Mon, 27 Apr 2020 22:41:56 +0000 (15:41 -0700)]
[llvm/DebugInfo] Print DW_AT_ranges offset as part of verifier error.

Print the DW_AT_ranges offset as part of the verifier error, like we do
for the DW_AT_stmt_list offset.

4 years ago[SVE][NFC] Use ScalableVectorType in CGBuiltin
Christopher Tetreault [Mon, 27 Apr 2020 23:11:40 +0000 (16:11 -0700)]
[SVE][NFC] Use ScalableVectorType in CGBuiltin

Summary: * Upgrade some usages of VectorType to use ScalableVectorType

Reviewers: efriedma, david-arm, fpetrogalli, kmclaughlin

Reviewed By: efriedma

Subscribers: tschuett, rkruppe, psnobl, cfe-commits

Tags: #clang

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

4 years agoAdd IR constructs for preallocated (inalloca replacement)
Arthur Eubanks [Fri, 14 Feb 2020 22:16:53 +0000 (14:16 -0800)]
Add IR constructs for preallocated (inalloca replacement)

Add llvm.call.preallocated.{setup,arg} instrinsics.
Add "preallocated" operand bundle which takes a token produced by llvm.call.preallocated.setup.
Add "preallocated" parameter attribute, which is like byval but without the copy.

Verifier changes for these IR constructs.

See https://github.com/rnk/llvm-project/blob/call-setup-docs/llvm/docs/CallSetup.md

Subscribers: hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

4 years ago[X86][CostModel] Add vXiY->vXi1 truncate tests to min-legal-vector-width.ll. NFC
Craig Topper [Mon, 27 Apr 2020 22:47:53 +0000 (15:47 -0700)]
[X86][CostModel] Add vXiY->vXi1 truncate tests to min-legal-vector-width.ll. NFC

4 years ago[SVE] Add specialized overloads of VectorType::get
Christopher Tetreault [Mon, 27 Apr 2020 22:18:14 +0000 (15:18 -0700)]
[SVE] Add specialized overloads of VectorType::get

Summary:
Add overloads of get to FixedVectorType and ScalableVectorType that
mirror VectorType::get(Type *Ty, VectorType *VTy) that take and return
derived vector types

Reviewers: efriedma, c-rhodes, david-arm, fpetrogalli

Reviewed By: david-arm

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoAdd a folder for division by one.
Phoenix Meadowlark [Mon, 27 Apr 2020 19:59:16 +0000 (19:59 +0000)]
Add a folder for division by one.

- Adds a folder for integer division by one with the `divi_signed` and `divi_unsigned` ops.
- Creates tests for scalar and tensor versions of these ops.
- Modifies the test in `parallel-loop-collapsing.mlir` so that it doesn't assume division by one will be in the output.

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

4 years ago[llvm-objcopy][MachO] Avoid accidental invalid relocations in tests
Alexander Shaposhnikov [Mon, 27 Apr 2020 06:46:49 +0000 (23:46 -0700)]
[llvm-objcopy][MachO] Avoid accidental invalid relocations in tests

Until recently yaml2obj didn't properly support relocations for MachO.
This behavior resulted in binaries having invalid relocations.
In this diff we adjust the existing tests as follows:
for the tests which don't actually look at any relocations they are removed,
for the tests which essentially depend on relocations they are fixed.

Test plan: make check-all

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

4 years agoDon't crash on duplicate keys in dictionary attrs.
Sean Silva [Mon, 27 Apr 2020 22:21:52 +0000 (15:21 -0700)]
Don't crash on duplicate keys in dictionary attrs.

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

4 years agoFix up a clang-tidy nit about using empty rather than size == 0.
Eric Christopher [Mon, 27 Apr 2020 22:22:17 +0000 (15:22 -0700)]
Fix up a clang-tidy nit about using empty rather than size == 0.

4 years ago[libcxx][docs][dfsan] Fix rst rendering related typos
Zola Bridges [Mon, 27 Apr 2020 19:28:23 +0000 (12:28 -0700)]
[libcxx][docs][dfsan] Fix rst rendering related typos

* Fix the code block disappearance problem by adding a new line
* Fix the typo where I forgot a space

Reviewed By: ldionne

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

4 years ago[AsmPrinter] Fix emission of non-standard integer constants for BE targets
LemonBoy [Mon, 27 Apr 2020 21:56:30 +0000 (14:56 -0700)]
[AsmPrinter] Fix emission of non-standard integer constants for BE targets

The code assumed that zero-extending the integer constant to the
designated alloc size would be fine even for BE targets, but that's not
the case as that pulls in zeros from the MSB side while we actually
expect the padding zeros to go after the LSB.

I've changed the codepath handling the constant integers to use the
store size for both small(er than u64) and big constants and then add
zero padding right after that.

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

4 years ago[SLP] add test for partially vectorized bswap (PR39538); NFC
Sanjay Patel [Mon, 27 Apr 2020 21:28:41 +0000 (17:28 -0400)]
[SLP] add test for partially vectorized bswap (PR39538); NFC

4 years ago[X86][CostModel] Update truncate costs for some narrow vector cases to match their...
Craig Topper [Mon, 27 Apr 2020 19:26:10 +0000 (12:26 -0700)]
[X86][CostModel] Update truncate costs for some narrow vector cases to match their wider version.

This updates v4i16->v4i8 with sse2 to match v8i16->v8i8.
Update v2i16->v2i8 and v4i16->v4i8 with sse 4.1 to match v8i16->v8i8.

4 years agofix D78849 for g++ < 7.1
Nick Desaulniers [Mon, 27 Apr 2020 20:46:56 +0000 (13:46 -0700)]
fix D78849 for g++ < 7.1

Summary:
Looks like g++ < 7.1 has a bug resolving calls to member functions without
`this->` in lamdas with `auto` types.  It looks like multiple build bots are
using g++-5.

https://stackoverflow.com/questions/32097759/calling-this-member-function-from-generic-lambda-clang-vs-gcc
https://godbolt.org/z/MiaRt-

Reviewers: MaskRay, efriedma, jyknight, craig.topper, rsmith

Reviewed By: rsmith

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

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

4 years ago[hip] Remove test using `hip_pinned_shadow` attribute. NFC.
Michael Liao [Mon, 27 Apr 2020 20:44:59 +0000 (16:44 -0400)]
[hip] Remove test using `hip_pinned_shadow` attribute. NFC.

4 years agoADT: SmallVector size/capacity use word-size integers when elements are small
Andrew Browne [Sat, 25 Apr 2020 02:26:11 +0000 (19:26 -0700)]
ADT: SmallVector size/capacity use word-size integers when elements are small

SmallVector currently uses 32bit integers for size and capacity to reduce
sizeof(SmallVector). This limits the number of elements to UINT32_MAX.

For a SmallVector<char>, this limits the SmallVector size to only 4GB.
Buffering bitcode output uses SmallVector<char>, but needs >4GB output.

This changes SmallVector size and capacity to conditionally use word-size
integers if the element type is small (<4 bytes). For larger elements types,
the vector size can reach ~16GB with 32bit size.

Making this conditional on the element type provides both the smaller
sizeof(SmallVector) for larger types which are unlikely to grow so large,
and supports larger capacities for smaller element types.

This recommit fixes the same template being instantiated twice on platforms
where uintptr_t is the same as uint32_t.

4 years ago[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON
Han Zhu [Mon, 27 Apr 2020 20:36:52 +0000 (13:36 -0700)]
[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

When LIBCLANG_BUILD_STATIC=ON and LLVM_ENABLE_PIC=ON, PIC version of
libclang.a and libclang.so are built as expected. However libclang.a is
not installed. Looking at the macro llvm_add_library(), when both SHARED
and STATIC are set, it renames the static library to ${name}_static and
then adds it to targets. But when add_clang_library() calls install, it
only checks if ${name} is in targets.

To work around this issue, loop through both ${name} and ${name}_static
and install both of them if they're in targets. This is still correct if
only shared or static library is built. In those cases, only ${name} is
added to targets and cmake install will generate the right install
script depending on the library's type.

Test Plan:
cmake with LIBCLANG_BUILD_STATIC=ON and then ninja install, from master
and this diff. Compare the result directory trees. Confirm that only
difference is the added libclang.a.

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

4 years ago[lld-macho] Add support for emitting dylibs with a single symbol
Jez Ng [Mon, 27 Apr 2020 20:28:53 +0000 (13:28 -0700)]
[lld-macho] Add support for emitting dylibs with a single symbol

Summary:
Add logic for emitting the correct set of load commands and segments
when `-dylib` is passed.

I haven't gotten to implementing a real export trie yet, so we can only
emit a single symbol, but it's enough to replace the YAML test files
introduced in D76252.

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

4 years ago[lld-macho] Add basic symbol table output
Jez Ng [Mon, 27 Apr 2020 20:28:49 +0000 (13:28 -0700)]
[lld-macho] Add basic symbol table output

This diff implements basic support for writing a symbol table.

- Attributes are loosely supported for extern symbols and not at all for
  other types

Immediate future work will involve implementing section merging.

Initial version by Kellie Medlin <kelliem@fb.com>

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

4 years ago[SveEmitter] Add builtins for svlen
Sander de Smalen [Mon, 27 Apr 2020 20:16:17 +0000 (21:16 +0100)]
[SveEmitter] Add builtins for svlen

The svlen builtins return the number of elements in a vector
and are implemented using `llvm.vscale`.

Reviewed By: efriedma

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

4 years agoThread safety analysis: Reword warning after D72635
Aaron Puchert [Mon, 27 Apr 2020 20:20:12 +0000 (22:20 +0200)]
Thread safety analysis: Reword warning after D72635

We allow arbitrary names for capabilities now, and the name didn't play
a role for this anyway.

4 years ago[lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets.
Med Ismail Bennani [Fri, 17 Apr 2020 19:43:41 +0000 (21:43 +0200)]
[lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets.

This patch improves data formatting for CoreFoundation containers:
CFDictionary and CFSet.

These data formatters make the containers and their children appear in Xcode's
variables view (and on the command line) without having to expand the
data structure.

Previous implementation only supported showing the container's element count.

```
(lldb) frame var dict
(__NSCFDictionary *) dict = 0x00000001004062b0 2 key/value pairs

(lldb) frame var set
(__NSCFSet *) set = 0x0000000100406330 2 elements
```
Now the variable can be dereferenced to dispaly the container's children:

```
(lldb) frame var *dict
(__NSCFDictionary) *dict = {
  [0] = {
    key = 0x0000000100004050 @"123"
    value = 0x0000000100004090 @"456"
  }
  [1] = {
    key = 0x0000000100004030 @"abc"
    value = 0x0000000100004070 @"def"
  }
}

(lldb) frame var *set
(__NSCFSet) *set = {
  [0] = 0x0000000100004050 @"123"
  [1] = 0x0000000100004030 @"abc"
}
```

rdar://39882287

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[libc++][test] Disable test for extension that's unsupportable in C++20
Casey Carter [Mon, 27 Apr 2020 16:55:00 +0000 (09:55 -0700)]
[libc++][test] Disable test for extension that's unsupportable in C++20

Defining the nested types `reference` and `iterator_concept` of `reverse_iterator<I>` necessarily requires `I` to be complete in C++20. These tests that verify that `std::map<int, X>::reverse_iterator` can be instantiated when `X` is incomplete are going to have a bad time.

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

4 years ago[mlir][SCCP] Add support for propagating across symbol based calls
River Riddle [Mon, 27 Apr 2020 19:58:23 +0000 (12:58 -0700)]
[mlir][SCCP] Add support for propagating across symbol based calls

This revision adds support for propagating constants across symbol-based callgraph edges. It uses the existing Call/CallableOpInterfaces to detect the dataflow edges, and propagates constants through arguments and out of returns.

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

4 years ago[mlir][Symbol] Change Symbol from a Trait into an OpInterface.
River Riddle [Mon, 27 Apr 2020 19:57:32 +0000 (12:57 -0700)]
[mlir][Symbol] Change Symbol from a Trait into an OpInterface.

This provides a much cleaner interface into Symbols, and allows for users to start injecting op-specific information. For example, derived op can now inject when a symbol can be discarded if use_empty. This would let us drop unused external functions, which generally have public visibility.

This revision also adds a new `extraTraitClassDeclaration` field to ODS OpInterface to allow for injecting declarations into the trait class that gets attached to the operations.

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

4 years ago[SLP] refactor load-combine logic; NFC
Sanjay Patel [Mon, 27 Apr 2020 20:01:01 +0000 (16:01 -0400)]
[SLP] refactor load-combine logic; NFC

We may want to identify sequences that are not
reductions, but still qualify as load-combines
in the back-end, so make most of the body a
helper function.

4 years ago[lld-macho] Extend SyntheticSections to cover all segment load commands
Jez Ng [Mon, 27 Apr 2020 19:50:59 +0000 (12:50 -0700)]
[lld-macho] Extend SyntheticSections to cover all segment load commands

Previously, the special segments `__PAGEZERO` and `__LINKEDIT` were
implemented as special LoadCommands. This diff implements them using
special sections instead which have an `isHidden()` attribute. We do not
emit section headers for hidden sections, but we use their addresses and
file offsets to determine that of their containing segments. In addition
to allowing us to share more segment-related code, this refactor is also
important for the next step of emitting dylibs:

1) dylibs don't have segments like __PAGEZERO, so we need an easy way of
   omitting them w/o messing up segment indices
2) Unlike the kernel, which is happy to run an executable with
   out-of-order segments, dyld requires dylibs to have their segment
   load commands arranged in increasing address order. The refactor
   makes it easier to implement sorting of sections and segments.

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

4 years ago[PowerPC][Future] Remove "unskipableSimplifyCode()" in PPCMIPeephole.cpp
Victor Huang [Mon, 27 Apr 2020 19:23:39 +0000 (14:23 -0500)]
[PowerPC][Future] Remove "unskipableSimplifyCode()" in PPCMIPeephole.cpp

"unskipableSimplifyCode()" was added to handle unsafe BL8_NOTOC instruction
when TOC was not completely removed. The function is not needed after confirming
TOC pointer is not used in a function that uses PC-Relative addressing.

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

4 years ago[InstCombine] add tests for set/clear masked bits; NFC
Sanjay Patel [Sun, 26 Apr 2020 15:49:47 +0000 (11:49 -0400)]
[InstCombine] add tests for set/clear masked bits; NFC

4 years ago[MLIR] Add getBody() method to SingleImplicitBlockTerminator op trait.
Alexander Belyaev [Mon, 27 Apr 2020 19:46:35 +0000 (21:46 +0200)]
[MLIR] Add getBody() method to SingleImplicitBlockTerminator op trait.

Many ops with this trait have `getBody()` and `getBodyBuilder()` methods defined in `extraClassDeclaration` in tablegen. `getBody()` implementation is the same accross all these ops, but `getBodyBuilder()` can return builders with varying insertion points set. In this PR, `getBody()` is moved into `SingleImplicitBlockTerminator` struct and `getBodyBuilder()` is replaced with `OpBuilder::atBlock(End|Terminator)(op.getBody);`.

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

4 years agoRecommit "Generate Callee Saved Register (CSR) related cfi directives
Wei Mi [Thu, 13 Feb 2020 17:23:27 +0000 (09:23 -0800)]
Recommit "Generate Callee Saved Register (CSR) related cfi directives
like .cfi_restore"

Insert .cfi_offset/.cfi_register when IncomingCSRSaved of current block
is larger than OutgoingCSRSaved of its previous block.

Original commit message:
https://reviews.llvm.org/D42848 only handled CFA related cfi directives but
didn't handle CSR related cfi. The patch adds the CSR part. Basically it reuses
the framework created in D42848. For each basicblock, the patch tracks which
CSR set have been saved at its CFG predecessors's exits, and compare the CSR
set with the set at its previous basicblock's exit (The previous block is the
block laid before the current block). If the saved CSR set at its previous
basicblock's exit is larger, .cfi_restore will be inserted.

The patch also generates proper .cfi_restore in epilogue to make sure the
saved CSR set is consistent for the incoming edges of each block.

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

4 years ago[clang-format] NFC clang-format the clang-format sources
mydeveloperday [Mon, 27 Apr 2020 19:41:01 +0000 (20:41 +0100)]
[clang-format] NFC clang-format the clang-format sources

Summary: In recent patches the clang-format code has become un-formatted, correct this before making additional changes

Reviewers: mitchell-stellar, sylvestre.ledru, Abpostelnicu, Wawha, jbcoe

Reviewed By: sylvestre.ledru, Abpostelnicu, jbcoe

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years agomake sure to not warn about unused macros from -D
Luboš Luňák [Sun, 2 Feb 2020 11:15:40 +0000 (12:15 +0100)]
make sure to not warn about unused macros from -D

If a PCH is used for compilation, SourceManager::isInMainFile()
returns true even for the "<built-in>" predefines area. Using -D
only for the TU compilation may trigger -Wunused-macros for it.
It is admitedly a bit fishy to set a macro only for a TU and not
for the PCH, but this works fine if the PCH does not use the macro
(I couldn't find a statement on this for Clang, but GCC explicitly
allows this in the docs).

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

4 years ago[MachineVerifier] retrofit iterators with range for. NFC
Nick Desaulniers [Mon, 27 Apr 2020 18:50:06 +0000 (11:50 -0700)]
[MachineVerifier] retrofit iterators with range for. NFC

Summary:
Reviewing failures identified in D78586, I was finding the identifiers
for these iterators hard to read.

Reviewers: efriedma, MaskRay, jyknight

Reviewed By: MaskRay

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

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

4 years ago[X86][CostModel] Update costs for vector truncate with avx512f/avx512bw.
Craig Topper [Mon, 27 Apr 2020 18:53:41 +0000 (11:53 -0700)]
[X86][CostModel] Update costs for vector truncate with avx512f/avx512bw.

All avx512 truncate instructions except vXi64->vXi32 are 2 uops
on port 5. So raise their costs to 2. Except when we have an
earlier faster sequence like pshufb for 128 bit input vectors.

Add a lower cost of 3 v16i16->v16i8 with avx512f where we can
extend to v16i32 then truncate. And a cost of 2 for avx512bw with
and without avx512vl. There we can use vpmovwb with either a ymm
or zmm input. Both of these beat masking, splitting, and using
packuswb which is our avx/avx2 codegen.

4 years ago[xray] Preserve x8 in trampoline on AArch64
Ian Levesque [Tue, 21 Apr 2020 22:44:19 +0000 (18:44 -0400)]
[xray] Preserve x8 in trampoline on AArch64

Summary: Fixes an ABI violation in the trampoline code for AArch64 that causes the indirect result register to get overwritten if the XRay handler function is complex enough to use it.

Reviewers: MaskRay, dberris, johnislarry

Subscribers: kristof.beyls, danielkiss, #sanitizers

Tags: #sanitizers

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

4 years ago[GlobalISel] Remove debug locations when emitting constants.
Davide Italiano [Mon, 27 Apr 2020 18:24:36 +0000 (11:24 -0700)]
[GlobalISel] Remove debug locations when emitting constants.

The tl;dr story is that this causes jumps in the emitted line
tables, even at `-O0`. We could at some point consider more fancy
solutions to preserve locations, but it doesn't seem to be worth
the effort for now.

<rdar://problem/62460788>

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

4 years ago[llvm-objcopy] Don't specialize the all zero p_paddr case
Fangrui Song [Fri, 24 Apr 2020 03:47:52 +0000 (20:47 -0700)]
[llvm-objcopy] Don't specialize the all zero p_paddr case

Spotted by https://reviews.llvm.org/D74755#1998673

> it looks like OrderedSegments in the function is only used to set the physical address to the virtual address when there are no physical addresses set amongst these sections.

I believe this behavior was copied from https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6ffd79000b45e77b3625143932ffbf781b6aecab (2008-05)
The commit was made for some corner cases of very old linkers.
This special rule does not seem useful and remove it can allow us to
delete a large chunk of code.

Reviewed By: jhenderson, jakehehrlich

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

4 years agoStrip -showIncludes in getClangStripDependencyFileAdjuster()
Arthur Eubanks [Mon, 27 Apr 2020 16:14:11 +0000 (09:14 -0700)]
Strip -showIncludes in getClangStripDependencyFileAdjuster()

Summary:
Follow-up to https://reviews.llvm.org/D78836.

Also consolidate some test cases.

Reviewers: thakis

Subscribers: cfe-commits

Tags: #clang

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

4 years agoremove temporary logging again now that things are figured out
Nico Weber [Mon, 27 Apr 2020 18:00:25 +0000 (14:00 -0400)]
remove temporary logging again now that things are figured out

4 years ago[lld] Support --lto-emit-asm and --plugin-opt=emit-asm
Hongtao Yu [Wed, 1 Apr 2020 17:01:23 +0000 (10:01 -0700)]
[lld] Support --lto-emit-asm and --plugin-opt=emit-asm

Summary: The switch --plugin-opt=emit-asm can be used with the gold linker to dump the final assembly code generated by LTO in a user-friendly way. Unfortunately it doesn't work with lld. I'm hooking it up with lld. With that switch, lld emits assembly code into the output file (specified by -o) and if there are multiple input files, each of their assembly code will be emitted into a separate file named by suffixing the output file name with a unique number, respectively. The linking then stops after generating those assembly files.

Reviewers: espindola, wenlei, tejohnson, MaskRay, grimar

Reviewed By: tejohnson, MaskRay, grimar

Subscribers: pcc, emaste, inglorion, arichardson, hiraditya, MaskRay, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoAdd a comment to TarWriterTest.LongFilename
Nico Weber [Mon, 27 Apr 2020 17:58:53 +0000 (13:58 -0400)]
Add a comment to TarWriterTest.LongFilename

4 years ago[PowerPC][Future] Implement PC Relative Tail Calls
Stefan Pintilie [Fri, 24 Apr 2020 02:04:11 +0000 (21:04 -0500)]
[PowerPC][Future] Implement PC Relative Tail Calls

Tail Calls were initially disabled for PC Relative code because it was not safe
to make certain assumptions about the tail calls (namely that all compiled
functions no longer used the TOC pointer in R2). However, once all of the
TOC pointer references have been removed it is safe to tail call everything
that was tail called prior to the PC relative additions as well as a number of
new cases.
For example, it is now possible to tail call indirect functions as there is no
need to save and restore the TOC pointer for indirect functions if the caller
is marked as may clobber R2 (st_other=1). For the same reason it is now also
possible to tail call functions that are external.

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

4 years ago[X86][SSE] Regenerate oddsubvector.ll test checks
Simon Pilgrim [Mon, 27 Apr 2020 16:59:10 +0000 (17:59 +0100)]
[X86][SSE] Regenerate oddsubvector.ll test checks

Fixes some missed address symbol regexs

4 years ago[JITLink] Fix endianness bug fedd32e2fa36.
Lang Hames [Mon, 27 Apr 2020 17:23:47 +0000 (10:23 -0700)]
[JITLink] Fix endianness bug fedd32e2fa36.

The ByteSwap_NN functions return their result rather than modifying their
argument in-place, so we need to write the result back to CPUType here.

4 years ago[libc++] Properly handle --no-execute in the new format
Louis Dionne [Mon, 27 Apr 2020 17:37:00 +0000 (13:37 -0400)]
[libc++] Properly handle --no-execute in the new format

If --no-execute is passed, we shouldn't report XFAIL tests as passing,
or they will be considered to XPASS.

4 years agoReland D78945 TarWriter: Only use 137 of the 155 prefix bytes.
Fangrui Song [Mon, 27 Apr 2020 17:00:23 +0000 (13:00 -0400)]
Reland D78945 TarWriter: Only use 137 of the 155 prefix bytes.

With a fix to unittests/Support/TarWriterTest.cpp

This makes lld's --reproduce output more compatible with tar 1.13 and
before.  This is a very old version of tar, but it's the version in
both gnuwin and unxutils, and the cost for supporting them are very
low, so we might as well just do that.

https://bugs.chromium.org/p/chromium/issues/detail?id=1073524#c21
and onward has more details.

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

4 years ago[X86][CostModel] Improve costs for fp_to_uint/fp_to_sint for vXi8/vXi16/v2i32 results.
Craig Topper [Mon, 27 Apr 2020 17:11:02 +0000 (10:11 -0700)]
[X86][CostModel] Improve costs for fp_to_uint/fp_to_sint for vXi8/vXi16/v2i32 results.

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

4 years agoRevert "TarWriter: Only use 137 of the 155 prefix bytes."
Nico Weber [Mon, 27 Apr 2020 17:34:04 +0000 (13:34 -0400)]
Revert "TarWriter: Only use 137 of the 155 prefix bytes."

This reverts commit 90d6ed144c1352e393556a799e79da6ec3a5fab9.
Breaks check-llvm. Revert while I investigate.