platform/upstream/llvm.git
4 years ago[AMDGPU] Remove uses of Register::isPhysicalRegister/isVirtualRegister
Jay Foad [Thu, 20 Aug 2020 16:46:16 +0000 (17:46 +0100)]
[AMDGPU] Remove uses of Register::isPhysicalRegister/isVirtualRegister

... in favour of the isPhysical/isVirtual methods.

4 years ago[NFC] Expose the -Oz module optimization pipeline to opt
Mircea Trofin [Wed, 19 Aug 2020 16:30:52 +0000 (09:30 -0700)]
[NFC] Expose the -Oz module optimization pipeline to opt

This exposes the module optimization pipeline as a pass that can be
applied stand-alone when using 'opt'. This helps ml inliner training
scenarios, where we start with IR captured right before inlining,
perform the inlining (-scc-oz-module-inliner) and then want to continue
and observe the final IR (where this patch comes into play). We can then
apply llc on the resulting IR to continue compilation down to native.

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

4 years ago[lldb][asan] Mark destructor as virtual to allow subclasses.
Jordan Rupprecht [Thu, 20 Aug 2020 16:15:37 +0000 (09:15 -0700)]
[lldb][asan] Mark destructor as virtual to allow subclasses.

`lldb_private::ScriptInterpreterPython::CommandDataPython` inherits from `lldb_private::BreakpointOptions::CommandData`, but the latter does not have a virtual destructor. This leads to a new-delete-type-mismatch error when running certain tests (such as `functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py`) under asan.

4 years ago[libc] Add a class called NormalFloat which represents normalized floats.
Siva Chandra Reddy [Wed, 19 Aug 2020 08:08:03 +0000 (01:08 -0700)]
[libc] Add a class called NormalFloat which represents normalized floats.

This class helps in dealing with normal and subnormal numbers uniformly.
Moreover, since this class has been designed to handle all floating
formats across platforms, it helps implement floating point functions in
a uniform manner.

The implementations of frexp and logb have been switched to use this new
class as it allows us to use just one implementation across all
different floating point formats.

Reviewed By: lntue

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

4 years ago[PeepholeOptimizer] Remove dead code
Jay Foad [Thu, 20 Aug 2020 15:47:30 +0000 (16:47 +0100)]
[PeepholeOptimizer] Remove dead code

At this point we have already ruled out all def operands, so we can't
possibly see a dead implicit def operand.

4 years ago[libc][NFC] Switch math tests to the new ULP based tolerance.
Siva Chandra Reddy [Thu, 20 Aug 2020 06:19:44 +0000 (23:19 -0700)]
[libc][NFC] Switch math tests to the new ULP based tolerance.

Reviewed By: lntue

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

4 years ago[SyntaxTree] Split tests related to Namespace
Eduardo Caldas [Tue, 18 Aug 2020 12:16:57 +0000 (12:16 +0000)]
[SyntaxTree] Split tests related to Namespace

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

4 years ago[SyntaxTree] Unify logic for generating `id-expression`
Eduardo Caldas [Thu, 20 Aug 2020 14:18:55 +0000 (14:18 +0000)]
[SyntaxTree] Unify logic for generating `id-expression`

4 years ago[SyntaxTree] Add support for `MemberExpression`
Eduardo Caldas [Wed, 19 Aug 2020 16:43:33 +0000 (16:43 +0000)]
[SyntaxTree] Add support for `MemberExpression`

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

4 years agolld docs config: Use a list key in html_sidebars
Hans Wennborg [Thu, 20 Aug 2020 14:44:14 +0000 (16:44 +0200)]
lld docs config: Use a list key in html_sidebars

Otherwise the docs-lld-html target fails to build using recent Sphinx
with the following not very helpful error message:

An error happened in rendering the page index.
Reason: TemplateNotFound()

It turns out the values in the html_sidebars dictionary always need to be lists
now. See https://github.com/sphinx-doc/sphinx/issues/6186

4 years ago[lldb/Utility] Simplify Scalar handling of float types
Pavel Labath [Mon, 17 Aug 2020 12:18:44 +0000 (14:18 +0200)]
[lldb/Utility] Simplify Scalar handling of float types

Similarly to D85836, collapse all Scalar float types to a single enum
value, and use APFloat semantics to differentiate between. This
simplifies the code, and opens to door to supporting other floating
point semantics (which would be needed for fully supporting
architectures with more interesting float types such as PPC).

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

4 years ago[index-while-building] Fix build with -DBUILD_SHARED_LIBS=True
Alex Bradbury [Thu, 20 Aug 2020 14:12:56 +0000 (15:12 +0100)]
[index-while-building] Fix build with -DBUILD_SHARED_LIBS=True

The dependencies in clang/lib/IndexSerialization/CMakeLists.txt were
incomplete, leading to link errors for a -DBUILD_SHARED_LIBS=True build.

4 years agoAdd triples to fixed-point tests which lacked them.
Bevin Hansson [Thu, 20 Aug 2020 13:34:44 +0000 (15:34 +0200)]
Add triples to fixed-point tests which lacked them.

This caused failures on clang-x390x-linux.

4 years ago[LV] Allow tail folded reduction selects to remain in the loop
David Green [Thu, 20 Aug 2020 13:31:14 +0000 (14:31 +0100)]
[LV] Allow tail folded reduction selects to remain in the loop

The normal scheme for tail folding reductions is to use:

loop:
  p = phi(0, a)
  mask = ...
  x = masked_load(..., mask)
  a = add(x, p)
s = select(mask, a, p)

This means we need to keep the register p and a alive out of the loop, plus
the mask. On a target with predicated operations we can instead generate
the phi as p = phi(0, s). This ensures the select in the loop and we can
fold select(m, add(a, b), c) to something like a vaddt c, a, b using the
m predicate. This in turn allows us to tail predicate the entire loop.

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

4 years agoRevert "[compiler-rt] Compile assembly files as ASM not C"
Raphael Isemann [Thu, 20 Aug 2020 13:23:50 +0000 (15:23 +0200)]
Revert "[compiler-rt] Compile assembly files as ASM not C"

This reverts commit d58fd4e52197d55bf42ca446c8b0ed31b5c2ec1f. This broke
compiler-rt compilation on macOS:

