platform/upstream/llvm.git
3 years ago[SLP][X86] Extend PR46983 tests to include SSE2,SSE42,AVX512BW test coverage
Simon Pilgrim [Tue, 8 Dec 2020 12:19:43 +0000 (12:19 +0000)]
[SLP][X86] Extend PR46983 tests to include SSE2,SSE42,AVX512BW test coverage

Noticed while reviewing D92824

3 years ago[lldb][import-std-module] Add a test for typedef'd std types
Raphael Isemann [Tue, 8 Dec 2020 12:33:14 +0000 (13:33 +0100)]
[lldb][import-std-module] Add a test for typedef'd std types

3 years ago[XCore][docs] Fix XCore compiler writer documentation links.
Nigel Perks [Tue, 8 Dec 2020 12:19:20 +0000 (12:19 +0000)]
[XCore][docs] Fix XCore compiler writer documentation links.

Fix links to XMOS website. Add link for XS2 architecture.

Reviewed By: jryans

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

3 years ago[LICM][docs] Document that LICM is also a canonicalization transform. NFC.
Sjoerd Meijer [Tue, 8 Dec 2020 11:39:46 +0000 (11:39 +0000)]
[LICM][docs] Document that LICM is also a canonicalization transform. NFC.

This documents that LICM is a canonicalization transform, which we discussed
recently in:

http://lists.llvm.org/pipermail/llvm-dev/2020-December/147184.html

but which was also discused earlier, e.g. in:

http://lists.llvm.org/pipermail/llvm-dev/2019-September/135058.html

3 years ago[NFC] Chec[^k] -> Check
David Green [Tue, 8 Dec 2020 11:54:39 +0000 (11:54 +0000)]
[NFC] Chec[^k] -> Check

Some test updates all appearing to use the wrong spelling of CHECK.

3 years ago[compiler-rt] Allow appending to 'target_cflags' value from lit_config.
Hafiz Abid Qadeer [Tue, 8 Dec 2020 11:46:36 +0000 (11:46 +0000)]
[compiler-rt] Allow appending to 'target_cflags' value from lit_config.

This patch is similar to D84708. When testing compiler-rt on different
baremetal targets, it helps to have the ability to pass some more parameters
at test time that allows you to build the test executable for a
given target. For an example, you may need a different linker command
file for different targets.

This patch will allows to do things like

$ llvm-lit --param=append_target_cflags="-T simulator.ld"
or
$ llvm-lit --param=append_target_cflags="-T hardware.ld"

In this way, you can run tests on different targets without having to run
cmake again.

Reviewed By: delcypher

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

3 years ago[DebugInfo][Docs] Document MIR language debug-info constructs
Jeremy Morse [Tue, 8 Dec 2020 10:55:47 +0000 (10:55 +0000)]
[DebugInfo][Docs] Document MIR language debug-info constructs

This patch documents the MIR syntax for a number of things relevant to
debugging information:
 * Trailing 'debug-location' metadata that becomes a DebugLoc,
 * Variable location metadata for stack slots,
 * Syntax for DBG_VALUE metainstructions,
 * Syntax for DBG_INSTR_REF, including trailing instruction numbers
   attached to MIR instructions.

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

3 years ago[CodeGen] Add text section prefix for COFF object file
Pan, Tao [Tue, 8 Dec 2020 09:57:03 +0000 (17:57 +0800)]
[CodeGen] Add text section prefix for COFF object file

Text section prefix is created in CodeGenPrepare, it's file format independent implementation,  text section name is written into object file in TargetLoweringObjectFile, it's file format dependent implementation, port code of adding text section prefix to text section name from ELF to COFF.
Different with ELF that use '.' as concatenation character, COFF use '$' as concatenation character. That is, concatenation character is variable, so split concatenation character from text section prefix.
Text section prefix is existing feature of ELF, it can help to reduce icache and itlb misses, it's also make possible aggregate other compilers e.g. v8 created same prefix sections. Furthermore, the recent feature Machine Function Splitter (basic block level text prefix section) is based on text section prefix.

Reviewed By: pengfei, rnk

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

3 years ago[IR] Remove CastInst::isCastable since it is not used
Cullen Rhodes [Thu, 3 Dec 2020 11:05:51 +0000 (11:05 +0000)]
[IR] Remove CastInst::isCastable since it is not used

It was removed back in 2013 (f63dfbb) by Matt Arsenault but then
reverted since DragonEgg used it, but that project is no longer
maintained.

Reviewed By: ldionne, dexonsmith

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

3 years agoUBSAN: emit distinctive traps
Tim Northover [Wed, 21 Oct 2020 09:11:25 +0000 (10:11 +0100)]
UBSAN: emit distinctive traps

Sometimes people get minimal crash reports after a UBSAN incident. This change
tags each trap with an integer representing the kind of failure encountered,
which can aid in tracking down the root cause of the problem.

3 years ago[Orc] Two small fixes in TPCDynamicLibrarySearchGenerator
Stefan Gränitz [Tue, 8 Dec 2020 09:56:50 +0000 (10:56 +0100)]
[Orc] Two small fixes in TPCDynamicLibrarySearchGenerator

There is one result per lookup symbol, so we have to advance the result iterator no matter whether it's NULL or not.
MissingSymbols variable is unused.

Reviewed By: lhames

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

3 years ago[JITLink][ELF] Route objects to their matching linker backends based on header info
Stefan Gränitz [Tue, 8 Dec 2020 09:53:50 +0000 (10:53 +0100)]
[JITLink][ELF] Route objects to their matching linker backends based on header info

Distinguish objects by target properties address size, endian and machine architecture. So far we only
support x86-64 (ELFCLASS64, ELFDATA2LSB, EM_X86_64).

Reviewed By: lhames

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

3 years ago[DSE][NFC] Need to be carefull mixing signed and unsigned types
Evgeniy Brevnov [Fri, 4 Dec 2020 09:53:17 +0000 (16:53 +0700)]
[DSE][NFC] Need to be carefull mixing signed and unsigned types

Currently in some places we use signed type to represent size of an access and put explicit casts from unsigned to signed.
For example: int64_t EarlierSize = int64_t(Loc.Size.getValue());

Even though it doesn't loos bits (immidiatly) it may overflow and we end up with negative size. Potentially that cause later code to work incorrectly. A simple expample is a check that size is not negative.

