]> granicus.if.org Git - llvm/log
llvm
7 years agoBump version to 5.0.2 release_50 origin/release_50
Tom Stellard [Wed, 28 Mar 2018 20:25:17 +0000 (20:25 +0000)]
Bump version to 5.0.2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@328729 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoBackporting r325653:
Simon Dardis [Fri, 16 Mar 2018 22:14:38 +0000 (22:14 +0000)]
Backporting r325653:
------------------------------------------------------------------------
r325653 | sdardis | 2018-02-21 00:06:53 +0000 (Wed, 21 Feb 2018) | 31 lines

[mips] Spectre variant two mitigation for MIPSR2

This patch provides mitigation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It implements the LLVM part of
-mindirect-jump=hazard. It is _not_ enabled by default for the P5600.

The migitation strategy suggested by MIPS for these processors is to use
hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are used with the attribute +use-indirect-jump-hazard
when branching indirectly and for indirect function calls.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

Performance benchmarking of this option with -fpic and lld using
-z hazardplt shows a difference of overall 10%~ time increase
for the LLVM testsuite. Certain benchmarks such as methcall show a
substantially larger increase in time due to their nature.

Reviewers: atanasyan, zoran.jovanovic

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@327751 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r325085:
Reid Kleckner [Wed, 14 Feb 2018 00:34:35 +0000 (00:34 +0000)]
Merging r325085:
------------------------------------------------------------------------
r325085 | rnk | 2018-02-13 16:24:29 -0800 (Tue, 13 Feb 2018) | 3 lines

[X86] Remove dead code from retpoline thunk generation

Follow-up to r325049
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@325091 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r325049:
Reid Kleckner [Wed, 14 Feb 2018 00:34:13 +0000 (00:34 +0000)]
Merging r325049:
------------------------------------------------------------------------
r325049 | rnk | 2018-02-13 12:47:49 -0800 (Tue, 13 Feb 2018) | 17 lines

[X86] Use EDI for retpoline when no scratch regs are left

Summary:
Instead of solving the hard problem of how to pass the callee to the indirect
jump thunk without a register, just use a CSR. At a call boundary, there's
nothing stopping us from using a CSR to hold the callee as long as we save and
restore it in the prologue.

Also, add tests for this mregparm=3 case. I wrote execution tests for
__llvm_retpoline_push, but they never got committed as lit tests, either
because I never rewrote them or because they got lost in merge conflicts.

Reviewers: chandlerc, dwmw2

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D43214
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@325090 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r324645:
Reid Kleckner [Wed, 14 Feb 2018 00:33:00 +0000 (00:33 +0000)]
Merging r324645:
------------------------------------------------------------------------
r324645 | dwmw2 | 2018-02-08 12:06:05 -0800 (Thu, 08 Feb 2018) | 5 lines

[X86] Support 'V' register operand modifier

This allows the register name to be printed without the leading '%'.
This can be used for emitting calls to the retpoline thunks from inline
asm.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@325089 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r324449:
Reid Kleckner [Wed, 14 Feb 2018 00:32:26 +0000 (00:32 +0000)]
Merging r324449:
------------------------------------------------------------------------
r324449 | chandlerc | 2018-02-06 22:16:24 -0800 (Tue, 06 Feb 2018) | 15 lines

[x86/retpoline] Make the external thunk names exactly match the names
that happened to end up in GCC.

This is really unfortunate, as the names don't have much rhyme or reason
to them. Originally in the discussions it seemed fine to rely on aliases
to map different names to whatever external thunk code developers wished
to use but there are practical problems with that in the kernel it turns
out. And since we're discovering this practical problems late and since
GCC has already shipped a release with one set of names, we are forced,
yet again, to blindly match what is there.

Somewhat rushing this patch out for the Linux kernel folks to test and
so we can get it patched into our releases.

Differential Revision: https://reviews.llvm.org/D42998
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@325088 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323915:
Reid Kleckner [Thu, 1 Feb 2018 21:31:35 +0000 (21:31 +0000)]
Merging r323915:
------------------------------------------------------------------------
r323915 | chandlerc | 2018-01-31 12:56:37 -0800 (Wed, 31 Jan 2018) | 17 lines

[x86] Make the retpoline thunk insertion a machine function pass.

Summary:
This removes the need for a machine module pass using some deeply
questionable hacks. This should address PR36123 which is a case where in
full LTO the memory usage of a machine module pass actually ended up
being significant.

We should revert this on trunk as soon as we understand and fix the
memory usage issue, but we should include this in any backports of
retpolines themselves.

Reviewers: echristo, MatzeB

Subscribers: sanjoy, mcrosier, mehdi_amini, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D42726
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@324009 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323155:
Reid Kleckner [Thu, 1 Feb 2018 21:28:26 +0000 (21:28 +0000)]
Merging r323155:
------------------------------------------------------------------------
r323155 | chandlerc | 2018-01-22 14:05:25 -0800 (Mon, 22 Jan 2018) | 133 lines

Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre..

Summary:
First, we need to explain the core of the vulnerability. Note that this
is a very incomplete description, please see the Project Zero blog post
for details:
https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

The basis for branch target injection is to direct speculative execution
of the processor to some "gadget" of executable code by poisoning the
prediction of indirect branches with the address of that gadget. The
gadget in turn contains an operation that provides a side channel for
reading data. Most commonly, this will look like a load of secret data
followed by a branch on the loaded value and then a load of some
predictable cache line. The attacker then uses timing of the processors
cache to determine which direction the branch took *in the speculative
execution*, and in turn what one bit of the loaded value was. Due to the
nature of these timing side channels and the branch predictor on Intel
processors, this allows an attacker to leak data only accessible to
a privileged domain (like the kernel) back into an unprivileged domain.

The goal is simple: avoid generating code which contains an indirect
branch that could have its prediction poisoned by an attacker. In many
cases, the compiler can simply use directed conditional branches and
a small search tree. LLVM already has support for lowering switches in
this way and the first step of this patch is to disable jump-table
lowering of switches and introduce a pass to rewrite explicit indirectbr
sequences into a switch over integers.

However, there is no fully general alternative to indirect calls. We
introduce a new construct we call a "retpoline" to implement indirect
calls in a non-speculatable way. It can be thought of loosely as
a trampoline for indirect calls which uses the RET instruction on x86.
Further, we arrange for a specific call->ret sequence which ensures the
processor predicts the return to go to a controlled, known location. The
retpoline then "smashes" the return address pushed onto the stack by the
call with the desired target of the original indirect call. The result
is a predicted return to the next instruction after a call (which can be
used to trap speculative execution within an infinite loop) and an
actual indirect branch to an arbitrary address.

On 64-bit x86 ABIs, this is especially easily done in the compiler by
using a guaranteed scratch register to pass the target into this device.
For 32-bit ABIs there isn't a guaranteed scratch register and so several
different retpoline variants are introduced to use a scratch register if
one is available in the calling convention and to otherwise use direct
stack push/pop sequences to pass the target address.

This "retpoline" mitigation is fully described in the following blog
post: https://support.google.com/faqs/answer/7625886

We also support a target feature that disables emission of the retpoline
thunk by the compiler to allow for custom thunks if users want them.
These are particularly useful in environments like kernels that
routinely do hot-patching on boot and want to hot-patch their thunk to
different code sequences. They can write this custom thunk and use
`-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this
case, on x86-64 thu thunk names must be:
```
  __llvm_external_retpoline_r11
```
or on 32-bit:
```
  __llvm_external_retpoline_eax
  __llvm_external_retpoline_ecx
  __llvm_external_retpoline_edx
  __llvm_external_retpoline_push