codesign --sign - /Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/clang/12.0.99/lib/darwin/libclang_rt.tsan_ios_dynamic.dylib
ld: warning: ignoring file projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_ios_dynamic.dir/rtl/tsan_rtl_amd64.S.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
ld: warning: ignoring file projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_ios_dynamic.dir/rtl/tsan_rtl_aarch64.S.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
  "_wrap__setjmp", referenced from:
      substitution__setjmp in tsan_interceptors_posix.cpp.o
  "_wrap_setjmp", referenced from:
      substitution_setjmp in tsan_interceptors_posix.cpp.o
  "_wrap_sigsetjmp", referenced from:
      substitution_sigsetjmp in tsan_interceptors_posix.cpp.o
ld: symbol(s) not found for architecture arm64

4 years ago[lldb] Forcefully complete a type when adding typedefs
Pavel Labath [Wed, 19 Aug 2020 13:52:58 +0000 (15:52 +0200)]
[lldb] Forcefully complete a type when adding typedefs

This is very similar to D85968, only more elusive to since we were not
adding the typedef type to the relevant DeclContext until D86140, which
meant that the DeclContext was populated (and the relevant assertion
hit) only after importing the type into the expression ast in a
particular way.

I haven't checked whether this situation can be hit in the gmodules
case, but my money is on "yes".

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

4 years agoFix -allow-enabling-analyzer-alpha-checkers always being passed to run-clang-tidy.py
Joachim Priesner [Thu, 20 Aug 2020 13:15:29 +0000 (09:15 -0400)]
Fix -allow-enabling-analyzer-alpha-checkers always being passed to run-clang-tidy.py

The action='store_true' option of argparse.add_argument implicitly
generates a default value of False if the argument is not specified.
Thus, the allow_enabling_alpha_checkers argument of
get_tidy_invocation is never None.

4 years ago[clangd] Don't crash on `#pragma clang __debug parser_crash`
Aleksandr Platonov [Thu, 20 Aug 2020 12:50:13 +0000 (15:50 +0300)]
[clangd] Don't crash on `#pragma clang __debug parser_crash`

Currently, clangd crashes when opening a file with `#pragma clang __debug parser_crash` (e.g. clang/test/Modules/Inputs/crash.h).
This patch disables these crashes.

Reviewed By: kadircet

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

4 years ago[clangd] Remove useless stderr logging.
Adam Czachorowski [Thu, 20 Aug 2020 12:48:02 +0000 (14:48 +0200)]
[clangd] Remove useless stderr logging.

This was accidentally added in 53b9199a5cdba8a6e294e1fb183f308ec558db22

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

4 years ago[AArch64] Update a code comment incorrectly referring to zero_reg. NFC
Bjorn Pettersson [Thu, 20 Aug 2020 12:36:20 +0000 (14:36 +0200)]
[AArch64] Update a code comment incorrectly referring to zero_reg. NFC

The getSrcFromCopy helper nowadays return a MachineOperand pointer,
so talking about zero_reg was incorrect as it nowadays return
a nullptr when not finding a copy like instruction.

4 years ago[clang] When loading preamble from AST file, re-export modules in Sema.
Adam Czachorowski [Fri, 14 Aug 2020 14:37:34 +0000 (16:37 +0200)]
[clang] When loading preamble from AST file, re-export modules in Sema.

This addresses a FIXME in ASTReader.

Modules were already re-exported for Preprocessor, but not for Sema.
The result was that, with -fmodules-local-submodule-visibility, all AST
nodes belonging to a module that was loaded in a premable where not
accesible from the main part of the file and a diagnostic recommending
importing those modules would be generated.

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

4 years ago[clangd] Fix crash-bug in preamble indexing when using modules.
Adam Czachorowski [Thu, 13 Aug 2020 15:24:22 +0000 (17:24 +0200)]
[clangd] Fix crash-bug in preamble indexing when using modules.

When preamble contains #undef, indexing code finds the matching #define
and uses that during indexing. However, it would only look for local
definitions. If the macro was defined in a module, MacroInfo
would be nullptr and clangd would crash.

This change makes clangd ignore any #undef without a matching #define
inside the same TU.

The indexing of macros happens for preamble only, so then #undef must be
in the preamble, which is why we need two .h files in a test.

Note that clangd is currently not ready for module support, but this
brings us one step closer.

This was previously attempted in
4061d9e42cff621462931ac7df9666806c77a237, but had to be reverted due to
broken test. This version fixes that test-only bug by setting a custom module
cache path to avoid re-use of modules across test invocations.

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

4 years agoFix Wdocumentation unknown parameter warning. NFC.
Simon Pilgrim [Thu, 20 Aug 2020 11:41:34 +0000 (12:41 +0100)]
Fix Wdocumentation unknown parameter warning. NFC.

4 years ago[ARM] Regenerate mve-vabd.ll test. NFC
David Green [Thu, 20 Aug 2020 11:24:27 +0000 (12:24 +0100)]
[ARM] Regenerate mve-vabd.ll test. NFC

4 years ago[Attributor] Handle CallBase case in AAValueConstantRange::initialize
Shinji Okumura [Thu, 20 Aug 2020 10:52:53 +0000 (19:52 +0900)]
[Attributor] Handle CallBase case in AAValueConstantRange::initialize

Currently, although we handle `CallBase` case in updateImpl, we give up in initialize in the case.
That is problematic when we propagate a range from call site returned position to floating position.

Reviewed By: jdoerfert

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

4 years ago[APInt] Allow self-assignment with libstdc++
Vitaly Buka [Thu, 20 Aug 2020 11:12:49 +0000 (04:12 -0700)]
[APInt] Allow self-assignment with libstdc++

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/8256/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Athinlto-function-summary-paramaccess.ll

Reviewed By: RKSimon

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

4 years agoRevert "[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic."
Georgii Rymar [Thu, 20 Aug 2020 11:04:30 +0000 (14:04 +0300)]
Revert "[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic."

This reverts commit 455d5a8a065b4b93df11d1696dc1546c403465a5.

It broke UBSan:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/21386/steps/check-llvm%20ubsan/logs/stdio

/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/tools/llvm-readobj/ELF/malformed-pt-dynamic.test:62:10: error: WARN3: expected string not found in input
# WARN3: error: '[[FILE]]': Invalid data was encountered while parsing the file
         ^