I think it would be safer and clearer if we use unsigned type for the size and handle it appropriately.

Reviewed By: fhahn

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

3 years ago[mlir] Add an option to control the number of loops in affine parallelizer
Alex Zinenko [Mon, 7 Dec 2020 15:18:32 +0000 (16:18 +0100)]
[mlir] Add an option to control the number of loops in affine parallelizer

Add a pass option to control the number of nested parallel loops produced by
the parallelization passes. This is useful to build end-to-end passes targeting
systems that don't need multiple parallel dimensions (e.g., CPUs typically need
only one).

Reviewed By: wsmoses, chelini

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

3 years ago[mlir] properly support min/max in affine parallelization
Alex Zinenko [Mon, 7 Dec 2020 14:45:39 +0000 (15:45 +0100)]
[mlir] properly support min/max in affine parallelization

The existing implementation of the affine parallelization silently copies over
the lower and upper bound maps from affine.for to affine.parallel. However, the
semantics of these maps differ between these two ops: in affine.for, a max(min)
of results is taken for the lower(upper) bound; in affine.parallel, multiple
induction variables can be defined an each result corresponds to one induction
variable. Thus the existing implementation could generate invalid IR or IR that
passes the verifier but has different semantics than the original code. Fix the
parallelization utility to emit dedicated min/max operations before the
affine.parallel in such cases. Disallow parallelization if min/max would have
been in an operation without the AffineScope trait, e.g., in another loop,
since the result of these operations is not considered a valid affine dimension
identifier and may not be properly handled by the affine analyses.

Reviewed By: wsmoses

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

3 years ago[Clang][CodeGen][RISCV] Fix hard float ABI for struct with empty struct and complex
Luís Marques [Mon, 7 Dec 2020 23:50:43 +0000 (23:50 +0000)]
[Clang][CodeGen][RISCV] Fix hard float ABI for struct with empty struct and complex

Fixes bug 44904.

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

3 years ago[Clang][CodeGen][RISCV] Fix hard float ABI test cases with empty struct
Luís Marques [Mon, 7 Dec 2020 23:50:42 +0000 (23:50 +0000)]
[Clang][CodeGen][RISCV] Fix hard float ABI test cases with empty struct

The code seemed not to account for the field 1 offset.

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

3 years ago[Clang][CodeGen][RISCV] Add hard float ABI tests with empty struct
Luís Marques [Mon, 7 Dec 2020 23:50:35 +0000 (23:50 +0000)]
[Clang][CodeGen][RISCV] Add hard float ABI tests with empty struct

This patch adds tests that showcase a behavior that is currently buggy.
Fix in a follow-up patch.

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

3 years ago[SLP][Test] Differentiate SSE/AVX512 test coverage (NFC)
Anton Afanasyev [Tue, 8 Dec 2020 08:54:42 +0000 (11:54 +0300)]
[SLP][Test] Differentiate SSE/AVX512 test coverage (NFC)

Add test coverage for SSE/AVX512 for insert-after-bundle.ll test.
Prepare this test for accurate showing of PR46983 fix.

3 years agoRevert "Add new 'preferred_name' attribute."
Richard Smith [Tue, 8 Dec 2020 08:42:26 +0000 (00:42 -0800)]
Revert "Add new 'preferred_name' attribute."

This change exposed a pre-existing issue with deserialization cycles
caused by a combination of attributes and template instantiations
violating the deserialization ordering restrictions; see PR48434 for
details.

A previous commit attempted to work around PR48434, but appears to have
only been a partial fix, and fixing this properly seems non-trivial.
Backing out for now to unblock things.

This reverts commit 98f76adf4e941738c0b9fe3b9965fa63603e9c89 and
commit a64c26a47a81b1b44e36d235ff3bc6a74a0bad9f.

3 years agoFix shtest-timeout test harder
David Blaikie [Tue, 8 Dec 2020 07:49:37 +0000 (23:49 -0800)]
Fix shtest-timeout test harder

Don't produce or expect any output from the infinite looping test -
doing so is a recipe for racey flakyness without a longer timeout to
ensure the output is received first, even though that doesn't seem
integral/important to the test. Instead have a plain, no output infinite
loop and check that that is caught and handled.

If for some reason the output is valuable for test coverage - the
timeout should be increased from 1 second to give the process time to
output the text, flush, and for that text to be received and buffered
before the test is timed out.

3 years ago[libc++] Mark LWG3200 as Nothing To Do. NFC.
Marek Kurdej [Tue, 8 Dec 2020 08:00:45 +0000 (09:00 +0100)]
[libc++] Mark LWG3200 as Nothing To Do. NFC.

This is only a wording change, because it is currently impossible to constrain the overload set on whether the type is complete or not.

3 years ago[NFC] [PowerPC] Move i1-to-fp tests and use script
Qiu Chaofan [Tue, 8 Dec 2020 07:20:15 +0000 (15:20 +0800)]
[NFC] [PowerPC] Move i1-to-fp tests and use script

3 years ago[test] Pin provenance.ll to legacy PM
Arthur Eubanks [Tue, 8 Dec 2020 07:08:02 +0000 (23:08 -0800)]
[test] Pin provenance.ll to legacy PM

It doesn't seem right to port -pa-eval just for one test, punting
decision for how to handle this.

3 years ago[test] Fix loop-micro-op-buffer-size-t99.ll under NPM
Arthur Eubanks [Tue, 8 Dec 2020 07:04:33 +0000 (23:04 -0800)]
[test] Fix loop-micro-op-buffer-size-t99.ll under NPM

The NPM runs loop passes on loops in forward program order instead of
the legacy PM's reverse program order, causing some debug output to be
in a different order.

3 years ago[llvm-profgen][NFC] Fix test failure by making unwinder's output deterministic
wlei [Tue, 8 Dec 2020 06:01:17 +0000 (22:01 -0800)]
[llvm-profgen][NFC] Fix test failure by making unwinder's output deterministic

Don't know why under Sanitizer build(asan/msan/ubsan), the `std::unordered_map<string, ...>`'s output order is reversed, make the regression test failed.

This change creates a workaround by using sorted container to make the output deterministic.

Reviewed By: hoy, wenlei

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

3 years ago[PowerPC] Implement intrinsic for DARN instruction
Qiu Chaofan [Tue, 8 Dec 2020 06:08:52 +0000 (14:08 +0800)]
[PowerPC] Implement intrinsic for DARN instruction