```
And the target of the retpoline is passed in the named register, or in
the case of the `push` suffix on the top of the stack via a `pushl`
instruction.

There is one other important source of indirect branches in x86 ELF
binaries: the PLT. These patches also include support for LLD to
generate PLT entries that perform a retpoline-style indirection.

The only other indirect branches remaining that we are aware of are from
precompiled runtimes (such as crt0.o and similar). The ones we have
found are not really attackable, and so we have not focused on them
here, but eventually these runtimes should also be replicated for
retpoline-ed configurations for completeness.

For kernels or other freestanding or fully static executables, the
compiler switch `-mretpoline` is sufficient to fully mitigate this
particular attack. For dynamic executables, you must compile *all*
libraries with `-mretpoline` and additionally link the dynamic
executable and all shared libraries with LLD and pass `-z retpolineplt`
(or use similar functionality from some other linker). We strongly
recommend also using `-z now` as non-lazy binding allows the
retpoline-mitigated PLT to be substantially smaller.

When manually apply similar transformations to `-mretpoline` to the
Linux kernel we observed very small performance hits to applications
running typical workloads, and relatively minor hits (approximately 2%)
even for extremely syscall-heavy applications. This is largely due to
the small number of indirect branches that occur in performance
sensitive paths of the kernel.

When using these patches on statically linked applications, especially
C++ applications, you should expect to see a much more dramatic
performance hit. For microbenchmarks that are switch, indirect-, or
virtual-call heavy we have seen overheads ranging from 10% to 50%.

However, real-world workloads exhibit substantially lower performance
impact. Notably, techniques such as PGO and ThinLTO dramatically reduce
the impact of hot indirect calls (by speculatively promoting them to
direct calls) and allow optimized search trees to be used to lower
switches. If you need to deploy these techniques in C++ applications, we
*strongly* recommend that you ensure all hot call targets are statically
linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well
tuned servers using all of these techniques saw 5% - 10% overhead from
the use of retpoline.

We will add detailed documentation covering these components in
subsequent patches, but wanted to make the core functionality available
as soon as possible. Happy for more code review, but we'd really like to
get these patches landed and backported ASAP for obvious reasons. We're
planning to backport this to both 6.0 and 5.0 release streams and get
a 5.0 release with just this cherry picked ASAP for distros and vendors.

This patch is the work of a number of people over the past month: Eric, Reid,
Rui, and myself. I'm mailing it out as a single commit due to the time
sensitive nature of landing this and the need to backport it. Huge thanks to
everyone who helped out here, and everyone at Intel who helped out in
discussions about how to craft this. Also, credit goes to Paul Turner (at
Google, but not an LLVM contributor) for much of the underlying retpoline
design.

Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer

Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D41723
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@324007 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312509:
Tom Stellard [Wed, 6 Dec 2017 20:45:18 +0000 (20:45 +0000)]
Merging r312509:

------------------------------------------------------------------------
r312509 | dannyb | 2017-09-04 19:17:42 -0700 (Mon, 04 Sep 2017) | 1 line

NewGVN: Fix PR 34452 by passing instruction all the way down when we do aggregate value simplification
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@319952 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agobpf: fix bug on silently truncating 64-bit immediate
Yonghong Song [Sun, 3 Dec 2017 19:02:03 +0000 (19:02 +0000)]
bpf: fix bug on silently truncating 64-bit immediate

We came across an llvm bug when compiling some testcases that 64-bit
immediates are silently truncated into 32-bit and then packed into
BPF_JMP | BPF_K encoding.  This caused comparison with wrong value.

This bug looks to be introduced by r308080 (llvm 5.0). The Select_Ri pattern is
supposed to be lowered into J*_Ri while the latter only support 32-bit
immediate encoding, therefore Select_Ri should have similar immediate
predicate check as what J*_Ri are doing.

The bug is fixed by
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315889 91177308-0d34-0410-b5e6-96231b3b80d8
in llvm 6.0.

This patch is largely the same as the fix in llvm 6.0 except
one minor adjustment for the test case.

Reported-by: John Fastabend <john.fastabend@gmail.com>
Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@319633 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r316035:
Tom Stellard [Tue, 28 Nov 2017 22:02:15 +0000 (22:02 +0000)]
Merging r316035:

------------------------------------------------------------------------
r316035 | tnorthover | 2017-10-17 14:43:52 -0700 (Tue, 17 Oct 2017) | 6 lines

AArch64: account for possible frame index operand in compares.

If the address of a local is used in a comparison, AArch64 can fold the
address-calculation into the comparison via "adds". Unfortunately, a couple of
places (both hit in this one test) are not ready to deal with that yet and just
assume the first source operand is a register.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@319231 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r319130:
Tom Stellard [Tue, 28 Nov 2017 16:35:04 +0000 (16:35 +0000)]
Merging r319130:

------------------------------------------------------------------------
r319130 | matze | 2017-11-27 17:17:52 -0800 (Mon, 27 Nov 2017) | 7 lines

ARM: Fix PR32578

https://llvm.org/PR32578

I simplified and converted the reproducer into a lit test.

Patch by Vedant Kumar!
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@319181 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r318788:
Tom Stellard [Wed, 22 Nov 2017 18:04:47 +0000 (18:04 +0000)]
Merging r318788:

------------------------------------------------------------------------
r318788 | mcrosier | 2017-11-21 10:08:34 -0800 (Tue, 21 Nov 2017) | 16 lines

[AArch64] Mark mrs of TPIDR_EL0 (thread pointer) as *having* side effects.

This partially reverts r298851.  The the underlying issue is that we don't
currently model the dependency between mrs (read system register) and
msr (write system register) instructions.

Something like the below should never be reordered:

 msr TPIDR_EL0, x0  ;; set thread pointer
 mrs x8, TPIDR_EL0  ;; read thread pointer

but was being reordered after r298851.  The functional part of the patch
that wasn't reverted needed to remain in place in order to not break
r299462.

PR35317
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318854 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r315086:
Tom Stellard [Wed, 22 Nov 2017 17:49:17 +0000 (17:49 +0000)]
Merging r315086:

------------------------------------------------------------------------
r315086 | compnerd | 2017-10-06 11:06:59 -0700 (Fri, 06 Oct 2017) | 8 lines

Bitcode: add an auto-upgrade for LTO section name

The bitcode reader looks specifically for `__DATA, __objc_catlist` as a
section name.  However, SVN r304661 removed the spaces (the two names
are functionally equivalent but do not compare equally
lexicographically).  This causes compatibility issues.  Add an
auto-upgrade path for removing the spaces as well as use the new name in
the LTO plugin.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318851 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r313398:
Tom Stellard [Wed, 22 Nov 2017 17:43:15 +0000 (17:43 +0000)]
Merging r313398:

------------------------------------------------------------------------
r313398 | steven_wu | 2017-09-15 14:12:14 -0700 (Fri, 15 Sep 2017) | 19 lines

[AutoUpgrade] Fix a compatibility issue with module flag

Summary:
After r304661, module flag to record objective-c image info section is
encoded without whitespaces after comma. The new name is equivalent to
the old one, except that when LTO a module built by old compiler and a
module built by a new compiler, it will fail with conflicting values.

Fix the issue by removing whitespaces in bitcode upgrade path.

rdar://problem/34416934

Reviewers: compnerd

Reviewed By: compnerd

Subscribers: mehdi_amini, hans, llvm-commits

Differential Revision: https://reviews.llvm.org/D37909
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318850 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r318289:
Tom Stellard [Fri, 17 Nov 2017 18:48:34 +0000 (18:48 +0000)]
Merging r318289:

------------------------------------------------------------------------
r318289 | jdevlieghere | 2017-11-15 02:57:05 -0800 (Wed, 15 Nov 2017) | 14 lines

[DebugInfo] Fix potential CU mismatch for SubprogramScopeDIEs.

In constructAbstractSubprogramScopeDIE there can be a potential mismatch
between `this` and the CU of ContextDIE when a scope is shared between
two DISubprograms belonging to a different CU. In that case, `this` is
the CU that was specified in the IR, but the CU of ContextDIE is that of
the first subprogram that was emitted. This patch fixes the mismatch by
looking up the CU of ContextDIE, and switching to use that.

This fixes PR35212 (https://bugs.llvm.org/show_bug.cgi?id=35212)

Patch by Philip Craig!

Differential revision: https://reviews.llvm.org/D39981
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318542 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r318207:
Simon Dardis [Thu, 16 Nov 2017 10:13:49 +0000 (10:13 +0000)]
Merging r318207:

------------------------------------------------------------------------
r318207 | sdardis | 2017-11-14 22:26:42 +0000 (Tue, 14 Nov 2017) | 18 lines

Reland "[mips][mt][6/7] Add support for mftr, mttr instructions."

This adjusts the tests to hopfully pacify the
llvm-clang-x86_64-expensive-checks-win buildbot.

Unlike many other instructions, these instructions have aliases which
take coprocessor registers, gpr register, accumulator (and dsp accumulator)
registers, floating point registers, floating point control registers and
coprocessor 2 data and control operands.

For the moment, these aliases are treated as pseudo instructions which are
expanded into the underlying instruction. As a result, disassembling these
instructions shows the underlying instruction and not the alias.

Reviewers: slthakur, atanasyan

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318386 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312043:
Tom Stellard [Wed, 15 Nov 2017 22:26:48 +0000 (22:26 +0000)]
Merging r312043:

------------------------------------------------------------------------
r312043 | rnk | 2017-08-29 14:44:21 -0700 (Tue, 29 Aug 2017) | 25 lines

[cmake] Stop putting the revision info in LLVM_VERSION_STRING

Summary:
This reduces the number of build actions after a no-op commit from
thousands to about six, which should be acceptable. If six actions is
still too many, developers can disable the LLVM_APPEND_VC_REV cmake
option.

llvm-config.h is a widely included header that should rarely change.
Before this patch, it would change after every re-configure. Very few
users of llvm-config.h need to know the precise version, and those that
do can migrate to incorporating LLVM_REVISION as provided by
llvm/Support/VCSRevision.h.

This should bring LLVM back to the behavior that it had before r306858
from June 30 2017. Most LLVM tools will now print a version string like
"6.0.0svn" instead of "6.0.0-git-c40c2a23de4".

Fixes PR34308

Reviewers: pcc, rafael, hans

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D37272
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318344 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310475:
Tom Stellard [Wed, 15 Nov 2017 20:48:55 +0000 (20:48 +0000)]
Merging r310475:

------------------------------------------------------------------------
r310475 | belleyb | 2017-08-09 06:47:01 -0700 (Wed, 09 Aug 2017) | 28 lines

[Support] PR33388 - Fix formatv_object move constructor

formatv_object currently uses the implicitly defined move constructor,
but it is buggy. In typical use-cases, the problem doesn't show-up
because all calls to the move constructor are elided. Thus, the buggy
constructors are never invoked.

The issue especially shows-up when code is compiled using the
-fno-elide-constructors compiler flag. For instance, this is useful when
attempting to collect accurate code coverage statistics.

The exact issue is the following:

The Parameters data member is correctly moved, thus making the
parameters occupy a new memory location in the target
object. Unfortunately, the default copying of the Adapters blindly
copies the vector of pointers, leaving each of these pointers
referencing the parameters in the original object instead of the copied
one. These pointers quickly become dangling when the original object is
deleted. This quickly leads to crashes.

The solution is to update the Adapters pointers when performing a move.
The copy constructor isn't useful for format objects and can thus be
deleted.

This resolves PR33388.

Differential Revision: https://reviews.llvm.org/D34463
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318333 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r315310:
Tom Stellard [Tue, 14 Nov 2017 20:49:34 +0000 (20:49 +0000)]
Merging r315310:

------------------------------------------------------------------------
r315310 | sdardis | 2017-10-10 06:34:45 -0700 (Tue, 10 Oct 2017) | 22 lines

[mips] Partially fix PR34391

Previously, the parsing of the 'subu $reg, ($reg,) imm' relied on a parser
which also rendered the operand to the instruction. In some cases the
general parser could construct an MCExpr which was not a MCConstantExpr
which MipsAsmParser was expecting.

Address this by altering the special handling to cope with unexpected inputs
and fine-tune the handling of cases where an register name that is not
available in the current ABI is regarded as not a match for the custom parser
but also not as an outright error.

Also enforces the binutils restriction that only constants are accepted.

This partially resolves PR34391.

Thanks to Ed Maste for reporting the issue!

Reviewers: nitesh.jain, arichardson

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318192 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r317204 and r318172:
Tom Stellard [Tue, 14 Nov 2017 20:40:11 +0000 (20:40 +0000)]
Merging r317204 and r318172:

------------------------------------------------------------------------
r317204 | sdardis | 2017-11-02 05:47:22 -0700 (Thu, 02 Nov 2017) | 15 lines

[mips] Use register scavenging with MSA.

MSA stores and loads to the stack are more likely to require an
emergency GPR spill slot due to the smaller offsets available
with those instructions.

Handle this by overestimating the size of the stack by determining
the largest offset presuming that all callee save registers are
spilled and accounting of incoming arguments when determining
whether an emergency spill slot is required.

Reviewers: atanasyan

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

------------------------------------------------------------------------

------------------------------------------------------------------------
r318172 | sdardis | 2017-11-14 11:11:45 -0800 (Tue, 14 Nov 2017) | 5 lines

[mips] Simplify test for 5.0.1 (NFC)

Simplify testing that an emergency spill slot is used when MSA
is used so that it can be included in the 5.0.1 release.

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318191 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r317470:
Tom Stellard [Tue, 14 Nov 2017 20:09:34 +0000 (20:09 +0000)]
Merging r317470:

------------------------------------------------------------------------
r317470 | sdardis | 2017-11-06 02:50:04 -0800 (Mon, 06 Nov 2017) | 12 lines

[mips] Fix PR35140

Mark all symbols involved with TLS relocations as being TLS symbols.

This resolves PR35140.

Thanks to Alex Crichton for reporting the issue!

Reviewers: atanasyan

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318188 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314798:
Tom Stellard [Tue, 14 Nov 2017 19:54:26 +0000 (19:54 +0000)]
Merging r314798:

------------------------------------------------------------------------
r314798 | sdardis | 2017-10-03 06:45:49 -0700 (Tue, 03 Oct 2017) | 9 lines

[mips] Enable spilling and reloading of the dsp register set.

The dsp register class is an alias of the gpr register class, so
we have to define instructions for spilling and reloading.

Reviewers: atanasyan

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318183 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310543:
Tom Stellard [Tue, 14 Nov 2017 19:47:47 +0000 (19:47 +0000)]
Merging r310543:

------------------------------------------------------------------------
r310543 | pcc | 2017-08-09 18:07:44 -0700 (Wed, 09 Aug 2017) | 9 lines

Linker: Create a function declaration when moving a non-prevailing alias of function type.

We were previously creating a global variable of function type,
which is invalid IR. This issue was exposed by r304690, in which we
started asserting that global variables were of a valid type.

Fixes PR33462.

Differential Revision: https://reviews.llvm.org/D36438
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318181 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310522:
Tom Stellard [Tue, 14 Nov 2017 19:40:53 +0000 (19:40 +0000)]
Merging r310522:

------------------------------------------------------------------------
r310522 | belleyb | 2017-08-09 13:58:39 -0700 (Wed, 09 Aug 2017) | 8 lines

[Linker] PR33527 - Linker::LinkOnlyNeeded should import AppendingLinkage globals

Linker::LinkOnlyNeeded should always import globals with
AppendingLinkage.

This resolves PR33527.

Differential Revision: https://reviews.llvm.org/D34448
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318180 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r316824:
Tom Stellard [Mon, 13 Nov 2017 22:26:54 +0000 (22:26 +0000)]
Merging r316824:

------------------------------------------------------------------------
r316824 | haicheng | 2017-10-27 19:27:14 -0700 (Fri, 27 Oct 2017) | 7 lines

[ConstantFold] Fix a crash when folding a GEP that has vector index

LLVM crashes when factoring out an out-of-bound index into preceding dimension
and the preceding dimension uses vector index.  Simply bail out now when this
case happens.

Differential Revision: https://reviews.llvm.org/D38677
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318096 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r315485:
Tom Stellard [Wed, 25 Oct 2017 20:56:42 +0000 (20:56 +0000)]
Merging r315485:

------------------------------------------------------------------------
r315485 | spatel | 2017-10-11 11:24:21 -0700 (Wed, 11 Oct 2017) | 7 lines

[x86] avoid infinite loop from SoftenFloatOperand (PR34866)

Legalization of fp128 assumes things that we should have asserts for,
so that's another potential improvement.

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@316607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314898:
Dylan McKay [Sat, 14 Oct 2017 22:31:06 +0000 (22:31 +0000)]
Merging r314898:
------------------------------------------------------------------------
r314898 | dylanmckay | 2017-10-04 23:37:22 +1300 (Wed, 04 Oct 2017) | 6 lines

[AVR] Implement LPMWRdZ pseudo-instruction's expansion.

FIXME: implementation is mostly copy-pasted from LDWRdPtr, so we should
refactor a bit and unify the two

Patch by Gerdo Erdi.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315836 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314897:
Dylan McKay [Sat, 14 Oct 2017 22:30:44 +0000 (22:30 +0000)]
Merging r314897:
------------------------------------------------------------------------
r314897 | dylanmckay | 2017-10-04 23:36:07 +1300 (Wed, 04 Oct 2017) | 3 lines

[AVR] Factor out mayLoad in tablegen patterns

Patch by Gergo Erdi.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315835 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314896:
Dylan McKay [Sat, 14 Oct 2017 22:30:19 +0000 (22:30 +0000)]
Merging r314896:
------------------------------------------------------------------------
r314896 | dylanmckay | 2017-10-04 23:33:36 +1300 (Wed, 04 Oct 2017) | 3 lines

[AVR] Elaborate LDWRdPtr into `ld r, X++; ld r+1, X`

Patch by Gergo Erdi.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315834 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314891:
Dylan McKay [Sat, 14 Oct 2017 22:29:48 +0000 (22:29 +0000)]
Merging r314891:
------------------------------------------------------------------------
r314891 | dylanmckay | 2017-10-04 22:51:28 +1300 (Wed, 04 Oct 2017) | 8 lines

[AVR] Insert JMP for long branches

Previously, on long branches (relative jumps of >4 kB), an assertion
failure was hit, as AVRInstrInfo::insertIndirectBranch was not
implemented. Despite its name, it is called by the branch relaxator
for *all* unconditional jumps.

Patch by Thomas Backman.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315833 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314890:
Dylan McKay [Sat, 14 Oct 2017 22:29:18 +0000 (22:29 +0000)]
Merging r314890:
------------------------------------------------------------------------
r314890 | dylanmckay | 2017-10-04 22:51:21 +1300 (Wed, 04 Oct 2017) | 16 lines

[AVR] Fix displacement overflow for LDDW/STDW

In some cases, the code generator attempts to generate instructions such as:

lddw r24, Y+63

which expands to:

ldd r24, Y+63
ldd r25, Y+64 # Oops! This is actually ld r25, Y in the binary

This commit limits the first offset to 62, and thus the second to 63.
It also updates some asserts in AVRExpandPseudoInsts.cpp, including for
INW and OUTW, which appear to be unused.

Patch by Thomas Backman.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315832 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312357:
Tom Stellard [Fri, 13 Oct 2017 02:33:17 +0000 (02:33 +0000)]
Merging r312357:

------------------------------------------------------------------------
r312357 | davide | 2017-09-01 12:54:08 -0700 (Fri, 01 Sep 2017) | 9 lines

[TTI] Fix getGEPCost() for geps with a single operand.

Previously this would sporadically crash as TargetType
was never initialized. We special-case the single-operand
case returning earlier and trying to mimic the behaviour of
isLegalAddressingMode as closely as possible.

Differential Revision:  https://reviews.llvm.org/D37277
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315663 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r313366:
Craig Topper [Sun, 8 Oct 2017 23:49:29 +0000 (23:49 +0000)]
Merging r313366:
------------------------------------------------------------------------
r313366 | ctopper | 2017-09-15 10:09:03 -0700 (Fri, 15 Sep 2017) | 9 lines

[X86] Don't create i64 constants on 32-bit targets when lowering v64i1 constant build vectors

When handling a v64i1 build vector of constants on 32-bit targets we were creating an illegal i64 constant that we then bitcasted back to v64i1. We need to instead create two 32-bit constants, bitcast them to v32i1 and concat the result. We should also take care to handle the halves being all zeros/ones after the split.

This patch splits the build vector and then recursively lowers the two pieces. This allows us to handle the all ones and all zeros cases with minimal effort. Ideally we'd just do the split and concat, and let lowering get called again on the new nodes, but getNode has special handling for CONCAT_VECTORS that reassembles the pieces back into a single BUILD_VECTOR. Hopefully the two temporary BUILD_VECTORS we had to create to do this that don't get returned don't cause any issues.

Fixes PR34605.

Differential Revision: https://reviews.llvm.org/D37858
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@315198 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r314892
Dylan McKay [Wed, 4 Oct 2017 10:06:12 +0000 (10:06 +0000)]
Revert r314892

It was accidentally merged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314893 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314891:
Dylan McKay [Wed, 4 Oct 2017 10:01:09 +0000 (10:01 +0000)]
Merging r314891:
------------------------------------------------------------------------
r314891 | dylanmckay | 2017-10-04 22:51:28 +1300 (Wed, 04 Oct 2017) | 8 lines

[AVR] Insert JMP for long branches

Previously, on long branches (relative jumps of >4 kB), an assertion
failure was hit, as AVRInstrInfo::insertIndirectBranch was not
implemented. Despite its name, it is called by the branch relaxator
for *all* unconditional jumps.

Patch by Thomas Backman.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314892 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[release_50] Merging r313916
Renato Golin [Tue, 3 Oct 2017 13:13:34 +0000 (13:13 +0000)]
[release_50] Merging r313916

[AArch64] Fix bug in store of vector 0 DAGCombine.

Summary:
Avoid using XZR/WZR directly as operands to split stores of zero
vectors.  Doing so can lead to the XZR/WZR being used by an instruction
that doesn't allow it (e.g. add).

Fixes bug 34674.

Reviewers: t.p.northover, efriedma, MatzeB

Subscribers: aemerson, rengolin, javed.absar, mcrosier, eraman, llvm-commits, kristof.beyls

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

PR34695.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314796 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311951 and r312038:
Tom Stellard [Fri, 29 Sep 2017 23:39:09 +0000 (23:39 +0000)]
Merging r311951 and r312038:

------------------------------------------------------------------------
r311951 | adrian | 2017-08-28 16:07:43 -0700 (Mon, 28 Aug 2017) | 6 lines

Fix a logic error in DwarfExpression::addMachineReg()

This fixes PR34323 and thus splitting undescribable registers into
smaller, describable sub-registers.

https://bugs.llvm.org/show_bug.cgi?id=34323
------------------------------------------------------------------------

------------------------------------------------------------------------
r312038 | joerg | 2017-08-29 14:18:07 -0700 (Tue, 29 Aug 2017) | 2 lines

Simplify test case, so that it works for both trunk and release-5.0.

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314567 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312348:
Tom Stellard [Fri, 29 Sep 2017 23:22:57 +0000 (23:22 +0000)]
Merging r312348:

------------------------------------------------------------------------
r312348 | matze | 2017-09-01 11:36:26 -0700 (Fri, 01 Sep 2017) | 39 lines

LiveIntervalAnalysis: Fix alias regunit reserved definition

A register in CodeGen can be marked as reserved: In that case we
consider the register always live and do not use (or rather ignore)
kill/dead/undef operand flags.

LiveIntervalAnalysis however tracks liveness per register unit (not per
register). We already needed adjustments for this in r292871 to deal
with super/sub registers. However I did not look at aliased register
there. Looking at ARM:

FPSCR (regunits FPSCR, FPSCR~FPSCR_NZCV) aliases with FPSCR_NZCV
(regunits FPSCR_NZCV, FPSCR~FPSCR_NZCV) hence they share a register unit
(FPSCR~FPSCR_NZCV) that represents the aliased parts of the registers.
This shared register unit was previously considered non-reserved,
however given that we uses of the reserved FPSCR potentially violate
some rules (like uses without defs) we should make FPSCR~FPSCR_NZCV
reserved too and stop tracking liveness for it.

This patch:
- Defines a register unit as reserved when: At least for one root
  register, the root register and all its super registers are reserved.
- Adjust LiveIntervals::computeRegUnitRange() for new reserved
  definition.
- Add MachineRegisterInfo::isReservedRegUnit() to have a canonical way
  of testing.
- Stop computing LiveRanges for reserved register units in HMEditor even
  with UpdateFlags enabled.
- Skip verification of uses of reserved reg units in the machine
  verifier (this usually didn't happen because there would be no cached
  liverange but there is no guarantee for that and I would run into this
  case before the HMEditor tweak, so may as well fix the verifier too).

Note that this should only affect ARMs FPSCR/FPSCR_NZCV registers today;
aliased registers are rarely used, the only other cases are hexagons
P0-P3/P3_0 and C8/USR pairs which are not mixing reserved/non-reserved
registers in an alias.

Differential Revision: https://reviews.llvm.org/D37356
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314565 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314252:
Tom Stellard [Fri, 29 Sep 2017 20:35:06 +0000 (20:35 +0000)]
Merging r314252:

------------------------------------------------------------------------
r314252 | gberry | 2017-09-26 14:40:46 -0700 (Tue, 26 Sep 2017) | 12 lines

[AArch64][Falkor] Fix bug in falkor prefetcher fix pass.

Summary:
In rare cases, loads that don't get prefetched that were marked as
strided loads could cause a crash if they occurred in a loop with other
colliding loads.

Reviewers: mcrosier

Subscribers: aemerson, rengolin, javed.absar, kristof.beyls

Differential Revision: https://reviews.llvm.org/D38261
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314555 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314251:
Tom Stellard [Fri, 29 Sep 2017 20:30:55 +0000 (20:30 +0000)]
Merging r314251:

------------------------------------------------------------------------
r314251 | gberry | 2017-09-26 14:40:41 -0700 (Tue, 26 Sep 2017) | 16 lines

[AArch64][Falkor] Fix correctness bug in falkor prefetcher fix pass and correct some opcode tag computations.

Summary:
This addresses a correctness bug for LD[1234]*_POST opcodes that have
the prefetcher fix applied to them: the base register was not being
written back from the temp after being incremented, so it would appear
to never be incremented.

Also, fix some opcode tag computations based on some updated HW details
to get better tag avoidance and thus better prefetcher performance.

Reviewers: mcrosier

Subscribers: aemerson, rengolin, javed.absar, kristof.beyls

Differential Revision: https://reviews.llvm.org/D38256
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314554 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311599:
Tom Stellard [Fri, 29 Sep 2017 20:26:51 +0000 (20:26 +0000)]
Merging r311599:

------------------------------------------------------------------------
r311599 | gberry | 2017-08-23 14:11:28 -0700 (Wed, 23 Aug 2017) | 4 lines

[AArch64][Falkor] Fix bug in Falkor HWPF tag collision avoidance

LDPDi was incorrectly marked as ignoring the destination register in the
prefetcher tag.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314553 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r313998:
Tom Stellard [Thu, 28 Sep 2017 17:52:12 +0000 (17:52 +0000)]
Merging r313998:

------------------------------------------------------------------------
r313998 | bmakam | 2017-09-22 10:46:36 -0700 (Fri, 22 Sep 2017) | 3 lines

    [Falkor] Add falkor CPU to host detection

    This returns "falkor" for Falkor CPU.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314437 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311921:
Joerg Sonnenberger [Thu, 28 Sep 2017 14:13:54 +0000 (14:13 +0000)]
Merging r311921:
------------------------------------------------------------------------
r311921 | joerg | 2017-08-28 22:20:47 +0200 (Mon, 28 Aug 2017) | 16 lines

Fix ARMv4 support

ARMv4 doesn't support the "BX" instruction, which has been introduced
with ARMv4t. Adjust the call lowering and tail call implementation
accordingly.

Further changes are necessary to ensure that presence of the v4t feature
is correctly set. Most importantly, the "generic" CPU for thumb-*
triples should include ARMv4t, since thumb mode without thumb support
would naturally be pointless.

Add a couple of asserts to ensure thumb instructions are not emitted
without CPU support.

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314417 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314180:
Dylan McKay [Thu, 28 Sep 2017 07:18:32 +0000 (07:18 +0000)]
Merging r314180:
------------------------------------------------------------------------
r314180 | dylanmckay | 2017-09-26 13:51:03 +1300 (Tue, 26 Sep 2017) | 7 lines

[AVR] When lowering shifts into loops, put newly generated MBBs in the same
spot as the original MBB

Discovered in avr-rust/rust#62
https://github.com/avr-rust/rust/issues/62

Patch by Gergo Erdi.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314383 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314183:
Dylan McKay [Thu, 28 Sep 2017 07:13:51 +0000 (07:13 +0000)]
Merging r314183:
------------------------------------------------------------------------
r314183 | dylanmckay | 2017-09-26 15:07:54 +1300 (Tue, 26 Sep 2017) | 3 lines

[AVR] Fix the build after setting alignment to 1 in r314179

Changing all types to be byte-aligned broke a small number of tests.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314382 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314179:
Dylan McKay [Thu, 28 Sep 2017 06:16:45 +0000 (06:16 +0000)]
Merging r314179:
------------------------------------------------------------------------
r314179 | dylanmckay | 2017-09-26 13:45:27 +1300 (Tue, 26 Sep 2017) | 11 lines

[AVR] Use 1-byte alignment for all data types

This was an oversight in the original backend data layout.

The AVR architecture does not have the concept of unaligned loads - all
loads/stores from all addresses are aligned to one byte.

Discovered in avr-rust issue #64
https://github.com/avr-rust/rust/issues/64

Patch By Gergo Erdi.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314379 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311620:
Dylan McKay [Wed, 27 Sep 2017 22:18:57 +0000 (22:18 +0000)]
Merging r311620:
------------------------------------------------------------------------
r311620 | dylanmckay | 2017-08-24 12:14:38 +1200 (Thu, 24 Aug 2017) | 1 line

[AVR] Use the correct register classes for 16-bit atomic operations
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314358 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r314070:
Dylan McKay [Wed, 27 Sep 2017 22:17:11 +0000 (22:17 +0000)]
Merging r314070:
------------------------------------------------------------------------
r314070 | dylanmckay | 2017-09-24 14:07:26 +1300 (Sun, 24 Sep 2017) | 6 lines

[AVR] Implement getCmpLibcallReturnType().

This fixes the avr-rust issue (#75) with floating-point comparisons generating broken code.
By default, LLVM assumes these comparisons return 32-bit values, but ours are 8-bit.

Patch By Thomas Backman.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314357 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312905:
Dylan McKay [Wed, 27 Sep 2017 22:15:50 +0000 (22:15 +0000)]
Merging r312905:
------------------------------------------------------------------------
r312905 | dylanmckay | 2017-09-11 22:32:51 +1200 (Mon, 11 Sep 2017) | 10 lines

[AVR] Enable the '__do_copy_data' function

Also enables '__do_clear_bss'.

These functions are automaticalled called by the CRT if they are
declared.

We need these to be called otherwise RAM will start completely
uninitialised, even though we need to copy RAM variables from progmem to
RAM.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314356 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312337:
Tom Stellard [Wed, 27 Sep 2017 18:08:25 +0000 (18:08 +0000)]
Merging r312337:

------------------------------------------------------------------------
r312337 | nha | 2017-09-01 09:56:32 -0700 (Fri, 01 Sep 2017) | 12 lines

AMDGPU: IMPLICIT_DEFs and DBG_VALUEs do not contribute to wait states

Summary:
This fixes a bug that was exposed on gfx9 in various
GL45-CTS.shaders.loops.*_iterations.select_iteration_count_fragment tests,
e.g. GL45-CTS.shaders.loops.do_while_uniform_iterations.select_iteration_count_fragment

Reviewers: arsenm

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D36193
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314327 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Merging r312337:"
Tom Stellard [Wed, 27 Sep 2017 18:06:46 +0000 (18:06 +0000)]
Revert "Merging r312337:"

This reverts commit r314324.

I unintentionally deleted most of the svn:mergeinfo for the release_50
branch with this commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314326 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312337:
Tom Stellard [Wed, 27 Sep 2017 17:56:19 +0000 (17:56 +0000)]
Merging r312337:

------------------------------------------------------------------------
r312337 | nha | 2017-09-01 09:56:32 -0700 (Fri, 01 Sep 2017) | 12 lines

AMDGPU: IMPLICIT_DEFs and DBG_VALUEs do not contribute to wait states

Summary:
This fixes a bug that was exposed on gfx9 in various
GL45-CTS.shaders.loops.*_iterations.select_iteration_count_fragment tests,
e.g. GL45-CTS.shaders.loops.do_while_uniform_iterations.select_iteration_count_fragment

Reviewers: arsenm

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D36193
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314324 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoBump version to 5.0.1
Tom Stellard [Fri, 15 Sep 2017 04:05:37 +0000 (04:05 +0000)]
Bump version to 5.0.1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@313339 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r313334:
Tom Stellard [Fri, 15 Sep 2017 03:05:55 +0000 (03:05 +0000)]
Merging r313334:
------------------------------------------------------------------------
r313334 | tstellar | 2017-09-14 19:25:22 -0700 (Thu, 14 Sep 2017) | 15 lines

merge-request.sh: Update to use new "Fixed by Commit(s)" field

Summary:
This will be used instead of the url field to track which commits need
to be merged.

This patch also drops support for version 1.x of the bugzilla CLI tool.

Reviewers: hansw, hans

Reviewed By: hans

Subscribers: hans, llvm-commits

Differential Revision: https://reviews.llvm.org/D37786
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@313337 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312285:
Hans Wennborg [Fri, 1 Sep 2017 16:28:52 +0000 (16:28 +0000)]
Merging r312285:
------------------------------------------------------------------------
r312285 | ctopper | 2017-08-31 14:39:23 -0700 (Thu, 31 Aug 2017) | 11 lines

[X86] Don't pull carry through X86ISD::ADD carryin, -1 if we can't guranteed we're really using the carry flag from the add.

Prior to this patch we had a DAG combine that tried to bypass an X86ISD::ADD with -1 being added to the carry flag of some previous operation. We would then pass the carry flag directly to user.

But this is only safe if the user is looking for the carry flag and not the zero flag.

So we need to only do this combine in a context where we know what flag the consumer is using.

Fixes PR34381.

Differential Revision: https://reviews.llvm.org/D37317
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@312333 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r312022:
Hans Wennborg [Tue, 29 Aug 2017 21:38:44 +0000 (21:38 +0000)]
Merging r312022:
------------------------------------------------------------------------
r312022 | hans | 2017-08-29 11:41:00 -0700 (Tue, 29 Aug 2017) | 10 lines

[DAG] Bound loop dependence check in merge optimization.

The loop dependence check looks for dependencies between store merge
candidates not captured by the chain sub-DAG doing a check of
predecessors which may be very large. Conservatively bound number of
nodes checked for compilation time. (Resolves PR34326).

Landing on behalf of Nirav Dave to unblock the 5.0.0 release.

Differential Revision: https://reviews.llvm.org/D37220
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@312041 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311835:
Hans Wennborg [Tue, 29 Aug 2017 17:17:42 +0000 (17:17 +0000)]
Merging r311835:
------------------------------------------------------------------------
r311835 | dhinton | 2017-08-26 14:08:51 -0700 (Sat, 26 Aug 2017) | 12 lines

[Dominators] Remove redundant explicit template instantiation.

Summary:
Remove redundant explicit template instantiation.

This was reported by Andrew Kelley building release_50 with gcc7.2.0 on MacOS: duplicate symbol llvm::DominatorTreeBase.

Reviewers: kuhar, andrewrk, davide, hans

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D37185
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@312014 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: NetBSD LLDB improvements
Hans Wennborg [Mon, 28 Aug 2017 20:53:38 +0000 (20:53 +0000)]
ReleaseNotes: NetBSD LLDB improvements

By Kamil Rytarowski!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311932 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: llvm-dlltool
Hans Wennborg [Mon, 28 Aug 2017 20:31:49 +0000 (20:31 +0000)]
ReleaseNotes: llvm-dlltool

By Martell Malone!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311927 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: LLVM_REVERSE_ITERATION
Hans Wennborg [Mon, 28 Aug 2017 20:16:59 +0000 (20:16 +0000)]
ReleaseNotes: LLVM_REVERSE_ITERATION

By Mandeep Singh Grang!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311919 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoindex.rst: remove in-progress notice
Hans Wennborg [Mon, 28 Aug 2017 19:36:56 +0000 (19:36 +0000)]
index.rst: remove in-progress notice

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311909 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips][Release Notes] Release notes for 5.0
Simon Dardis [Fri, 25 Aug 2017 09:57:29 +0000 (09:57 +0000)]
[mips][Release Notes] Release notes for 5.0

Reviewers: atanasyan, nitesh.jain

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311771 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: Note about opt-viewer.py, by Adam Nemet
Hans Wennborg [Fri, 25 Aug 2017 00:42:51 +0000 (00:42 +0000)]
ReleaseNotes: Note about opt-viewer.py, by Adam Nemet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311738 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: typo
Hans Wennborg [Thu, 24 Aug 2017 22:56:18 +0000 (22:56 +0000)]
ReleaseNotes: typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311729 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: remove one more in-progress warning
Hans Wennborg [Thu, 24 Aug 2017 22:54:37 +0000 (22:54 +0000)]
ReleaseNotes: remove one more in-progress warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311728 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: remove boiler-plate, and minor fixes
Hans Wennborg [Thu, 24 Aug 2017 22:32:10 +0000 (22:32 +0000)]
ReleaseNotes: remove boiler-plate, and minor fixes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311715 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: remove in-progress warning
Hans Wennborg [Thu, 24 Aug 2017 22:25:24 +0000 (22:25 +0000)]
ReleaseNotes: remove in-progress warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311714 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311623:
Hans Wennborg [Thu, 24 Aug 2017 16:16:07 +0000 (16:16 +0000)]
Merging r311623:
------------------------------------------------------------------------
r311623 | hans | 2017-08-23 18:08:27 -0700 (Wed, 23 Aug 2017) | 11 lines

[DAG] Fix Node Replacement in PromoteIntBinOp

When one operand is a user of another in a promoted binary operation
we may replace and delete the returned value before returning
triggering an assertion. Reorder node replacements to prevent this.

Fixes PR34137.

Landing on behalf of Nirav.

Differential Revision: https://reviews.llvm.org/D36581
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311554:
Hans Wennborg [Wed, 23 Aug 2017 21:33:38 +0000 (21:33 +0000)]
Merging r311554:
------------------------------------------------------------------------
r311554 | mcrosier | 2017-08-23 07:10:06 -0700 (Wed, 23 Aug 2017) | 10 lines

[Reassociate] Don't canonicalize x + (-Constant * y) -> x - (Constant * y)..

..if the resulting subtract will be broken up later.  This can cause us to get
into an infinite loop.

x + (-5.0 * y)      -> x - (5.0 * y)       ; Canonicalize neg const
x - (5.0 * y)       -> x + (0 - (5.0 * y)) ; Break up subtract
x + (0 - (5.0 * y)) -> x + (-5.0 * y)      ; Replace 0-X with X*-1.

PR34078
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311603 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311565:
Hans Wennborg [Wed, 23 Aug 2017 21:30:37 +0000 (21:30 +0000)]
Merging r311565:
------------------------------------------------------------------------
r311565 | hans | 2017-08-23 08:43:28 -0700 (Wed, 23 Aug 2017) | 8 lines

LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020)

The lowering isn't really an optimization, so optnone shouldn't make a
difference. ARM relies on the pass running when using "-mthread-model
single", because in that mode, it doesn't run AtomicExpand. See bug for
more details.

Differential Revision: https://reviews.llvm.org/D37040
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311602 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r307529 "This patch completely replaces the scheduling information for the...
Hans Wennborg [Wed, 23 Aug 2017 21:17:15 +0000 (21:17 +0000)]
Revert r307529 "This patch completely replaces the scheduling information for the SandyBridge architecture"

This caused PR34080, which seems to have been fixed by r310792, but that change
introduced severe performance regressions.

Reverting to unblock the 5.0.0 release while these issues are worked out on trunk.

Also reverting a few tests that were added later and depended on the new scheduling:

    LLVM :: CodeGen/X86/f16c-schedule.ll
    LLVM :: CodeGen/X86/lea32-schedule.ll
    LLVM :: CodeGen/X86/lea64-schedule.ll
    LLVM :: CodeGen/X86/popcnt-schedule.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311600 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311572:
Hans Wennborg [Wed, 23 Aug 2017 20:03:43 +0000 (20:03 +0000)]
Merging r311572:
------------------------------------------------------------------------
r311572 | ctopper | 2017-08-23 09:41:02 -0700 (Wed, 23 Aug 2017) | 9 lines

[AVX512] Don't create SHRUNKBLEND SDNodes for 512-bit vectors

There are no 512-bit blend instructions so we shouldn't create SHRUNKBLEND for them.

On a side note, it looks like there may be a missed opportunity for constant folding TESTM when LHS and RHS are equal.

This fixes PR34139.

Differential Revision: https://reviews.llvm.org/D36992
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311593 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] more release notes updates for 5.0
Renato Golin [Wed, 23 Aug 2017 17:04:59 +0000 (17:04 +0000)]
[ARM] more release notes updates for 5.0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311578 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RelNotes,AArch64] Mention improved instruction fusion and fun alignment.
Florian Hahn [Wed, 23 Aug 2017 09:12:41 +0000 (09:12 +0000)]
[RelNotes,AArch64] Mention improved instruction fusion and fun alignment.

Reviewers: t.p.northover, hans, kristof.beyls

Reviewed By: hans

Subscribers: aemerson, rengolin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311539 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Docs] Update release notes for PPC
Kit Barton [Tue, 22 Aug 2017 19:56:41 +0000 (19:56 +0000)]
[Docs] Update release notes for PPC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311486 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311387:
Hans Wennborg [Tue, 22 Aug 2017 18:19:41 +0000 (18:19 +0000)]
Merging r311387:
------------------------------------------------------------------------
r311387 | steven_wu | 2017-08-21 14:49:13 -0700 (Mon, 21 Aug 2017) | 16 lines

[IR] AutoUpgrade ModuleFlagBehavior for PIC and PIE level

Summary:
From r303590, ModuleFlagBehavior for PIC and PIE level is changed from
Error to Max. This will cause bitcode compatibility issue when linking
against a bitcode static archive built with old compiler.
Add an auto-ugprade path to upgrade the the ModuleFlagBehavior in the
old bitcode to match the new one so IRLinker can link them.

Reviewers: tejohnson, mehdi_amini, dexonsmith

Reviewed By: dexonsmith

Subscribers: hans, llvm-commits

Differential Revision: https://reviews.llvm.org/D36556
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311481 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311263:
Hans Wennborg [Tue, 22 Aug 2017 17:44:59 +0000 (17:44 +0000)]
Merging r311263:
------------------------------------------------------------------------
r311263 | ctopper | 2017-08-19 15:02:02 -0700 (Sat, 19 Aug 2017) | 1 line

[AVX512] Use alignedstore256 in a pattern that's emitting a 256-bit movaps from an extract subvector operation.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311478 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311429:
Hans Wennborg [Tue, 22 Aug 2017 16:17:32 +0000 (16:17 +0000)]
Merging r311429:
------------------------------------------------------------------------
r311429 | ctopper | 2017-08-21 22:40:17 -0700 (Mon, 21 Aug 2017) | 9 lines

[X86] Prevent several calls to ISD::isConstantSplatVector from returning a narrower APInt than the original scalar type

ISD::isConstantSplatVector can shrink to the smallest splat width. But we don't check the size of the resulting APInt at all. This can cause us to misinterpret the results.

This patch just adds a flag to prevent the APInt from changing width.

Fixes PR34271.

Differential Revision: https://reviews.llvm.org/D36996
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311462 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311061:
Hans Wennborg [Tue, 22 Aug 2017 16:09:55 +0000 (16:09 +0000)]
Merging r311061:
------------------------------------------------------------------------
r311061 | compnerd | 2017-08-16 19:42:24 -0700 (Wed, 16 Aug 2017) | 10 lines

ARM: mark CPSR as clobbered for Windows VLAs

When lowering a VLA, we emit a __chstk call.  However, this call can
internally clobber CPSR.  We did not mark this register as an ImpDef,
which could potentially allow a comparison to be hoisted above the call
to `__chkstk`.  In such a case, the CPSR could be clobbered, and the
check invalidated.  When the support was initially added, it seemed that
the call would take care of preventing CPSR from being clobbered, but
this is not the case.  Mark the register as clobbered to fix a possible
state corruption.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311461 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RelNotes,ARM] Mention improved ARM/Thumb codegen and LTO.
Florian Hahn [Tue, 22 Aug 2017 16:01:04 +0000 (16:01 +0000)]
[RelNotes,ARM] Mention improved ARM/Thumb codegen and LTO.

Reviewers: echristo, rengolin, kristof.beyls, hans, t.p.northover

Reviewed By: hans

Subscribers: aemerson, inglorion, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311460 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311071:
Hans Wennborg [Mon, 21 Aug 2017 23:28:04 +0000 (23:28 +0000)]
Merging r311071:
------------------------------------------------------------------------
r311071 | eladcohen | 2017-08-17 01:06:36 -0700 (Thu, 17 Aug 2017) | 13 lines

[SelectionDAG] Teach the vector-types operand scalarizer about SETCC

When v1i1 is legal (e.g. AVX512) the legalizer can reach
a case where a v1i1 SETCC with an illgeal vector type operand
wasn't scalarized (since v1i1 is legal) but its operands does
have to be scalarized. This used to assert because SETCC was
missing from the vector operand scalarizer.

This patch attemps to teach the legalizer to handle these cases
by scalazring the operands, converting the node into a scalar
SETCC node.

Differential revision: https://reviews.llvm.org/D36651
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311409 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310990:
Hans Wennborg [Mon, 21 Aug 2017 23:26:07 +0000 (23:26 +0000)]
Merging r310990:
------------------------------------------------------------------------
r310990 | mstorsjo | 2017-08-15 22:18:36 -0700 (Tue, 15 Aug 2017) | 18 lines

[llvm-dlltool] Fix creating stdcall/fastcall import libraries for i386

Hook up the -k option (that in the original GNU dlltool removes the
@n suffix from the symbol that the final executable ends up linked to).

In llvm-dlltool, make sure that functions end up with the undecorate
name type if this option is set and they are decorated. In mingw, when
creating import libraries from def files instead of creating an import
library as a side effect of linking a DLL, the symbol names in the def
contain the stdcall/fastcall decoration (but no leading underscore).

By setting the undecorate name type, a linker linking to the import
library will omit the decoration from the DLL import entry.

With this in place, mingw-w64 for i386 built with llvm-dlltool/clang
produces import libraries that actually work.

Differential Revision: https://reviews.llvm.org/D36548
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311408 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310712:
Hans Wennborg [Mon, 21 Aug 2017 20:20:05 +0000 (20:20 +0000)]
Merging r310712:
------------------------------------------------------------------------
r310712 | mgorny | 2017-08-11 06:25:20 -0700 (Fri, 11 Aug 2017) | 26 lines

[cmake] Expose the dependencies of ExecutionEngine as PUBLIC

Expose the dependencies of LLVMExecutionEngine library as PUBLIC rather
than PRIVATE when building a shared library. This is necessary because
the library is not contained but exposes API of other LLVM libraries via
its headers.

This causes other libraries to fail to link if the linker verifies for
correctness of -l flags (i.e. fails on indirect dependencies). This e.g.
happens when building LLDB against shared LLVM:

  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTIN4llvm18MCJITMemoryManagerE[_ZTIN4llvm18MCJITMemoryManagerE]+0x10): undefined reference to `typeinfo for llvm::RuntimeDyld::MemoryManager'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN4llvm18MCJITMemoryManagerE[_ZTVN4llvm18MCJITMemoryManagerE]+0x60): undefined reference to `llvm::RuntimeDyld::MemoryManager::anchor()'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0x48): undefined reference to `llvm::RTDyldMemoryManager::deregisterEHFrames()'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0x60): undefined reference to `llvm::RuntimeDyld::MemoryManager::anchor()'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0xd0): undefined reference to `llvm::JITSymbolResolver::anchor()'
  collect2: error: ld returned 1 exit status