<stdin>:2:1: note: scanning from here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:1956:46: runtime error: addition of unsigned offset to 0x0000020c5b30 overflowed to 0x0000020c5b2f
^
<stdin>:2:1: note: with "FILE" equal to "/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/test/tools/llvm-readobj/ELF/Output/malformed-pt-dynamic\\.test\\.tmp3"
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:1956:46: runtime error: addition of unsigned offset to 0x0000020c5b30 overflowed to 0x0000020c5b2f
^
<stdin>:2:117: note: possible intended match here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:1956:46: runtime error: addition of unsigned offset to 0x0000020c5b30 overflowed to 0x0000020c5b2f
                                                                                                                    ^
Input file: <stdin>
Check file: /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/test/tools/llvm-readobj/ELF/malformed-pt-dynamic.test

4 years ago[SVE] Add ISEL patterns for predicated shifts by an immediate.
Paul Walker [Fri, 14 Aug 2020 17:28:38 +0000 (18:28 +0100)]
[SVE] Add ISEL patterns for predicated shifts by an immediate.

For scalable vector shifts the prediacte is typically all active,
which gets selected to an unpredicated shift by immediate.  When
code generating for fixed length vectors the predicate is based
on the vector length and so additional patterns are required to
make use of SVE's predicated shift by immediate instructions.

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

4 years ago[GlobalOpt] Fix an incorrect Modified status
David Stenberg [Thu, 20 Aug 2020 07:05:37 +0000 (09:05 +0200)]
[GlobalOpt] Fix an incorrect Modified status

When removing a non-constant store to a global in
CleanupPointerRootUsers(), the GlobalOpt pass could incorrectly return
false.

This was caught using the check introduced by D80916.

Reviewed By: efriedma

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

4 years agoReland "[LoopUnswitch] Fix incorrect Modified status"
David Stenberg [Thu, 20 Aug 2020 06:28:24 +0000 (08:28 +0200)]
Reland "[LoopUnswitch] Fix incorrect Modified status"

Relanded since the buildbot issue was unrelated to this commit.

When hoisting simple values out from a loop, and an optsize attribute, a
convergent call, or an invoke instruction hindered the pass from
unswitching the loop, the pass would return an incorrect Modified
status.

This was caught using the check introduced by D80916.

Reviewed By: asbirlea

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

4 years ago[DebugInfo] Fix DwarfExpression::addConstantFP for float on big-endian
Bjorn Pettersson [Thu, 20 Aug 2020 09:41:05 +0000 (11:41 +0200)]
[DebugInfo] Fix DwarfExpression::addConstantFP for float on big-endian

The byte swapping, when dealing with 4 byte (float) FP constants
in DwarfExpression::addConstantFP, added in commit ef8992b9f0189005
was not correct. It always performed byte swapping using an
uint64_t value. When dealing with 4 byte values the 4 interesting
bytes ended up in the big end of the uint64_t, but later we emitted
the 4 bytes at the little end. So we ended up with zeroes being
emitted and faulty debug information.

This patch simplifies things a bit, IMHO. Using the APInt
representation throughout the function, instead of looking at
the internal representation using getRawBytes and without using
reinterpret_cast etc. And using API.byteSwap() should result in
correct byte swapping independent of APInt being 4 or 8 bytes.

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