Instruction darn was introduced in ISA 3.0. It means 'Deliver A Random
Number'. The immediate number L means:

- L=0, the number is 32-bit (higher 32-bits are all-zero)
- L=1, the number is 'conditioned' (processed by hardware to reduce bias)
- L=2, the number is not conditioned, directly from noise source

GCC implements them in three separate intrinsics: __builtin_darn,
__builtin_darn_32 and __builtin_darn_raw. This patch implements the
same intrinsics. And this change also addresses Bugzilla PR39800.

Reviewed By: steven.zhang

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

3 years ago[test] Fix Transforms/LoopVersioningLICM under NPM
Arthur Eubanks [Tue, 8 Dec 2020 05:54:38 +0000 (21:54 -0800)]
[test] Fix Transforms/LoopVersioningLICM under NPM

There were already both legacy and new PM RUN lines.
Also make the NPM RUN line actually match the legacy PM RUN line.

3 years ago[test] Fix Transforms/LoopVectorize under NPM
Arthur Eubanks [Tue, 8 Dec 2020 05:48:21 +0000 (21:48 -0800)]
[test] Fix Transforms/LoopVectorize under NPM

The -enable-new-pm=1 translation caused loop-vectorize to run on all
functions, then instcombine, rather than all passes on one function then
the next. This caused the output of -debug-only and -print-after to be
interleaved in an unexpected way.

3 years ago[test] Fix store_cost.ll under NPM
Arthur Eubanks [Tue, 8 Dec 2020 05:17:07 +0000 (21:17 -0800)]
[test] Fix store_cost.ll under NPM

The NPM processes loops in forward program order, whereas the legacy PM
processes them in reverse program order. No reason to test both PMs
here, so just stick to the NPM.

3 years ago[lldb] Include thread id in the reproducer trace (NFC)
Jonas Devlieghere [Tue, 8 Dec 2020 04:31:07 +0000 (20:31 -0800)]
[lldb] Include thread id in the reproducer trace (NFC)

Include the current thread ID in the reproducer trace during
capture/recording.

3 years ago[NFC][MSan] Round up OffsetPtr in PoisonMembers
Vitaly Buka [Sat, 5 Dec 2020 07:46:58 +0000 (23:46 -0800)]
[NFC][MSan] Round up OffsetPtr in PoisonMembers

getFieldOffset(layoutStartOffset)  is expected to point to the first trivial
field or the one which follows non-trivial. So it must be byte aligned already.
However this is not obvious without assumptions about callers.
This patch will avoid the need in such assumptions.

Depends on D92727.

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

3 years ago[test] Fix widen-iv.ll under NPM
Arthur Eubanks [Tue, 8 Dec 2020 03:19:37 +0000 (19:19 -0800)]
[test] Fix widen-iv.ll under NPM

The -loop-flatten legacy pass preserves loop analyses. The legacy PM
will check all passes that preserve loop analyses that they preserve
LCSSA. This implicitly involves running -loop-simplify. The test
shouldn't depend on verify flags being set in order to run
-loop-simplify, so explicitly add it. The new PM ends up not running it
otherwise.

3 years ago[DAGCombine][PowerPC] Simplify nabs by using legal `smin` operation
Kai Luo [Tue, 8 Dec 2020 03:22:32 +0000 (03:22 +0000)]
[DAGCombine][PowerPC] Simplify nabs by using legal `smin` operation

Convert `0 - abs(x)` to `smin (x, -x)` if `smin` is a legal operation.

Verification: https://alive2.llvm.org/ce/z/vpquFR

Reviewed By: RKSimon

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

3 years ago[PowerPC] Correct the bit-width definition for some imm operand in td.
Esme-Yi [Tue, 8 Dec 2020 03:20:12 +0000 (03:20 +0000)]
[PowerPC] Correct the bit-width definition for some imm operand in td.

Summary: The imm operands of some instructions are not defined accurately in td.
This is a small patch to correct these definitions.

Reviewed By: steven.zhang

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

3 years agoFix assertion failure due to incorrect dependence bits on a DeclRefExpr
Richard Smith [Tue, 8 Dec 2020 02:41:43 +0000 (18:41 -0800)]
Fix assertion failure due to incorrect dependence bits on a DeclRefExpr
that can only be set correctly after instantiating the initializer for a
variable.

3 years ago[test] Rewrite split-debug.c
Fangrui Song [Tue, 8 Dec 2020 02:40:31 +0000 (18:40 -0800)]
[test] Rewrite split-debug.c

Use generic ELF target triples.
Add missing coverage: -gsplit-dwarf=split -g -fsplit-dwarf-inlining
Reorganize and add comments.
Test -gno-pubnames

3 years ago[test] Fix LoopFusion tests under NewPM
Arthur Eubanks [Tue, 8 Dec 2020 01:36:18 +0000 (17:36 -0800)]
[test] Fix LoopFusion tests under NewPM

The legacy pass depended on -loop-simplify running. The NPM does not
allow for a non-analysis pass to depend on another non-analysis pass.

3 years ago[AArch64][GlobalISel] Refactor G_BRCOND selection
Jessica Paquette [Tue, 1 Dec 2020 19:58:19 +0000 (11:58 -0800)]
[AArch64][GlobalISel] Refactor G_BRCOND selection

`selectCompareBranch` was hard to understand.

Also, it was being needlessly pessimistic with the `ProduceNonFlagSettingCondBr`
case. It assumed that everything in `selectCompareBranch` would emit a TB(N)Z
or C(B)NZ. That's not true; the G_FCMP + G_BRCOND case would never emit those
instructions, and the G_ICMP + G_BRCOND case was capable of emitting an integer
compare + Bcc.

- Refactor `selectCompareBranch` into separate functions based off of what is
feeding the G_BRCOND's condition.

- Move G_BRCOND selection code from `select` to `selectCompareBranch`.

- Remove duplicated constraint code from the code originally in `select`;
  `emitTestBit` already handles that, so no need to constrain twice.

- Factor out the G_FCMP + G_BRCOND case into `selectCompareBranchFedByFCmp`.

- Split the G_ICMP + G_BRCOND case into an optimization function,
`tryOptCompareBranchFedByICmp` and a general selection function,
`selectCompareBranchFedByICmp`.

- Reduce the number of things passed to `tryOptAndIntoCompareBranch`.

- Improve documentation.

- Give some variables more descriptive names.