Declaring the dependencies as PUBLIC guarantees that any package using
the ExecutionEngine library will also get explicit -l flags for
the dependent libraries guaranteeing that the symbols exposed in headers
could be resolved.

Patch originally written by NAKAMURA Takumi.

Differential Revision: https://reviews.llvm.org/D36211
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311376 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311229:
Hans Wennborg [Mon, 21 Aug 2017 20:07:38 +0000 (20:07 +0000)]
Merging r311229:
------------------------------------------------------------------------
r311229 | chandlerc | 2017-08-18 23:56:11 -0700 (Fri, 18 Aug 2017) | 19 lines

[Inliner] Fix a nasty bug when inlining a non-recursive trace of
a function into itself.

We tried to fix this before in r306495 but that got reverted as the
assert was actually hit.

This fixes the original bug (which we seem to have lost track of with
the revert) by blocking a second remapping when the function being
inlined is also the caller and the remapping could succeed but
erroneously.

The included test case would actually load from an inlined copy of the
alloca before this change, failing to load the stored value and
miscompiling.

Many thanks to Richard Smith for diagnosing a user miscompile to this
bug, and to Kyle for the first attempt and initial analysis and David Li
for remembering the issue and how to fix it and suggesting the patch.
I'm just stitching it together and landing it. =]
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311372 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311258:
Hans Wennborg [Mon, 21 Aug 2017 19:54:09 +0000 (19:54 +0000)]
Merging r311258:
------------------------------------------------------------------------
r311258 | mstorsjo | 2017-08-19 12:47:48 -0700 (Sat, 19 Aug 2017) | 9 lines