4 years ago[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.
Georgii Rymar [Wed, 19 Aug 2020 11:14:38 +0000 (14:14 +0300)]
[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.

The code that reports "PT_DYNAMIC segment offset + size exceeds the size of the file"
has an issue: it is possible to bypass the validation by overflowing the size + offset result.

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

4 years agoRevert "[LoopUnswitch] Fix incorrect Modified status"
David Stenberg [Thu, 20 Aug 2020 09:11:48 +0000 (11:11 +0200)]
Revert "[LoopUnswitch] Fix incorrect Modified status"

This reverts commit dfd447c22043b0a64bf1d146735ca33f926bd22d.

After I pushed this commit, llvm-sphinx-docs started failing, due to:

  Warning, treated as error:
  extension 'recommonmark' has no setup() function;
  is it really a Sphinx extension module?

I don't see how this commit may have caused that, but I'm still
reverting it since I don't know how to proceed with that
troubleshooting.

4 years ago[ThinLTO] Import globals recursively
Evgeny Leviant [Thu, 20 Aug 2020 09:13:43 +0000 (12:13 +0300)]
[ThinLTO] Import globals recursively

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

4 years ago[AMDGPU] Add A16/G16 to InstCombine
Sebastian Neubauer [Thu, 4 Jun 2020 10:22:36 +0000 (12:22 +0200)]
[AMDGPU] Add A16/G16 to InstCombine

When sampling from images with coordinates that only have 16 bit
accuracy, convert the image intrinsic call to use a16 or g16.
This does only happen if the target hardware supports it.

An alternative would be to always apply this combination, independent of
the target hardware and extend 16 bit arguments to 32 bit arguments
during legalization. To me, this sounds like an unnecessary roundtrip
that could prevent some further InstCombine optimizations.

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

4 years ago[GlobalISel][IRTranslator] Support PHI instructions in landingpad blocks
Konstantin Schwarz [Tue, 18 Aug 2020 08:32:44 +0000 (10:32 +0200)]
[GlobalISel][IRTranslator] Support PHI instructions in landingpad blocks

The check for the landingpad instructions was overly restrictive. In optimimized builds PHI nodes can appear
before the landingpad instructions, resulting in a fallback to SelectionDAG.

This change relaxes the check to allow PHI nodes.

Reviewed By: arsenm

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

4 years ago[yaml2obj] - Make the 'Machine' key optional.
Georgii Rymar [Tue, 18 Aug 2020 12:24:26 +0000 (15:24 +0300)]
[yaml2obj] - Make the 'Machine' key optional.

Currently we have to set 'Machine' to something in our
YAML descriptions. Usually we use 'EM_X86_64' for 64-bit targets
and 'EM_386' for 32-bit targets. At the same time, in fact, in most
cases our tests do not need a machine type and we can use
'EM_NONE'.

This is cleaner, because avoids the need of using a particular machine.

In this patch I've made the 'Machine' key optional (the default value,
when it is not specified is `EM_NONE`) and removed it (where possible)
from yaml2obj, obj2yaml and llvm-readobj tests.

There are few tests left where I decided not to remove it, because
I didn't want to touch CHECK lines or doing anything more complex
than a removing a "Machine: *" line and formatting lines around.

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

4 years agoRefactor most of the fixed-point tests.
Bevin Hansson [Thu, 20 Aug 2020 08:24:03 +0000 (10:24 +0200)]
Refactor most of the fixed-point tests.

The tests were not written with update_cc_test_checks
in mind, which make them difficult to update. Fix this.

Also, some of the consteval tests were outright broken,
since the CHECK lines were wrong.

Other than this, the semantics of the tests are preserved.

4 years ago[IR] Add FixedPointBuilder.
Bevin Hansson [Wed, 5 Aug 2020 14:40:05 +0000 (16:40 +0200)]
[IR] Add FixedPointBuilder.

This patch adds a convenience class for using FixedPointSemantics
to build fixed-point operations in IR.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-August/144025.html

Reviewed By: rjmccall

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

4 years ago[ADT] Move FixedPoint.h from Clang to LLVM.
Bevin Hansson [Thu, 16 Jul 2020 11:56:07 +0000 (13:56 +0200)]
[ADT] Move FixedPoint.h from Clang to LLVM.

This patch moves FixedPointSemantics and APFixedPoint
from Clang to LLVM ADT.

This will make it easier to use the fixed-point
classes in LLVM for constructing an IR builder for
fixed-point and for reusing the APFixedPoint class
for constant evaluation purposes.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-August/144025.html

Reviewed By: leonardchan, rjmccall

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

4 years ago[AST] Get field size in chars rather than bits in RecordLayoutBuilder.
Bevin Hansson [Tue, 4 Aug 2020 10:55:38 +0000 (12:55 +0200)]
[AST] Get field size in chars rather than bits in RecordLayoutBuilder.

In D79719, LayoutField was refactored to fetch the size of field
types in bits and then convert to chars, rather than fetching
them in chars directly. This is not ideal, since it makes the
calculations char size dependent, and breaks for sizes that
are not a multiple of the char size.

This patch changes it to use getTypeInfoInChars instead of
getTypeInfo.

Reviewed By: efriedma

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

4 years ago[MLIR] Redundancy detection for FlatAffineConstraints using Simplex
Arjun P [Thu, 20 Aug 2020 08:07:44 +0000 (13:37 +0530)]
[MLIR] Redundancy detection for FlatAffineConstraints using Simplex

This patch adds the capability to perform constraint redundancy checks for `FlatAffineConstraints` using `Simplex`, via a new member function `FlatAffineConstraints::removeRedundantConstraints`. The pre-existing redundancy detection algorithm runs a full rational emptiness check for each inequality separately for checking redundancy. Leveraging the existing `Simplex` infrastructure, in this patch we have an algorithm for redundancy checks that can check each constraint by performing pivots on the tableau, which provides an alternative to running Fourier-Motzkin elimination for each constraint separately.

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

4 years ago[AMDGPU][LoopUnroll] Increase BB size to analyze for complete unroll.
dfukalov [Wed, 19 Aug 2020 21:14:14 +0000 (00:14 +0300)]
[AMDGPU][LoopUnroll] Increase BB size to analyze for complete unroll.

The `UnrollMaxBlockToAnalyze` parameter is used at the stage when we have no
information about a loop body BB cost. In some cases, e.g. for simple loop
```
for(int i=0; i<32; ++i){
  D = Arr2[i*8 + C1];
  Arr1[i*64 + C2] += C3 * D;
  Arr1[i*64 + C2 + 2048] += C4 * D;
}

```
current default parameter value is not enough to run deeper cost analyze so the
loop is not completely unrolled.

Reviewed By: rampitec

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

4 years ago[compiler-rt] Compile assembly files as ASM not C
Petr Hosek [Thu, 20 Aug 2020 07:03:45 +0000 (00:03 -0700)]
[compiler-rt] Compile assembly files as ASM not C

It isn't very wise to pass an assembly file to the compiler and tell it to compile as a C file and hope that the compiler recognizes it as assembly instead.
Instead enable the ASM language and mark the files as being ASM.

[525/634] Building C object lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
FAILED: lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
/opt/tooling/drive/host/bin/clang --target=aarch64-linux-gnu -I/opt/tooling/drive/llvm/compiler-rt/lib/tsan/.. -isystem /opt/tooling/drive/toolchain/opt/drive/toolchain/include -x c -Wall -Wno-unused-parameter -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fPIE -fno-rtti -Wframe-larger-than=530 -Wglobal-constructors --sysroot=. -MD -MT lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -MF lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o.d -o lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -c /opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
/opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S:29:1: error: expected identifier or '('
.section .text
^
1 error generated.

Fixed Clang not being passed as the assembly compiler for compiler-rt runtime build.

Patch By: tambre

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

4 years ago[ARM][MachineOutliner] Add default mode.
Yvan Roux [Thu, 20 Aug 2020 07:25:33 +0000 (09:25 +0200)]
[ARM][MachineOutliner] Add default mode.

Use the stack to save and restore the link register when there is no
available register to do it.

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

4 years ago[LoopUnswitch] Fix incorrect Modified status
David Stenberg [Thu, 20 Aug 2020 06:28:24 +0000 (08:28 +0200)]
[LoopUnswitch] Fix incorrect Modified status

When hoisting simple values out from a loop, and an optsize attribute, a
convergent call, or an invoke instruction hindered the pass from
unswitching the loop, the pass would return an incorrect Modified
status.

This was caught using the check introduced by D80916.

Reviewed By: asbirlea

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

4 years ago[Attributor][FIX] Update the call graph properly when internalizing functions
Johannes Doerfert [Tue, 18 Aug 2020 20:54:05 +0000 (15:54 -0500)]
[Attributor][FIX] Update the call graph properly when internalizing functions

The internal version is now part of the SCC, make sure to perform this
update.

4 years ago[Attributor] Simplify comparison against constant null pointer
Johannes Doerfert [Tue, 18 Aug 2020 15:03:25 +0000 (10:03 -0500)]
[Attributor] Simplify comparison against constant null pointer

Comparison against null is a common pattern that usually is followed by
error handling code and the likes. We now use AANonNull to simplify
these comparisons optimistically in order to make more code dead early
on.

Reviewed By: uenoku

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

4 years ago[Attributor][FIX] Do not use cyclic arguments for `nonnull`
Johannes Doerfert [Tue, 18 Aug 2020 15:01:37 +0000 (10:01 -0500)]
[Attributor][FIX] Do not use cyclic arguments for `nonnull`

`AADereferenceable::getAssumedDereferenceableBytes()` is actually
deducing `dereferenceable_or_null`. We should not use that information
to deduce `nonnull`, since it doesn't imply `nonnull`.

4 years ago[Attributor][AAIsDead][NFC] Skip uninteresting instructions early
Johannes Doerfert [Sun, 2 Aug 2020 06:54:05 +0000 (01:54 -0500)]
[Attributor][AAIsDead][NFC] Skip uninteresting instructions early

4 years ago[Attributor][NFC] Improve the depgraph test to make differences clear
Johannes Doerfert [Sun, 2 Aug 2020 07:03:11 +0000 (02:03 -0500)]
[Attributor][NFC] Improve the depgraph test to make differences clear

4 years ago[Attributor][NFC] Extract functionality into own member
Johannes Doerfert [Sun, 2 Aug 2020 05:36:52 +0000 (00:36 -0500)]
[Attributor][NFC] Extract functionality into own member

4 years ago[ELF][test] Fix some llvm-objdump RUN lines which don't actually test anything
Fangrui Song [Thu, 20 Aug 2020 05:48:28 +0000 (22:48 -0700)]
[ELF][test] Fix some llvm-objdump RUN lines which don't actually test anything

4 years ago[PowerPC] Support constrained scalar fptosi/fptoui
Qiu Chaofan [Thu, 20 Aug 2020 05:29:43 +0000 (13:29 +0800)]
[PowerPC] Support constrained scalar fptosi/fptoui

This patch adds support for constrained scalar fp to int operations on
PowerPC. Besides, this fixes the FP exception bit of quad-precision
convert & truncate instructions.

Reviewed By: steven.zhang, uweigand

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

4 years agoRevert "[IR] Intrinsics default attributes and opt-out flag"
Johannes Doerfert [Thu, 20 Aug 2020 05:25:13 +0000 (00:25 -0500)]
Revert "[IR] Intrinsics default attributes and opt-out flag"

This commit introduced a non-trivial compile time regression that needs
to be addressed: https://reviews.llvm.org/D70365#2227627
Given that it is unclear how long that will take, I'll revert it for
now.

This reverts commit eedf18fc1f5fc71bb896204abf41fc5a2dbf25f7.

4 years agoRevert "[OpenMPOpt] ICV tracking for calls"
Johannes Doerfert [Thu, 20 Aug 2020 05:00:35 +0000 (00:00 -0500)]
Revert "[OpenMPOpt] ICV tracking for calls"

This commits breaks certain OpenMP codes (on power) because it expanded
the Attributor scope without telling the Attributor about the SCC
extend. See: https://reviews.llvm.org/D85544#2227611

This reverts commit b0b32e649011d9a60165b9b53eb2764b7da9c8ca.

4 years ago[OpenMP] Introduce target memory manager
Shilei Tian [Thu, 20 Aug 2020 03:12:02 +0000 (23:12 -0400)]
[OpenMP] Introduce target memory manager

Target memory manager is introduced in this patch which aims to manage target
memory such that they will not be freed immediately when they are not used
because the overhead of memory allocation and free is very large. For CUDA
device, cuMemFree even blocks the context switch on device which affects
concurrent kernel execution.

The memory manager can be taken as a memory pool. It divides the pool into
multiple buckets according to the size such that memory allocation/free
distributed to different buckets will not affect each other.

In this version, we use the exact-equality policy to find a free buffer. This
is an open question: will best-fit work better here? IMO, best-fit is not good
for target memory management because computation on GPU usually requires GBs of
data. Best-fit might lead to a serious waste. For example, there is a free
buffer of size 1960MB, and now we need a buffer of size 1200MB. If best-fit,
the free buffer will be returned, leading to a 760MB waste.

The allocation will happen when there is no free memory left, and the memory
free on device will take place in the following two cases:
1. The program ends. Obviously. However, there is a little problem that plugin
library is destroyed before the memory manager is destroyed, leading to a fact
that the call to target plugin will not succeed.
2. Device is out of memory when we request a new memory. The manager will walk
through all free buffers from the bucket with largest base size, pick up one
buffer, free it, and try to allocate immediately. If it succeeds, it will
return right away rather than freeing all buffers in free list.

Update:
A threshold (8KB by default) is set such that users could control what size of memory
will be managed by the manager. It can also be configured by an environment variable
`LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD`.

Reviewed By: jdoerfert, ye-luo, JonChesterfield

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

4 years ago[NFC] It's a test commit, which updates CREDITS.TXT
Zi Xuan Wu (Zeson) [Thu, 20 Aug 2020 02:58:37 +0000 (10:58 +0800)]
[NFC] It's a test commit, which updates CREDITS.TXT

4 years ago[AMDGPU] Correct DWARF register defintions
Tony [Thu, 20 Aug 2020 01:09:12 +0000 (01:09 +0000)]
[AMDGPU] Correct DWARF register defintions

- Rename AMDGPU SCC DWARF register to STATUS since the scalar
  condition code is a bit within the STATUS register.

- Correct bit size of the VCC_64 register to 64 which is the size in
  wave64 mode.

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

4 years ago[lldb] Return empty string from getExtraMakeArgs when not implemented
Jonas Devlieghere [Thu, 20 Aug 2020 00:51:50 +0000 (17:51 -0700)]
[lldb] Return empty string from getExtraMakeArgs when not implemented

No return statement means the method returns None which breaks a list
comprehension down the line that expects a str instance.

4 years ago[X86][AutoUpgrade] Simplify string management in UpgradeDataLayoutString a bit. NFCI
Craig Topper [Thu, 20 Aug 2020 00:44:21 +0000 (17:44 -0700)]
[X86][AutoUpgrade] Simplify string management in UpgradeDataLayoutString a bit. NFCI

We don't need a std::string for a literal string, we can use a
StringRef.

The addition of StringRefs produces a Twine that we can just call
str() without converting to a SmallString ourselves. Twine will
do that internally.

4 years ago[MLIR] Add PatternRewriter::mergeBlockBefore() to merge a block in the middle of...
Rahul Joshi [Wed, 19 Aug 2020 23:07:42 +0000 (16:07 -0700)]
[MLIR] Add PatternRewriter::mergeBlockBefore() to merge a block in the middle of another block.

- This utility to merge a block anywhere into another one can help inline single
  block regions into other blocks.
- Modified patterns test to use the new function.

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

4 years ago[X86] Add support 'tune' in target attribute
Craig Topper [Wed, 19 Aug 2020 22:58:16 +0000 (15:58 -0700)]
[X86] Add support 'tune' in target attribute

This adds parsing and codegen support for tune in target attribute.

I've implemented this so that arch in the target attribute implicitly disables tune from the command line. I'm not sure what gcc does here. But since -march implies -mtune. I assume 'arch' in the target attribute implies tune in the target attribute.

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

4 years ago[X86] Add mtune command line test cases that should have gone with 4cbceb74bb5676d018...
Craig Topper [Wed, 19 Aug 2020 22:58:06 +0000 (15:58 -0700)]
[X86] Add mtune command line test cases that should have gone with 4cbceb74bb5676d0181d4d0cab5194d90a42c2ec

4 years agoGlobalISel: Implement fewerElementsVector for G_CONCAT_VECTORS sources
Matt Arsenault [Mon, 3 Aug 2020 18:13:38 +0000 (14:13 -0400)]
GlobalISel: Implement fewerElementsVector for G_CONCAT_VECTORS sources

This fixes <6 x s16> = G_CONCAT_VECTORS from <3 x s16> handling.

4 years ago[c++14] Implement missed piece of N3323: use "converted constant" rules
Richard Smith [Wed, 19 Aug 2020 19:46:52 +0000 (12:46 -0700)]
[c++14] Implement missed piece of N3323: use "converted constant" rules
for array bounds, not "integer constant" rules.

For an array bound of class type, this causes us to perform an implicit
conversion to size_t, instead of looking for a unique conversion to
integral or unscoped enumeration type. This affects which cases are
valid when a class has multiple implicit conversion functions to
different types.

4 years agoExplain why the array bound is non-constant in VLA diagnostics.
Richard Smith [Wed, 19 Aug 2020 19:46:22 +0000 (12:46 -0700)]
Explain why the array bound is non-constant in VLA diagnostics.

In passing, also use a more precise diagnostic to explain why an
expression is not an ICE if it's not of integral type.

4 years ago[lldb] Update TestSimulatorPlatform.py to set ARCH_CFLAGS instead of TRIPLE
Jonas Devlieghere [Wed, 19 Aug 2020 22:35:29 +0000 (15:35 -0700)]
[lldb] Update TestSimulatorPlatform.py to set ARCH_CFLAGS instead of TRIPLE

I move the triple (de)composition logic into the builder in e5d08fcbac72
but this test is relying on Make to construct the set the ARCH,
ARCH_CFLAGS and SDKROOT based on the given TRIPLE. This patch updates
the test to pass these variables directly.

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

4 years ago[lldb/interpreter] Add REPL-specific init file
Med Ismail Bennani [Wed, 19 Aug 2020 20:04:35 +0000 (22:04 +0200)]
[lldb/interpreter] Add REPL-specific init file

This patch adds the infrastructure to have language specific REPL init
files. It's the foundation work to a following patch that will introduce
Swift REPL init file.

When lldb is launched with the `--repl` option, it will look for a REPL
init file in the home directory and source it. This overrides the
default `~/.lldbinit`, which content might make the REPL behave
unexpectedly. If the REPL init file doesn't exists, lldb will fall back
to the default init file.

rdar://65836048

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[libFuzzer] Fix value-profile-load test.
Dokyung Song [Wed, 19 Aug 2020 20:21:05 +0000 (20:21 +0000)]
[libFuzzer] Fix value-profile-load test.

The behavior of the CrossOver mutator has changed with
bb54bcf84970c04c9748004f3a4cf59b0c1832a7. This seems to affect the
value-profile-load test on Darwin. This patch provides a wider margin for
determining success of the value-profile-load test, by testing the targeted
functionality (i.e., GEP index value profile) more directly and faster. To this
end, LoadTest.cpp now uses a narrower condition (Size != 8) for initial pruning
of inputs, effectively preventing libFuzzer from generating inputs longer than
necessary and spending time on mutating such long inputs in the corpus - a
functionality not meant to be tested by this specific test.

Previously, on x86/Linux, it required 6,597,751 execs with -use_value_profile=1
and 19,605,575 execs with -use_value_profile=0 to hit the crash. With this
patch, the test passes with 174,493 execs, providing a wider margin from the
given trials of 10,000,000. Note that, without the value profile (i.e.,
-use_value_profile=0), the test wouldn't pass as it still requires 19,605,575
execs to hit the crash.

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

4 years ago[DFSan] Handle mmap() calls before interceptors are installed.
Matt Morehouse [Wed, 19 Aug 2020 22:07:17 +0000 (15:07 -0700)]
[DFSan] Handle mmap() calls before interceptors are installed.

InitializeInterceptors() calls dlsym(), which calls calloc().  Depending
on the allocator implementation, calloc() may invoke mmap(), which
results in a segfault since REAL(mmap) is still being resolved.

We fix this by doing a direct syscall if interceptors haven't been fully
resolved yet.

Reviewed By: vitalybuka

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

4 years ago[libc][obvious] Fix x86 long double conversion to integer.
Siva Chandra Reddy [Wed, 19 Aug 2020 21:44:23 +0000 (14:44 -0700)]
[libc][obvious] Fix x86 long double conversion to integer.

Fixes incorrectly constructed ceill tests.

4 years ago[llvm] Add default constructor of `llvm::ElementCount`.
Francesco Petrogalli [Wed, 19 Aug 2020 19:50:24 +0000 (19:50 +0000)]
[llvm] Add default constructor of `llvm::ElementCount`.

This patch prevents failures like those reported in
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/34173.

We have enabled the default constructor for
`llvm::ElementCount` to make sure the code compiles on Windows.

Reviewed By: ormris

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

4 years ago[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows
Petr Hosek [Wed, 19 Aug 2020 21:33:52 +0000 (14:33 -0700)]
[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1119478

Patch By: haampie

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

4 years agoForce Remove Attribute
Kyungwoo Lee [Wed, 19 Aug 2020 21:28:06 +0000 (17:28 -0400)]
Force Remove Attribute

-force-attribute adds an attribute to function via command-line.
However, there was no counter-part to remove an attribute.  This patch
adds -force-remove-attribute that removes an attribute from function.

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

4 years ago[ValueTracking] define/use max recursion depth in header
Sanjay Patel [Wed, 19 Aug 2020 20:32:24 +0000 (16:32 -0400)]
[ValueTracking] define/use max recursion depth in header

There's a potential motivating case to increase this limit in PR47191:
http://bugs.llvm.org/PR47191

But first we should make it less hacky. The limit in InstCombine is directly tied
to this value because an increase there can cause asserts in the underlying value
tracking calls if not changed together. The usage in VectorUtils is independent,
but the comment suggests that we should use the same value unless there's a known
reason to diverge. There are similar limits in codegen analysis, but I think we
should leave those independent in case we intentionally want the optimization
power/cost to be different there.

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

4 years agoImplement FPToUI and UIToFP ops in standard dialect
Mars Saxman [Wed, 19 Aug 2020 20:45:18 +0000 (22:45 +0200)]
Implement FPToUI and UIToFP ops in standard dialect

Add the unsigned complements to the existing FPToSI and SIToFP operations in the
standard dialect, with one-to-one lowerings to the corresponding LLVM operations.

Reviewed By: ftynse

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

4 years ago[X86] Add feature for Fast Short REP MOV (FSRM) for Icelake or newer.
Hiroshi Yamauchi [Fri, 14 Aug 2020 19:20:08 +0000 (12:20 -0700)]
[X86] Add feature for Fast Short REP MOV (FSRM) for Icelake or newer.

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

4 years ago[lldb] Move Xcode SDK helper functions into lldbutil
Jonas Devlieghere [Wed, 19 Aug 2020 20:25:57 +0000 (13:25 -0700)]
[lldb] Move Xcode SDK helper functions into lldbutil

This allows the logic to be reused by both the builders and the tests.

4 years ago[X89] Ignore -mtune=generic to fix failures some users are seeing after D85384
Craig Topper [Wed, 19 Aug 2020 20:12:46 +0000 (13:12 -0700)]
[X89] Ignore -mtune=generic to fix failures some users are seeing after D85384

Some code bases out there pass -mtune=generic to clang. This would have
been ignored prior to D85384. Now it results in an error
because "generic" isn't recognized by isValidCPUName.

And if we let it go through to the backend as a tune
setting it would get the tune flags closer to i386 rather
than a modern CPU.

I plan to change what tune=generic does in the backend in
a future patch. And allow this in the frontend.
But this should be a quick fix for the error some users
are seeing.

4 years ago[OPENMP]Fix PR47158, case 2: do not report host-only functions in unused function...
Alexey Bataev [Tue, 18 Aug 2020 18:51:51 +0000 (14:51 -0400)]
[OPENMP]Fix PR47158, case 2: do not report host-only functions in unused function in device mode.

If the function is not marked exlicitly as declare target and it calls
function(s), marked as declare target device_type(host), these host-only
functions should not be dignosed as used in device mode, if the caller
function is not used in device mode too.

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

4 years ago[mlir] Add a new "Pattern Descriptor Language" (PDL) dialect.
River Riddle [Wed, 19 Aug 2020 19:57:45 +0000 (12:57 -0700)]
[mlir] Add a new "Pattern Descriptor Language" (PDL) dialect.

PDL presents a high level abstraction for the rewrite pattern infrastructure available in MLIR. This abstraction allows for representing patterns transforming MLIR, as MLIR. This allows for applying all of the benefits that the general MLIR infrastructure provides, to the infrastructure itself. This means that pattern matching can be more easily verified for correctness, targeted by frontends, and optimized.

PDL abstracts over various different aspects of patterns and core MLIR data structures. Patterns are specified via a `pdl.pattern` operation. These operations contain a region body for the "matcher" code, and terminate with a `pdl.rewrite` that either dispatches to an external rewriter or contains a region for the rewrite specified via `pdl`. The types of values in `pdl` are handle types to MLIR C++ types, with `!pdl.attribute`, `!pdl.operation`, and `!pdl.type` directly mapping to `mlir::Attribute`, `mlir::Operation*`, and `mlir::Value` respectively.

An example pattern is shown below:

```mlir
// pdl.pattern contains metadata similarly to a `RewritePattern`.
pdl.pattern : benefit(1) {
  // External input operand values are specified via `pdl.input` operations.
  // Result types are constrainted via `pdl.type` operations.

  %resultType = pdl.type
  %inputOperand = pdl.input
  %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
  pdl.rewrite(%root) {
    pdl.replace %root with (%inputOperand)
  }
}
```

This is a culmination of the work originally discussed here: https://groups.google.com/a/tensorflow.org/g/mlir/c/j_bn74ByxlQ

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

4 years agoRe-apply "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"
Sourabh Singh Tomar [Wed, 19 Aug 2020 20:00:31 +0000 (01:30 +0530)]
Re-apply "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"

This patch was reverted in 7c182663a857fc87 due to some failures
observed on PCC based machines. Failures were due to Endianness issue and
long double representation issues.

Patch is revised to address Endianness issue. Furthermore, support
for emission of `DW_OP_implicit_value` for `long double` has been removed
(since it was unclean at the moment). Planning to handle this in
a clean way soon!

For more context, please refer to following review link.

Reviewed By: aprantl

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

4 years ago[OpenMP] Refactored the function `DeviceTy::data_exchange`
Shilei Tian [Wed, 19 Aug 2020 20:07:58 +0000 (16:07 -0400)]
[OpenMP] Refactored the function `DeviceTy::data_exchange`

This patch contains the following changes:
1. Renamed the function `DeviceTy::data_exchange` to `DeviceTy::dataExchange`;
2. Changed the second argument `DeviceTy DstDev` to `DeviceTy &DstDev`;
3. Renamed the last argument.

Reviewed By: ye-luo

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

4 years agoRevert "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"
Sourabh Singh Tomar [Wed, 19 Aug 2020 19:58:03 +0000 (01:28 +0530)]
Revert "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"

This reverts commit 15801f16194a3d.
arc's land messed up! It removed the new commit message and took it
from revision.

4 years ago[AArch64][GlobalISel] Handle rtcGPR64RegClassID in AArch64RegisterBankInfo::getRegBan...
Raul Tambre [Wed, 19 Aug 2020 19:50:35 +0000 (12:50 -0700)]
[AArch64][GlobalISel] Handle rtcGPR64RegClassID in AArch64RegisterBankInfo::getRegBankFromRegClass()

TargetRegisterInfo::getMinimalPhysRegClass() returns rtcGPR64RegClassID for X16
and X17, as it's the last matching class. This in turn gets passed to
AArch64RegisterBankInfo::getRegBankFromRegClass(), which hits an unreachable.

It seems sensible to handle this case, so copies from X16 and X17 work.
Copying from X17 is used in inline assembly in libunwind for pointer
authentication.

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

4 years ago[DebugInfo] Emit DW_OP_implicit_value for Floating point constants
Sourabh Singh Tomar [Thu, 23 Jul 2020 01:51:06 +0000 (07:21 +0530)]
[DebugInfo] Emit DW_OP_implicit_value for Floating point constants

llvm is missing support for DW_OP_implicit_value operation.
DW_OP_implicit_value op is indispensable for cases such as
optimized out long double variables.

For intro refer: DWARFv5 Spec Pg: 40 2.6.1.1.4 Implicit Location Descriptions

Consider the following example:
```
int main() {
        long double ld = 3.14;
        printf("dummy\n");
        ld *= ld;
        return 0;
}
```
when compiled with tunk `clang` as
`clang test.c -g -O1` produces following location description
of variable `ld`:
```
DW_AT_location        (0x00000000:
                     [0x0000000000201691, 0x000000000020169b): DW_OP_constu 0xc8f5c28f5c28f800, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_constu 0x4000, DW_OP_stack_value, DW_OP_bit_piece 0x10 0x40, DW_OP_stack_value)
                  DW_AT_name    ("ld")
```
Here one may notice that this representation is incorrect(DWARF4
stack could only hold integers(and only up to the size of address)).
Here the variable size itself is `128` bit.
GDB and LLDB confirms this:
```
(gdb) p ld
$1 = <invalid float value>
(lldb) frame variable ld
(long double) ld = <extracting data from value failed>
```

GCC represents/uses DW_OP_implicit_value in these sort of situations.
Based on the discussion with Jakub Jelinek regarding GCC's motivation
for using this, I concluded that DW_OP_implicit_value is most appropriate
in this case.

Link: https://gcc.gnu.org/pipermail/gcc/2020-July/233057.html
GDB seems happy after this patch:(LLDB doesn't have support
for DW_OP_implicit_value)
```
(gdb) p ld
p ld
$1 = 3.14000000000000012434
```

Reviewed By: aprantl

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

4 years ago[lldb] Print the load command that wasn't found in TestSimulatorPlatform
Jonas Devlieghere [Wed, 19 Aug 2020 19:40:53 +0000 (12:40 -0700)]
[lldb] Print the load command that wasn't found in TestSimulatorPlatform

Print which load command we were looking for when the sanity check
fails:

  AssertionError: 0 != 1 : wrong number of load commands for
  LC_VERSION_MIN_MACOSX

4 years ago[PGO][PGSO][LV] Fix loop not vectorized issue under profile guided size opts.
Hiroshi Yamauchi [Tue, 11 Aug 2020 21:10:30 +0000 (14:10 -0700)]
[PGO][PGSO][LV] Fix loop not vectorized issue under profile guided size opts.

D81345 appears to accidentally disables vectorization when explicitly
enabled. As PGSO isn't currently accessible from LoopAccessInfo, revert back to
the vectorization with versioning-for-unit-stride for PGSO.

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

4 years ago[lldb] Code sign binaries with entitlements
Jonas Devlieghere [Wed, 19 Aug 2020 17:19:03 +0000 (10:19 -0700)]
[lldb] Code sign binaries with entitlements

Binaries need to be code signed with entitlements to run on device.

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

4 years ago[CMake] Always mark terminfo as unavailable on Windows
Petr Hosek [Wed, 19 Aug 2020 18:06:19 +0000 (11:06 -0700)]
[CMake] Always mark terminfo as unavailable on Windows

This addresses the issue introduced by D86134.

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

4 years agoGlobalISel: Add TargetLowering member to LegalizerHelper
Matt Arsenault [Fri, 31 Jul 2020 15:41:05 +0000 (11:41 -0400)]
GlobalISel: Add TargetLowering member to LegalizerHelper

4 years ago[lldb] Extend Darwin builder to pass the ARCH_CFLAGS spec to Make.
Jonas Devlieghere [Wed, 19 Aug 2020 01:48:18 +0000 (18:48 -0700)]
[lldb] Extend Darwin builder to pass the ARCH_CFLAGS spec to Make.

Construct the ARCH_CFLAGS in Python rather than in Make by disassembling
the TRIPLE.

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

4 years ago[DSE] Remove dead argument from removePartiallyOverlappedStores (NFC).
Florian Hahn [Wed, 19 Aug 2020 18:32:49 +0000 (19:32 +0100)]
[DSE] Remove dead argument from removePartiallyOverlappedStores (NFC).

The argument is unused and can be removed.

4 years agoAMDGPU: Fix wrong type mangling in intrinsic test
Matt Arsenault [Mon, 17 Aug 2020 12:50:11 +0000 (08:50 -0400)]
AMDGPU: Fix wrong type mangling in intrinsic test

The generic address space used to be 4, but the string here seems to
not matter.

4 years ago[index-while-building] PathIndexer
Jan Korous [Tue, 14 Jul 2020 02:38:58 +0000 (19:38 -0700)]
[index-while-building] PathIndexer

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

4 years agoGlobalISel: Don't check for verifier enforced constraint
Matt Arsenault [Wed, 19 Aug 2020 18:06:17 +0000 (14:06 -0400)]
GlobalISel: Don't check for verifier enforced constraint

Loads are always required to have a single memory operand.

4 years agoAMDGPU/GlobalISel: Remove hack for combines forming illegal extloads
Matt Arsenault [Wed, 19 Aug 2020 17:59:11 +0000 (13:59 -0400)]
AMDGPU/GlobalISel: Remove hack for combines forming illegal extloads

Previously we weren't adding the LegalizerInfo to the post-legalizer
combiner. Since that's fixed, we don't need to try to filter out the
one case that was breaking.

4 years agosanitizer_common: Use void* for madvise first argument on Solaris.
Peter Collingbourne [Tue, 18 Aug 2020 20:06:41 +0000 (13:06 -0700)]
sanitizer_common: Use void* for madvise first argument on Solaris.

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

4 years ago[InstCombine] add tests for shifted xor; NFC
Sanjay Patel [Wed, 19 Aug 2020 16:46:53 +0000 (12:46 -0400)]
[InstCombine] add tests for shifted xor; NFC