Other than improving the code generation for functions with
speculative_load_hardening by getting the logic correct, this is NFC.

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

3 years ago[VNCoercion] Disallow coercion between different ni addrspaces
Valentin Churavy [Mon, 7 Dec 2020 21:13:57 +0000 (16:13 -0500)]
[VNCoercion] Disallow coercion between different ni addrspaces

I'm not sure if it would be legal by the IR reference to introduce
an addrspacecast here, since the IR reference is a bit vague on
the exact semantics, but at least for our usage of it (and I
suspect for many other's usage) it is not. For us, addrspacecasts
between non-integral address spaces carry frontend information that the
optimizer cannot deduce afterwards in a generic way (though we
have frontend specific passes in our pipline that do propagate
these). In any case, I'm sure nobody is using it this way at
the moment, since it would have introduced inttoptrs, which
are definitely illegal.

Fixes PR38375

Co-authored-by: Keno Fischer <keno@alumni.harvard.edu>
Reviewed By: reames

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

3 years agoFix lit test failure due to 0b81d9
Yaxun (Sam) Liu [Tue, 8 Dec 2020 00:48:59 +0000 (19:48 -0500)]
Fix lit test failure due to 0b81d9

These lit tests now requires amdgpu-registered-target since they
use clang driver and clang driver passes an LLVM option which
is available only if amdgpu target is registered.

Change-Id: I2df31967409f1627fc6d342d1ab5cc8aa17c9c0c

3 years agoFixup test in path to use C:\ instead of D:\ which may be mapped to a removable.
Douglas Yung [Tue, 8 Dec 2020 00:36:58 +0000 (16:36 -0800)]
Fixup test in path to use C:\ instead of D:\ which may be mapped to a removable.

Our internal build bot hit a failure in llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test
because the test was checking for an error message that is emitted when a pdb file is
missing. But when the drive is mapped to a removalable drive (such as a DVD drive) in
Windows, you get a different error message which causes the test to fail.

This fixes the test by changing the drive the missing pdb is expected to be on to C:\
instead of D:\ as that is the drive historically used to install Windows and thus
if present should be a hard drive.

Reviewed By: rnk

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

3 years agoFix deserialization cycle in preferred_name attribute.
Richard Smith [Mon, 7 Dec 2020 23:50:18 +0000 (15:50 -0800)]
Fix deserialization cycle in preferred_name attribute.

This is really just a workaround for a more fundamental issue in the way
we deserialize attributes. See PR48434 for details.

Also fix tablegen code generator to produce more correct indentation to
resolve buildbot issues with -Werror=misleading-indentation firing
inside the generated code.

3 years ago[AMDGPU] add -mcode-object-version=n
Yaxun (Sam) Liu [Tue, 27 Oct 2020 18:10:02 +0000 (14:10 -0400)]
[AMDGPU] add -mcode-object-version=n

Add option -mcode-object-version=n to control code object version for
AMDGPU.

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

3 years ago[clang][AMDGPU] remove mxnack and msramecc options
Yaxun (Sam) Liu [Thu, 17 Sep 2020 18:53:24 +0000 (14:53 -0400)]
[clang][AMDGPU] remove mxnack and msramecc options

Remove mxnack and msramecc options since they
are deprecated by --offload-arch.

This is part of https://reviews.llvm.org/D60620

3 years ago[HIP] fix bundle entry ID for --
Yaxun (Sam) Liu [Thu, 13 Aug 2020 20:31:51 +0000 (16:31 -0400)]
[HIP] fix bundle entry ID for --

Canonicalize triple used in fat binary. Change from
amdgcn-amd-amdhsa to amdgcn-amd-amdhsa-.

This is part of https://reviews.llvm.org/D60620

3 years agoAdd Python binding for MLIR Type Attribute
Mehdi Amini [Sat, 5 Dec 2020 02:08:38 +0000 (02:08 +0000)]
Add Python binding for MLIR Type Attribute

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

3 years agoCustomize exception thrown from mlir.Operation.create() python bindings
Mehdi Amini [Sat, 5 Dec 2020 01:28:41 +0000 (01:28 +0000)]
Customize exception thrown from mlir.Operation.create() python bindings

The default exception handling isn't very user friendly and does not
point accurately to the issue. Instead we can indicate which of the
operands isn't valid and provide contextual information in the error
message.

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

3 years ago[clang][AMDGPU] rename sram-ecc as sramecc
Yaxun (Sam) Liu [Mon, 7 Dec 2020 22:31:28 +0000 (17:31 -0500)]
[clang][AMDGPU] rename sram-ecc as sramecc

As backend renamed sram-ecc to sramecc, this patch makes
corresponding change in clang.

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

3 years ago[AArch64][GlobalISel] Narrow 128-bit regs to 64-bit regs in emitTestBit
Jessica Paquette [Fri, 4 Dec 2020 23:51:44 +0000 (15:51 -0800)]
[AArch64][GlobalISel] Narrow 128-bit regs to 64-bit regs in emitTestBit

When we have a 128-bit register, emitTestBit would incorrectly narrow to 32
bits always. If the bit number was > 32, then we would need a TB(N)ZX. This
would cause a crash, as we'd have the wrong register class. (PR48379)

This generalizes `narrowExtReg` into `moveScalarRegClass`.

This also allows us to remove `widenGPRBankRegIfNeeded` entirely, since
`selectCopy` correctly handles SUBREG_TO_REG etc.

This does create some codegen changes (since `selectCopy` uses the `all`
regclass variants). However, I think that these will likely be optimized away,
and we can always improve the `selectCopy` code. It looks like we should
revisit `selectCopy` at this point, and possibly refactor it into at least one
`emit` function.

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

3 years agoTeach isKnownNonEqual how to recurse through invertible multiplies
Philip Reames [Mon, 7 Dec 2020 22:36:19 +0000 (14:36 -0800)]
Teach isKnownNonEqual how to recurse through invertible multiplies

Build on the work started in 8f07629, and add the multiply case. In the process, more clearly describe the requirement for the operation we're looking through.

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

3 years ago[clang] Fix noderef for AddrOf on MemberExpr
Jann Horn [Mon, 7 Dec 2020 22:48:41 +0000 (14:48 -0800)]
[clang] Fix noderef for AddrOf on MemberExpr

Committing on behalf of thejh (Jann Horn).

As part of this change, one existing test case has to be adjusted
because it accidentally stripped the NoDeref attribute without
getting caught.

Depends on D92140

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

3 years ago[flang] Improve initializer semantics, esp. for component default values
peter klausler [Mon, 7 Dec 2020 20:08:58 +0000 (12:08 -0800)]
[flang] Improve initializer semantics, esp. for component default values

This patch plugs many holes in static initializer semantics, improves error
messages for default initial values and other component properties in
parameterized derived type instantiations, and cleans up several small
issues noticed during development.  We now do proper scalar expansion,
folding, and type, rank, and shape conformance checking for component
default initializers in derived types and PDT instantiations.
The initial values of named constants are now guaranteed to have been folded
when installed in the symbol table, and are no longer folded or
scalar-expanded at each use in expression folding.  Semantics documentation
was extended with information about the various kinds of initializations
in Fortran and when each of them are processed in the compiler.

Some necessary concomitant changes have bulked this patch out a bit:
* contextual messages attachments, which are now produced for parameterized
  derived type instantiations so that the user can figure out which
  instance caused a problem with a component, have been added as part
  of ContextualMessages, and their implementation was debugged
* several APIs in evaluate::characteristics was changed so that a FoldingContext
  is passed as an argument rather than just its intrinsic procedure table;
  this affected client call sites in many files
* new tools in Evaluate/check-expression.cpp to determine when an Expr
  actually is a single constant value and to validate a non-pointer
  variable initializer or object component default value
* shape conformance checking has additional arguments that control
  whether scalar expansion is allowed
* several now-unused functions and data members noticed and removed
* several crashes and bogus errors exposed by testing this new code
  were fixed
* a -fdebug-stack-trace option to enable LLVM's stack tracing on
  a crash, which might be useful in the future

TL;DR: Initialization processing does more and takes place at the right
times for all of the various kinds of things that can be initialized.

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

3 years ago [clang] Fix noderef for array member of deref expr
Leonard Chan [Mon, 7 Dec 2020 22:39:42 +0000 (14:39 -0800)]
[clang] Fix noderef for array member of deref expr

    Committing on behalf of thejh (Jann Horn).

    Given an attribute((noderef)) pointer "p" to the struct

    struct s { int a[2]; };
    ensure that the following expressions are treated the same way by the
    noderef logic:

    p->a
    (*p).a
    Until now, the first expression would be treated correctly (nothing is
    added to PossibleDerefs because CheckMemberAccessOfNoDeref() bails out
    on array members), but the second expression would incorrectly warn
    because "*p" creates a PossibleDerefs entry.

    Handle this case the same way as for the AddrOf operator.

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

3 years agoRevert "[test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with -fsanitize...
Mitch Phillips [Mon, 7 Dec 2020 22:30:53 +0000 (14:30 -0800)]
Revert "[test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with -fsanitize-address-globals-dead-stripping"

This reverts commit 140808768d3e5c0f4e52dd42094650f5d282e34a.

Reason: Broke the upstream bots - discussed offline.

3 years ago[clang] Add support for attribute 'swift_async'
Erik Pilkington [Sun, 6 Dec 2020 20:08:12 +0000 (15:08 -0500)]
[clang] Add support for attribute 'swift_async'

This attributes specifies how (or if) a given function or method will be
imported into a swift async method. rdar://70111252

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

3 years ago[clang] Add a new nullability annotation for swift async: _Nullable_result
Erik Pilkington [Mon, 7 Dec 2020 14:14:25 +0000 (09:14 -0500)]
[clang] Add a new nullability annotation for swift async: _Nullable_result

_Nullable_result generally like _Nullable, except when being imported into a
swift async method. rdar://70106409

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

3 years agoSet the target branch for `arc land` to main
Mehdi Amini [Mon, 7 Dec 2020 21:57:32 +0000 (21:57 +0000)]
Set the target branch for `arc land` to main

3 years ago[CSSPGO][llvm-profgen] Context-sensitive profile data generation
wlei [Mon, 19 Oct 2020 19:55:59 +0000 (12:55 -0700)]
[CSSPGO][llvm-profgen] Context-sensitive profile data generation

This stack of changes introduces `llvm-profgen` utility which generates a profile data file from given perf script data files for sample-based PGO. It’s part of(not only) the CSSPGO work. Specifically to support context-sensitive with/without pseudo probe profile, it implements a series of functionalities including perf trace parsing, instruction symbolization, LBR stack/call frame stack unwinding, pseudo probe decoding, etc. Also high throughput is achieved by multiple levels of sample aggregation and compatible format with one stop is generated at the end. Please refer to: https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s for the CSSPGO RFC.

This change supports context-sensitive profile data generation into llvm-profgen. With simultaneous sampling for LBR and call stack, we can identify leaf of LBR sample with calling context from stack sample . During the process of deriving fall through path from LBR entries, we unwind LBR by replaying all the calls and returns (including implicit calls/returns due to inlining) backwards on top of the sampled call stack. Then the state of call stack as we unwind through LBR always represents the calling context of current fall through path.

we have two types of virtual unwinding 1) LBR unwinding and 2) linear range unwinding.
Specifically, for each LBR entry which can be classified into call, return, regular branch, LBR unwinding will replay the operation by pushing, popping or switching leaf frame towards the call stack and since the initial call stack is most recently sampled, the replay should be in anti-execution order, i.e. for the regular case, pop the call stack when LBR is call, push frame on call stack when LBR is return. After each LBR processed, it also needs to align with the next LBR by going through instructions from previous LBR's target to current LBR's source, which we named linear unwinding. As instruction from linear range can come from different function by inlining, linear unwinding will do the range splitting and record counters through the range with same inline context.