[ARM] Check the right order for halves of VZIP/VUZP if both parts are used

This is the exact same fix as in SVN r247254. In that commit, the fix was
applied only for isVTRNMask and isVTRN_v_undef_Mask, but the same issue
is present for VZIP/VUZP as well.

This fixes PR33921.

Differential Revision: https://reviews.llvm.org/D36899
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311369 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310262:
Hans Wennborg [Fri, 18 Aug 2017 20:38:28 +0000 (20:38 +0000)]
Merging r310262:
------------------------------------------------------------------------
r310262 | sdardis | 2017-08-07 08:37:57 -0700 (Mon, 07 Aug 2017) | 9 lines

[DebugInfo][DWARF] Correct some usages of PRIx32 to PRIx64

These lead to tests failing spuriously as the values after being rendered to a
string were incorrect.

Reviewers: clayborg

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311196 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311087:
Hans Wennborg [Fri, 18 Aug 2017 20:35:42 +0000 (20:35 +0000)]
Merging r311087:
------------------------------------------------------------------------
r311087 | sdardis | 2017-08-17 07:14:25 -0700 (Thu, 17 Aug 2017) | 15 lines

[dfsan] Add explicit zero extensions for shadow parameters in function wrappers.

In the case where dfsan provides a custom wrapper for a function,
shadow parameters are added for each parameter of the function.
These parameters are i16s. For targets which do not consider this
a legal type, the lack of sign extension information would cause
LLVM to generate anyexts around their usage with phi variables
and calling convention logic.