With each fall through path from LBR unwinding, we aggregate each sample into counters by the calling context and eventually generate full context sensitive profile (without relying on inlining) to driver compiler's PGO/FDO.

A breakdown of noteworthy changes:
- Added `HybridSample` class as the abstraction perf sample including LBR stack and call stack
* Extended `PerfReader` to implement auto-detect whether input perf script output contains CS profile, then do the parsing. Multiple `HybridSample` are extracted
* Speed up by aggregating  `HybridSample` into `AggregatedSamples`
* Added VirtualUnwinder that consumes aggregated  `HybridSample` and implements unwinding of calls, returns, and linear path that contains implicit call/return from inlining. Ranges and branches counters are aggregated by the calling context.
 Here calling context is string type, each context is a pair of function name and callsite location info, the whole context is like `main:1 @ foo:2 @ bar`.
* Added PorfileGenerater that accumulates counters by ranges unfolding or branch target mapping, then generates context-sensitive function profile including function body, inferring callee's head sample, callsite target samples, eventually records into ProfileMap.

* Leveraged LLVM build-in(`SampleProfWriter`) writer to support different serialization format with no stop
- `getCanonicalFnName` for callee name and name from ELF section
- Added regression test for both unwinding and profile generation

Test Plan:
ninja & ninja check-llvm