Address this by introducing zero exts for each shadow parameter.

Reviewers: pcc, slthakur

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311195 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310066:
Hans Wennborg [Fri, 18 Aug 2017 20:25:45 +0000 (20:25 +0000)]
Merging r310066:
------------------------------------------------------------------------
r310066 | mcrosier | 2017-08-04 09:44:06 -0700 (Fri, 04 Aug 2017) | 4 lines

[AArch64] Fix an assertion for pre-index generation with unscaled loads/stores.

Differential Revision: https://reviews.llvm.org/D36248
PR34035
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311192 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310498:
Hans Wennborg [Thu, 17 Aug 2017 17:42:21 +0000 (17:42 +0000)]
Merging r310498:
------------------------------------------------------------------------
r310498 | guyblank | 2017-08-09 10:21:01 -0700 (Wed, 09 Aug 2017) | 9 lines

[X86][AVX512] Choose correct registers in vpbroadcastb/w

Fixes the vpbroadcastb/w instructions which use GPRs as source operands, to use the correct registers.
The full GPR should be used, and not the subregister, as it happens before the patch.

Fixes pr33795

Differential Revision:
https://reviews.llvm.org/D36479
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311110 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310979:
Hans Wennborg [Thu, 17 Aug 2017 17:36:27 +0000 (17:36 +0000)]
Merging r310979:
------------------------------------------------------------------------
r310979 | qcolombet | 2017-08-15 17:17:05 -0700 (Tue, 15 Aug 2017) | 38 lines

[VirtRegRewriter] Properly model the register liveness on undef subreg definition

Undef subreg definition means that the content of the super register
doesn't matter at this point. While that's true for virtual registers,
this may not hold when replacing them with actual physical registers.
Indeed, some part of the physical register may be coalesced with the
related virtual register and thus, the values for those parts matter and
must be live.

The fix consists in checking whether or not subregs of the physical register
being assigned to an undef subreg definition are live through that def and
insert an implicit use if they are. Doing so, will keep them alive until
that point like they should be.

E.g., let vreg14 being assigned to R0_R1 then
%vreg14:gsub_0<def,read-undef> = COPY %R0 ; <-- R1 is still live here
%vreg14:gsub_1<def> = COPY %R1

Before this changes, the rewriter would change the code into:
%R0<def> = KILL %R0, %R0_R1<imp-def> ; <-- this tells R1 is redefined
%R1<def> = KILL %R1, %R0_R1<imp-def>, %R0_R1<imp-use> ; this value of this R1
                                                      ; is believed to come
                                                      ; from the previous
                                                      ; instruction

Because of this invalid liveness, later pass could make wrong choices and in
particular clobber live register as it happened with the register scavenger in
llvm.org/PR34107

Now we would generate:
%R0<def> = KILL %R0, %R0_R1<imp-def>, %R0_R1<imp-use> ; This tells R1 needs to
                                                      ; reach this point