Reviewed By: hoy, wenlei, wmi

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

3 years ago[CodeGen][MSan] Don't use offsets of zero-sized fields
Vitaly Buka [Sat, 5 Dec 2020 07:47:11 +0000 (23:47 -0800)]
[CodeGen][MSan] Don't use offsets of zero-sized fields

Such fields will likely have offset zero making
__sanitizer_dtor_callback poisoning wrong regions.
E.g. it can poison base class member from derived class constructor.

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

3 years ago[OpenMPIRBuilder] introduce createStaticWorkshareLoop
Alex Zinenko [Wed, 2 Dec 2020 11:53:12 +0000 (12:53 +0100)]
[OpenMPIRBuilder] introduce createStaticWorkshareLoop

Introduce a function that creates a statically-scheduled workshare loop
out of a canonical loop created earlier by the OpenMPIRBuilder. This
basically amounts to injecting runtime calls to the preheader and the
after block and updating the trip count. Static scheduling kind is
currently hardcoded and needs to be extracted from the runtime library
into common TableGen definitions.

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

3 years ago[Polly][CodeGen] Remove use of ScalarEvolution.
Michael Kruse [Mon, 7 Dec 2020 20:39:32 +0000 (14:39 -0600)]
[Polly][CodeGen] Remove use of ScalarEvolution.

ScalarEvolution::getSCEV cannot be used during codegen. ScalarEvolution
assumes a stable IR and control flow which is under construction during
Polly's CodeGen. In particular, it uses DominatorTree for compute the
backedge taken count. However the DominatorTree is not updated during
codegen.

In this case, SCEV was used to determine the base pointer of an array
access. Replace it by our own function. Polly generates only GEP and
BitCasts for array acceses, i.e. it is sufficient to handle these to to
find the base pointer.

Fixes llvm.org/PR48422

3 years ago[CodeView] Fix inline sites that are missing code offsets.
Amy Huang [Thu, 3 Dec 2020 17:03:55 +0000 (09:03 -0800)]
[CodeView] Fix inline sites that are missing code offsets.

When an inline site has a starting code offset of 0, we sometimes
don't emit the starting offset.

Bug: https://bugs.llvm.org/show_bug.cgi?id=48377

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

3 years agodocs: Add pointer to cmake caches for PGO
Nico Weber [Mon, 7 Dec 2020 16:29:25 +0000 (11:29 -0500)]
docs: Add pointer to cmake caches for PGO

Also add a link to end-user PGO documentation.

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

3 years agoAdd new 'preferred_name' attribute.
Richard Smith [Thu, 12 Nov 2020 01:12:18 +0000 (17:12 -0800)]
Add new 'preferred_name' attribute.

This attribute permits a typedef to be associated with a class template
specialization as a preferred way of naming that class template
specialization. This permits us to specify that (for example) the
preferred way to express 'std::basic_string<char>' is as 'std::string'.

The attribute is applied to the various class templates in libc++ that have
corresponding well-known typedef names.

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

3 years ago[AArch64] Fix some minor coding style issues in AArch64CompressJumpTables
Amara Emerson [Mon, 7 Dec 2020 20:47:28 +0000 (12:47 -0800)]
[AArch64] Fix some minor coding style issues in AArch64CompressJumpTables

3 years ago[llvm][NFC] Made RefCountBase constructors protected
Nathan James [Mon, 7 Dec 2020 20:23:11 +0000 (20:23 +0000)]
[llvm][NFC] Made RefCountBase constructors protected

Matches ThreadSafeRefCountBase and forces the class to be inherited.

3 years ago[llvm] Add asserts in (ThreadSafe)?RefCountedBase destructors
Nathan James [Mon, 7 Dec 2020 20:20:08 +0000 (20:20 +0000)]
[llvm] Add asserts in (ThreadSafe)?RefCountedBase destructors

Added a trivial destructor in release mode and in debug mode a destructor that asserts RefCount is indeed zero.
This ensure people aren't manually (maybe accidentally) destroying these objects like in this contrived example.
```lang=c++
{
  std::unique_ptr<SomethingRefCounted> Object;
  holdIntrusiveOwnership(Object.get());
  // Object Destructor called here will assert.
}
```

Reviewed By: dblaikie

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

3 years ago[WebAssembly] Add Object and ObjectWriter support for wasm COMDAT sections
Derek Schuff [Fri, 4 Dec 2020 21:45:42 +0000 (13:45 -0800)]
[WebAssembly] Add Object and ObjectWriter support for wasm COMDAT sections

Allow sections to be placed into COMDAT groups, in addtion to functions and data
segments.

Also make section symbols unnamed, which allows sections with identical names
(section names are independent of their section symbols, but previously we
gave the symbols the same name as their sections, which results in collisions
when sections are identically-named).

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

3 years ago[SLP] fix typo in debug string; NFC
Sanjay Patel [Mon, 7 Dec 2020 20:09:21 +0000 (15:09 -0500)]
[SLP] fix typo in debug string; NFC

3 years ago[mlir][sparse] hoist loop invariant tensor loads in sparse compiler
Aart Bik [Mon, 7 Dec 2020 19:54:58 +0000 (11:54 -0800)]
[mlir][sparse] hoist loop invariant tensor loads in sparse compiler

After bufferization, the backend has much more trouble hoisting loop invariant
loads from the loops generated by the sparse compiler. Therefore, this is done
during sparse code generation. Note that we don't bother hoisting derived
invariant expressions on SSA values, since the backend does that very well.

Still TBD: scalarize reductions to avoid load-add-store cycles

Reviewed By: penpornk

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

3 years agoStop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo
Erich Keane [Mon, 7 Dec 2020 19:27:01 +0000 (11:27 -0800)]
Stop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo

As reported in PR48177, the type-deduction extraction ends up going into
an infinite loop when the type referred to has a recursive definition.
This stops recursing and just substitutes the type-source-info the
TypeLocBuilder identified when transforming the base.

3 years ago[LV] Epilogue Vectorization with Optimal Control Flow - Default Enablement
Bardia Mahjour [Mon, 7 Dec 2020 19:23:52 +0000 (14:23 -0500)]
[LV] Epilogue Vectorization with Optimal Control Flow - Default Enablement

This patch enables epilogue vectorization by default per reviewer requests.

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

3 years ago[analyzer] Ignore annotations if func is inlined.
Yu Shan [Mon, 7 Dec 2020 18:58:44 +0000 (10:58 -0800)]
[analyzer] Ignore annotations if func is inlined.

When we annotating a function header so that it could be used by other
TU, we also need to make sure the function is parsed correctly within
the same TU. So if we can find the function's implementation,
ignore the annotations, otherwise, false positive would occur.
Move the escape by value case to post call and do not escape the handle
if the function is inlined and we have analyzed the handle.

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

3 years ago[flang][openacc] Add clause validity tests for the kernels directive
Valentin Clement [Mon, 7 Dec 2020 19:26:50 +0000 (14:26 -0500)]
[flang][openacc] Add clause validity tests for the kernels directive

Add some clause validity tests for the kernels directive

Reviewed By: sameeranjoshi

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

3 years ago[AMDGPU] Annotate vgpr<->agpr spills in asm
Stanislav Mekhanoshin [Wed, 25 Nov 2020 20:30:43 +0000 (12:30 -0800)]
[AMDGPU] Annotate vgpr<->agpr spills in asm

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

3 years ago[libc++] [docs] Mark LWG3055 as complete. Use string_view instead of string in path...
Marek Kurdej [Mon, 7 Dec 2020 19:07:25 +0000 (20:07 +0100)]
[libc++] [docs] Mark LWG3055 as complete. Use string_view instead of string in path::operator+=(ECharT).

The issue didn't change the behaviour which is tested in libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp.

The change to use string_view instead of string is not strictly necessary.

<filesystem> was added in commit 998a5c88312066fcc2b2de1358edc76587611354 (Implement <filesystem>).

Reviewed By: #libc, ldionne

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

3 years ago[ConstraintElimination] Tweak placement in pipeline.
Florian Hahn [Mon, 7 Dec 2020 18:14:57 +0000 (18:14 +0000)]
[ConstraintElimination] Tweak placement in pipeline.

This patch adds the ConstraintElimination pass to the LTO pipeline and
also runs it after SCCP in the function simplification pipeline.

This increases the number of cases we can elimination. Pending further
tuning.

3 years agoFix missing error for use of 128-bit integer inside SPIR64 device code.
Jennifer Yu [Fri, 4 Dec 2020 22:54:12 +0000 (14:54 -0800)]
Fix missing error for use of 128-bit integer inside SPIR64 device code.
Emit error for use of 128-bit integer inside device code had been
already implemented in https://reviews.llvm.org/D74387.  However,
the error is not emitted for SPIR64, because for SPIR64, hasInt128Type
return true.

hasInt128Type: is also used to control generation of certain 128-bit
predefined macros, initializer predefined 128-bit integer types and
build 128-bit ArithmeticTypes.  Except predefined macros, only the
device target is considered, since error only emit when 128-bit
integer is used inside device code, the host target (auxtarget) also
needs to be considered.

The change address:
1. (SPIR.h) Correct hasInt128Type() for SPIR targets.
2. Sema.cpp and SemaOverload.cpp: Add additional check to consider host
   target(auxtarget) when call to hasInt128Type.  So that __int128_t
   and __int128() are allowed to avoid error when they used outside
   device code.
3. SemaType.cpp: add check for SYCLIsDevice to delay the error message.
   The error will be emitted if the use of 128-bit integer in the device
   code.

   Reviewed By: Johannes Doerfert and Aaron Ballman

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

3 years ago[PowerPC] Exploitation of xxeval instruction for AND and NAND
Stefan Pintilie [Mon, 7 Dec 2020 18:36:04 +0000 (12:36 -0600)]
[PowerPC] Exploitation of xxeval instruction for AND and NAND

The xxeval instruction was intorduced in Power PC in Power 10.
The instruction accepts three vector registers and an immediate.
Depending on the value of the immediate the instruction can be used
to perform certain bitwise boolean operations (and, or, xor, ...) on
the given vector registers.

This patch implements the AND and NAND patterns that can be used by
the instruction.

Reviewed By: nemanjai, #powerpc, bsaleil, NeHuang, jsji

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

3 years ago[Sema] Make more overload candidate types use iterator_ranges (NFC)
Richard Sandiford [Mon, 7 Dec 2020 18:34:53 +0000 (18:34 +0000)]
[Sema] Make more overload candidate types use iterator_ranges (NFC)

I have a patch that adds another group of candidate types to
BuiltinCandidateTypeSet.  Currently two styles are in use: the older
begin/end pairs and the newer iterator_range approach.  I think the
group of candidates that I want to add should use iterator ranges,
but I'd also like to consolidate the handling of the new candidates
with some existing code that uses begin/end pairs.  This patch therefore
converts the begin/end pairs to iterator ranges as a first step.

No functional change intended.

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

3 years ago[RISCV] Form GORCI from (or (rotl/rotr X, Bitwidth/2), X).
Craig Topper [Mon, 7 Dec 2020 17:45:06 +0000 (09:45 -0800)]
[RISCV] Form GORCI from (or (rotl/rotr X, Bitwidth/2), X).

A rotate by half the bitwidth swaps the bottom and top half which is the same as one of the MSB GREVI stage.

We have to do this as a special combine because we prefer to keep (rotl/rotr X, BitWidth/2) as a rotate rather than a single stage GREVI.

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

3 years ago[X86] Fix static analyzer warnings. NFCI.
Simon Pilgrim [Mon, 7 Dec 2020 18:20:22 +0000 (18:20 +0000)]
[X86] Fix static analyzer warnings. NFCI.

Replace '|' with '||' in condition, and fix case of SignedMode variable.

3 years ago[DAG] Cleanup by folding some single use VT.getScalarSizeInBits() calls into its...
Simon Pilgrim [Mon, 7 Dec 2020 18:14:26 +0000 (18:14 +0000)]
[DAG] Cleanup by folding some single use VT.getScalarSizeInBits() calls into its comparison. NFCI.

3 years ago[IPO] Fix operator precedence warning. NFCI.
Simon Pilgrim [Mon, 7 Dec 2020 18:10:24 +0000 (18:10 +0000)]
[IPO] Fix operator precedence warning. NFCI.

Check the entire assertion condition before && with the message.

3 years ago[SLP][Test] Add test for PR46983
Anton Afanasyev [Mon, 7 Dec 2020 14:27:13 +0000 (17:27 +0300)]
[SLP][Test] Add test for PR46983

3 years ago[OpenMP] NFC: comment adjusted
AndreyChurbanov [Mon, 7 Dec 2020 16:50:14 +0000 (19:50 +0300)]
[OpenMP] NFC: comment adjusted

3 years ago[Parse] Delete unused declarations
Fangrui Song [Mon, 7 Dec 2020 16:46:17 +0000 (08:46 -0800)]
[Parse] Delete unused declarations

3 years ago[MLIR][Affine] Add affine.for normalization support
Navdeep Kumar [Mon, 7 Dec 2020 09:27:51 +0000 (14:57 +0530)]
[MLIR][Affine] Add affine.for normalization support

Add support to normalize affine.for ops i.e., convert the lower bound to zero
and loop step to one. The Upper bound is set to the trip count of the loop.
The exact value of loopIV is calculated just inside the body of affine.for.
Currently loops with lower bounds having single result are supported. No such
restriction exists on upper bounds.

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

3 years agoTest commit
Hans Wennborg [Mon, 7 Dec 2020 16:27:03 +0000 (17:27 +0100)]
Test commit

3 years ago[OpenMP] libomp: Fix possible NULL dereferences
AndreyChurbanov [Mon, 7 Dec 2020 16:09:07 +0000 (19:09 +0300)]
[OpenMP] libomp: Fix possible NULL dereferences

Check pointer returned by strchr, as it can be NULL in case of broken
format of input string. Introduced new function __kmp_str_loc_numbers
for fast parsing of numbers only in the location string.
Also made some cleanup of __kmp_str_loc_init declaration and usage:
- changed type of init_fname parameter to bool;
- changed input from true to false in places where fname is not used.

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

3 years ago[libTooling] Add `describe` combinator for formatting AST nodes for diagnostics.
Yitzhak Mandelbaum [Fri, 4 Dec 2020 15:23:34 +0000 (15:23 +0000)]
[libTooling] Add `describe` combinator for formatting AST nodes for diagnostics.

This new stencil combinator is intended for use in diagnostics and the like.

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

3 years ago[SLP]Merge reorder and reuse shuffles.
Alexey Bataev [Fri, 4 Dec 2020 17:53:59 +0000 (09:53 -0800)]
[SLP]Merge reorder and reuse shuffles.

It is possible to merge reuse and reorder shuffles and reduce the total
cost of the ivectorization tree/number of final instructions.

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

3 years ago[ARM] Revert low overhead loops with calls before registry allocation.
David Green [Mon, 7 Dec 2020 15:44:40 +0000 (15:44 +0000)]
[ARM] Revert low overhead loops with calls before registry allocation.

This adds code to revert low overhead loops with calls in them before
register allocation. Ideally we would not create low overhead loops with
calls in them to begin with, but that can be difficult to always get
correct. If we want to try and glue together t2LoopDec and t2LoopEnd
into a single instruction, we need to ensure that no instructions use LR
in the loop. (Technically the final code can be better too, as it
doesn't need to use the same registers but that has not been optimized
for here, as reverting loops with calls is expected to be very rare).

It also adds a MVETailPredUtils.h header to share the revert code
between different passes, and provides a place to expand upon, with
RevertLoopWithCall becoming a place to perform other low overhead loop
alterations like removing copies or combining LoopDec and End into a
single instruction.

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

3 years ago[libomptarget][amdgpu] Add plumbing to call into hostrpc lib, if linked
Jon Chesterfield [Mon, 7 Dec 2020 15:23:08 +0000 (15:23 +0000)]
[libomptarget][amdgpu] Add plumbing to call into hostrpc lib, if linked

3 years ago[WebAssembly][MC] Fix placement of table section
Andy Wingo [Mon, 30 Nov 2020 15:16:33 +0000 (16:16 +0100)]
[WebAssembly][MC] Fix placement of table section

The table section goes after functions.

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

3 years ago[PowerPC][Clang] Remove QPX support
Jinsong Ji [Mon, 7 Dec 2020 14:50:45 +0000 (09:50 -0500)]
[PowerPC][Clang] Remove QPX support

Clean up QPX code in clang missed in https://reviews.llvm.org/D83915

Reviewed By: #powerpc, steven.zhang

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

3 years ago[LLD] Search archives for symbol defs to override COMMON symbols.
Sean Fertile [Mon, 7 Dec 2020 14:28:17 +0000 (09:28 -0500)]
[LLD] Search archives for symbol defs to override COMMON symbols.

This patch changes the archive handling to enable the semantics needed
for legacy FORTRAN common blocks and block data. When we have a COMMON
definition of a symbol and are including an archive, LLD will now
search the members for global/weak defintions to override the COMMON
symbol. The previous LLD behavior (where a member would only be included
if it satisifed some other needed symbol definition) can be re-enabled with the
option '-no-fortran-common'.

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

3 years agoRevert "[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action"
Michał Górny [Mon, 7 Dec 2020 14:57:44 +0000 (15:57 +0100)]
Revert "[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action"

This reverts commit 09b08833f301ea375137931d26b7193101f82ceb.

This code is wrong on Linux, and causes ld-linux and linux-vdso to be
reported twice.  I need to work on it more.

3 years ago[lld/mac] Make X86_64::getImplicitAddend not do heap allocations
Nico Weber [Mon, 7 Dec 2020 14:05:46 +0000 (09:05 -0500)]
[lld/mac] Make X86_64::getImplicitAddend not do heap allocations

Speeds up linking Chromium's base_unittests almost 10%. According to ministat:

    N           Min           Max        Median           Avg        Stddev
x   5    0.72193289    0.73073196    0.72560811    0.72565799  0.0032265649
+   5    0.64069581    0.67173195    0.65876389    0.65796089   0.011349451
Difference at 95.0% confidence
-0.0676971 +/- 0.0121682
-9.32906% +/- 1.67685%
(Student's t, pooled s = 0.00834328)

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