%R1<def> = KILL %R1, %R0_R1<imp-def>, %R0_R1<imp-use>

The bug has been here forever, it got exposed recently because the register
scavenger got smarter.

Fixes llvm.org/PR34107
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311108 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310906:
Hans Wennborg [Thu, 17 Aug 2017 17:33:33 +0000 (17:33 +0000)]
Merging r310906:
------------------------------------------------------------------------
r310906 | marsupial | 2017-08-14 19:25:36 -0700 (Mon, 14 Aug 2017) | 12 lines

Propagate error in LazyEmittingLayer::removeModule.

Summary:
Besides being the better thing to do, not doing so will triggers an assert with LLVM_ENABLE_ABI_BREAKING_CHECKS.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36700
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311107 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r311068:
Hans Wennborg [Thu, 17 Aug 2017 17:15:08 +0000 (17:15 +0000)]
Merging r311068:
------------------------------------------------------------------------
r311068 | mstorsjo | 2017-08-16 22:58:27 -0700 (Wed, 16 Aug 2017) | 3 lines

[llvm-dlltool] Don't crash if no def file is provided or it can't be opened

Differential Revision: https://reviews.llvm.org/D36780
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311104 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310991:
Hans Wennborg [Thu, 17 Aug 2017 17:04:53 +0000 (17:04 +0000)]
Merging r310991:
------------------------------------------------------------------------
r310991 | mstorsjo | 2017-08-15 22:22:49 -0700 (Tue, 15 Aug 2017) | 13 lines

[COFF] Make the weak aliases optional

When creating an import library from lld, the cases with
Name != ExtName shouldn't end up as a weak alias, but as a real
export of the new name, which is what actually is exported from
the DLL.

This restores the behaviour of renamed exports to what it was in
4.0.

The other half of this commit, including test, goes into lld.

Differential Revision: https://reviews.llvm.org/D36633
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311100 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310988:
Hans Wennborg [Thu, 17 Aug 2017 16:57:03 +0000 (16:57 +0000)]
Merging r310988:
------------------------------------------------------------------------
r310988 | mstorsjo | 2017-08-15 22:13:16 -0700 (Tue, 15 Aug 2017) | 8 lines

[COFF] Add SymbolName as a distinct field in COFFImportFile

The previous Name and ExtName aren't enough to convey all the nuances
between weak aliases and stdcall decorated function names.

A test for this will be added in LLD.

Differential Revision: https://reviews.llvm.org/D36544
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311096 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310939:
Hans Wennborg [Thu, 17 Aug 2017 16:45:36 +0000 (16:45 +0000)]
Merging r310939:
------------------------------------------------------------------------
r310939 | tstellar | 2017-08-15 11:11:56 -0700 (Tue, 15 Aug 2017) | 16 lines

test-release.sh: Move test-suite setup to beginning of the script

Summary:
We want to catch failures early before do the full 3 stage build.

The goal here is to avoid running through the whole build process and have
it fail at the end (and not create the binary packages), just because
some prerequisites failed to install.

Reviewers: rovka, hans

Reviewed By: hans

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36422
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311094 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310926:
Hans Wennborg [Thu, 17 Aug 2017 16:43:59 +0000 (16:43 +0000)]
Merging r310926:
------------------------------------------------------------------------
r310926 | steven_wu | 2017-08-15 09:16:33 -0700 (Tue, 15 Aug 2017) | 13 lines

[Doc] Update LangRef for new Module Flag Behavior

Summary:
Add the documentation for the new module flag behavior. The new
ModFlagBehavior is added in r303590.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36557
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311092 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd external project LDC to release notes.
Kai Nacke [Thu, 17 Aug 2017 05:02:41 +0000 (05:02 +0000)]
Add external project LDC to release notes.

LDC, the LLVM-based D compiler, is already ready for LLVM 5.0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311064 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310796:
Hans Wennborg [Tue, 15 Aug 2017 00:16:21 +0000 (00:16 +0000)]
Merging r310796:
------------------------------------------------------------------------
r310796 | asb | 2017-08-13 11:49:33 -0700 (Sun, 13 Aug 2017) | 16 lines

Remove RISCV from LLVM_ALL_TARGETS in CMakeLists.txt

It was mistakenly added to that list in D23560 (committed in rL285712). RISCV
is an experimental backend and should never have been in that list, I
mistakenly interpreted LLVM_ALL_TARGETS as a list of all targets rather than
targets to build by default. Unfortunately, because of this the RISCV backend
has been building by default when it shouldn't be.

This commet adds a description comment, which should help to avoid such
mistakes in the future.

See my message to llvm-dev for more information and analysis
<http://lists.llvm.org/pipermail/llvm-dev/2017-August/116347.html>.

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@310900 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r310784:
Hans Wennborg [Tue, 15 Aug 2017 00:09:10 +0000 (00:09 +0000)]
Merging r310784:
------------------------------------------------------------------------
r310784 | ctopper | 2017-08-12 13:19:44 -0700 (Sat, 12 Aug 2017) | 16 lines

[X86] When handling addcarry intrinsic, create the flag result with the correct type so we don't crash if we use a memory instruction

Summary:
Previously we were creating the flag result with MVT::Other which is interpretted as a Chain node. If we used a memory form of the instruction we would end up with a copyToReg that consumed the chain result of the adcx instruction instead of the flag result.

Pretty sure we should be using MVT::i32 here, that's what we do other places we create these node types.

We should probably consider this for 5.0 as well.

Reviewers: RKSimon, zvi, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36645
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@310899 91177308-0d34-0410-b5e6-96231b3b80d8