7 years agoMerging r259342 (with s/p2align 4/align 16) because r258750 is not in 3.8.
Hans Wennborg [Tue, 2 Feb 2016 17:35:07 +0000 (17:35 +0000)]
Merging r259342 (with s/p2align 4/align 16) because r258750 is not in 3.8.

r259342 | ibreger | 2016-01-31 23:56:09 -0800 (Sun, 31 Jan 2016) | 3 lines

AVX512 : Fix SETCCE lowering for KNL 32 bit.

Differential Revision: http://reviews.llvm.org/D16752

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

7 years agoMerging r259375:
Hans Wennborg [Mon, 1 Feb 2016 19:18:10 +0000 (19:18 +0000)]
Merging r259375:
r259375 | majnemer | 2016-02-01 09:37:56 -0800 (Mon, 01 Feb 2016) | 6 lines

[InstCombine] Don't transform (X+INT_MAX)>=(Y+INT_MAX) -> (X<=Y)

This miscompile came about because we tried to use a transform which was
only appropriate for xor operators when addition was present.

This fixes PR26407.

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

7 years agoMerging r259228:
Tim Northover [Fri, 29 Jan 2016 22:00:06 +0000 (22:00 +0000)]
Merging r259228:
r259228 | tnorthover | 2016-01-29 11:18:46 -0800 (Fri, 29 Jan 2016) | 13 lines

ARM: don't mangle DAG constant if it has more than one use

The basic optimisation was to convert (mul $LHS, $complex_constant) into
roughly "(shl (mul $LHS, $simple_constant), $simple_amt)" when it was expected
to be cheaper. The original logic checks that the mul only has one use (since
we're mangling $complex_constant), but when used in even more complex
addressing modes there may be an outer addition that can pick up the wrong
value too.

I *think* the ARM addressing-mode problem is actually unreachable at the
moment, but that depends on complex assessments of the profitability of
pre-increment addressing modes so I've put a real check in there instead of an

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

7 years agoMerging r259236:
Hans Wennborg [Fri, 29 Jan 2016 21:33:02 +0000 (21:33 +0000)]
Merging r259236:
r259236 | spatel | 2016-01-29 12:21:02 -0800 (Fri, 29 Jan 2016) | 8 lines

[InstCombine] avoid an insertelement transformation that induces the opposite extractelement fold (PR26354)

We would infinite loop because we created a shufflevector that was wider than
needed and then failed to combine that with the insertelement. When subsequently
visiting the extractelement from that shuffle, we see that it's unnecessary,
delete it, and trigger another visit to the insertelement.


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

7 years agoMerging r258922:
Tom Stellard [Fri, 29 Jan 2016 16:45:55 +0000 (16:45 +0000)]
Merging r258922:

r258922 | marek.olsak | 2016-01-27 06:19:45 -0500 (Wed, 27 Jan 2016) |
12 lines

AMDGPU/SI: Stoney has only 16 LDS banks

This is a candidate for stable, along with all patches that add the

Reviewers: tstellarAMD

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16485


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

7 years agoMerging r257666:
Tom Stellard [Fri, 29 Jan 2016 16:45:52 +0000 (16:45 +0000)]
Merging r257666:

r257666 | changpeng.fang | 2016-01-13 15:39:25 -0500 (Wed, 13 Jan 2016) | 2 lines

AMDGPU/SI: Update ISA version for FIJI


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

7 years agoBring back the test-suite export in test-release without bringing back the build...
Daniel Sanders [Thu, 28 Jan 2016 21:05:40 +0000 (21:05 +0000)]
Bring back the test-suite export in test-release without bringing back the build failures.

r257791 disabled the test-suite export since the addition of CMakeLists.txt was
causing build failures. This patch exports the test-suite again but does so
outside the source tree so that it isn't included in the Phase[123] builds.

Reviewers: hans

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16679

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

7 years agoMerging r258971:
Hans Wennborg [Thu, 28 Jan 2016 18:23:25 +0000 (18:23 +0000)]
Merging r258971:
r258971 | spatel | 2016-01-27 11:22:45 -0800 (Wed, 27 Jan 2016) | 26 lines

[SimplifyCFG] limit recursion depth when speculating instructions (PR26308)

This is a fix for:

With the switch to using the TTI cost model in:
...it became possible to hit a zero-cost cycle of instructions (gep -> phi -> gep...),
so we need a cap for the recursion in DominatesMergePoint().

A recursion depth parameter was already added for a different reason in:
...so we can just set a limit for it.

I pulled "10" out of the air and made it an independent parameter that we can play with.
It might be higher than it needs to be given the currently low default value of
PHINodeFoldingThreshold (2). That's the starting cost value that we enter the recursion
with, and most instructions have cost set to TCC_Basic (1), so I don't think we're going
to speculate more than 2 instructions with the current parameters.

As noted in the review and the TODO comment, we can do better than just limiting recursion

Differential Revision: http://reviews.llvm.org/D16637


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

7 years agoMerging r258471:
Hans Wennborg [Thu, 28 Jan 2016 18:16:55 +0000 (18:16 +0000)]
Merging r258471:
r258471 | pirama | 2016-01-21 17:16:57 -0800 (Thu, 21 Jan 2016) | 14 lines

Do not lower VSETCC if operand is an f16 vector

SETCC with f16 vectors has OperationAction set to Expand but still gets
lowered to FCM* intrinsics based on its result type.  This patch skips
lowering of VSETCC if the operand is an f16 vector.

v4 and v8 tests included.

Reviewers: ab, jmolloy

Subscribers: srhines, llvm-commits

Differential Revision: http://reviews.llvm.org/D15361

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

7 years agoMerging r258891:
Hans Wennborg [Wed, 27 Jan 2016 00:19:52 +0000 (00:19 +0000)]
Merging r258891:
r258891 | hans | 2016-01-26 16:19:05 -0800 (Tue, 26 Jan 2016) | 25 lines

test-release.sh: Ignore LC_CTYPE in sed invocation on Darwin

Here, sed is used to prepare object files for comparison via cmp. On my Darwin
15.4.0 machine, LC_CTYPE is set to UTF-8 (by default, I believe). Under these
circumstances, anything sed is made to read will be treated as UTF-8, prompting
it to signal an error if it is not, like so:

% sed s/a/b/ <(head -n1 /dev/random) >/dev/null; echo $?
sed: RE error: illegal byte sequence

To make sed work as expected, I need to set LC_CTYPE to C:

% env LC_CTYPE=C sed s/a/b/ <(head -n1 /dev/random) >/dev/null; echo $?

Without this change, sed will exit with an error for every single file that it
compares between phase 2 and phase 3, thereby making it look as if the
differences were far larger than they are.

Patch by Elias Pipping!

Differential Revision: http://reviews.llvm.org/D16548

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

7 years agoMerging r258386:
Tom Stellard [Tue, 26 Jan 2016 23:57:01 +0000 (23:57 +0000)]
Merging r258386:

r258386 | thomas.stellard | 2016-01-20 23:28:34 -0500 (Wed, 20 Jan 2016) | 14 lines

AMDGPU/SI: Pass whether to use the SI scheduler via Target Attribute

Currently the SI scheduler can be selected via command line option,
but it turned out it would be better if it was selectable via a Target Attribute.

This patch adds "si-scheduler" attribute to the backend.

Reviewers: tstellarAMD, echristo

Subscribers: echristo, arsenm

Differential Revision: http://reviews.llvm.org/D16192


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

7 years agoMerging r258184:
Sanjoy Das [Tue, 26 Jan 2016 22:29:46 +0000 (22:29 +0000)]
Merging r258184:
r258184 | sanjoy | 2016-01-19 12:53:51 -0800 (Tue, 19 Jan 2016) | 20 lines

[SCEV] Fix PR26207

In some cases, the max backedge taken count can be more conservative
than the exact backedge taken count (for instance, because
ScalarEvolution::getRange is not control-flow sensitive whereas
computeExitLimitFromICmp can be).  In these cases,
computeExitLimitFromCond (specifically the bit that deals with `and` and
`or` instructions) can create an ExitLimit instance with a
`SCEVCouldNotCompute` max backedge count expression, but a computable
exact backedge count expression.  This violates an implicit SCEV
assumption: a computable exact BE count should imply a computable max BE

This change

 - Makes the above implicit invariant explicit by adding an assert to
   ExitLimit's constructor

 - Changes `computeExitLimitFromCond` to be more robust around
   conservative max backedge counts

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

7 years agoRevert accidental changes from r258805
Hans Wennborg [Tue, 26 Jan 2016 19:44:49 +0000 (19:44 +0000)]
Revert accidental changes from r258805

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

7 years agoMerging r258436:
Dimitry Andric [Tue, 26 Jan 2016 19:43:59 +0000 (19:43 +0000)]
Merging r258436:
r258436 | dim | 2016-01-21 22:57:49 +0100 (Thu, 21 Jan 2016) | 17 lines

Let test-release.sh checkout subprojects directly into the target tree,
instead of using symlinks

In the past I have run into several problems with the way
`test-release.sh` creates all the subproject directories as siblings,
and then uses symlinks to stitch them all together.  In some scenarios
this leads to clang not being able to find header files, etc.

This patch changes the script so it directly exports into the correct
target locations for each subproject.

Reviewers: hans

Subscribers: emaste, llvm-commits

Differential Revision: http://reviews.llvm.org/D16420

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

7 years agoMerging r258729:
Hans Wennborg [Tue, 26 Jan 2016 19:31:16 +0000 (19:31 +0000)]
Merging r258729:
r258729 | matze | 2016-01-25 14:08:25 -0800 (Mon, 25 Jan 2016) | 13 lines

X86ISelLowering: Fix cmov(cmov) special lowering bug

There's a special case in EmitLoweredSelect() that produces an improved
lowering for cmov(cmov) patterns. However this special lowering is
currently broken if the inner cmov has multiple users so this patch
stops using it in this case.

If you wonder why this wasn't fixed by continuing to use the special
lowering and inserting a 2nd PHI for the inner cmov: I believe this
would incur additional copies/register pressure so the special lowering
does not improve upon the normal one anymore in this case.

This fixes http://llvm.org/PR26256 (= rdar://24329747)

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

7 years agoMerging r258690:
James Molloy [Tue, 26 Jan 2016 13:30:49 +0000 (13:30 +0000)]
Merging r258690:
r258690 | jamesm | 2016-01-25 14:49:36 +0000 (Mon, 25 Jan 2016) | 7 lines

[DemandedBits] Fix computation of demanded bits for ICmps

The computation of ICmp demanded bits is independent of the individual operand being evaluated. We simply return a mask consisting of the minimum leading zeroes of both operands.

We were incorrectly passing "I" to ComputeKnownBits - this should be "UserI->getOperand(0)". In cases where we were evaluating the 1th operand, we were taking the minimum leading zeroes of it and itself.

This should fix PR26266.

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

7 years agoMerging r258406:
Hans Wennborg [Mon, 25 Jan 2016 22:24:50 +0000 (22:24 +0000)]
Merging r258406:
r258406 | vedantk | 2016-01-21 09:04:42 -0800 (Thu, 21 Jan 2016) | 16 lines

[GCOV] Avoid emitting profile arcs for module and skeleton CUs

Do not emit profile arc files and note files for module and skeleton

Our users report seeing unexpected *.gcda and *.gcno files in their
projects when using gcov-style profiling with modules or frameworks.
The unwanted files come from these modules. This is not very helpful
for end-users. Further, we've seen reports of instrumented programs
crashing while writing these files out (due to I/O failures).


Reviewed-by: aprantl
Differential Revision: http://reviews.llvm.org/D15997

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

7 years agoMerging r258416 and r258428:
Hans Wennborg [Fri, 22 Jan 2016 18:37:31 +0000 (18:37 +0000)]
Merging r258416 and r258428:

r258416 | spatel | 2016-01-21 10:01:57 -0800 (Thu, 21 Jan 2016) | 2 lines

make helper functions static; NFCI

r258428 | spatel | 2016-01-21 12:19:54 -0800 (Thu, 21 Jan 2016) | 15 lines

[LibCallSimplifier] don't get fooled by a fake fmin()

This is similar to the bug/fix:

The fmin() test case reveals another bug caused by sloppy
code duplication. It will crash without this patch because
fp128 is a valid floating-point type, but we would think
that we had matched a function that used doubles.

The new helper function can be used to replace similar
checks that are used in several other places in this file.

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

7 years agoMerging r257886:
Hans Wennborg [Fri, 22 Jan 2016 18:26:38 +0000 (18:26 +0000)]
Merging r257886:
r257886 | jamesm | 2016-01-15 02:36:01 -0800 (Fri, 15 Jan 2016) | 3 lines

[CodeGenPrepare] Try and appease sanitizers

dupRetToEnableTailCallOpts(BB) can invalidate BB. It must run *after* we iterate across BB!

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

7 years agoMerging r258325:
Hans Wennborg [Wed, 20 Jan 2016 21:49:02 +0000 (21:49 +0000)]
Merging r258325:
r258325 | spatel | 2016-01-20 09:41:14 -0800 (Wed, 20 Jan 2016) | 21 lines

[LibCallSimplifier] don't get fooled by a fake sqrt()

The test case will crash without this patch because the subsequent call to
hasUnsafeAlgebra() assumes that the call instruction is an FPMathOperator
(ie, returns an FP type).

This part of the function signature check was omitted for the sqrt() case,
but seems to be in place for all other transforms.

...we would have needlessly continued execution in optimizeSqrt(), but the
bug was harmless because we'd eventually fail some other check and return
without damage.

This should fix:

Differential Revision: http://reviews.llvm.org/D16198


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

7 years agoMerging r257940:
Hans Wennborg [Wed, 20 Jan 2016 21:30:57 +0000 (21:30 +0000)]
Merging r257940:
r257940 | djg | 2016-01-15 13:56:40 -0800 (Fri, 15 Jan 2016) | 10 lines

[SelectionDAG] CSE nodes with differing SDNodeFlags

In the optimizer (GVN etc.) when eliminating redundant nodes with different
flags, the flags are ignored for the purposes of testing for congruence, and
then intersected for the purposes of producing a result that supports the union
of all the uses. This commit makes SelectionDAG's CSE do the same thing,
allowing it to CSE nodes in more cases. This fixes PR26063.

Differential Revision: http://reviews.llvm.org/D15957

Merging r257942:
r257942 | djg | 2016-01-15 14:07:35 -0800 (Fri, 15 Jan 2016) | 2 lines

Remove a now-empty file left behind by r257940.


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

7 years agoMerging r258273:
Hans Wennborg [Wed, 20 Jan 2016 21:14:05 +0000 (21:14 +0000)]
Merging r258273:
r258273 | josepht | 2016-01-19 18:15:15 -0800 (Tue, 19 Jan 2016) | 37 lines

[Inliner/WinEH] Honor implicit nounwinds

Funclet EH tables require that a given funclet have only one unwind
destination for exceptional exits.  The verifier will therefore reject
e.g. two cleanuprets with different unwind dests for the same cleanup, or
two invokes exiting the same funclet but to different unwind dests.
Because catchswitch has no 'nounwind' variant, and because IR producers
are not *required* to annotate calls which will not unwind as 'nounwind',
it is legal to nest a call or an "unwind to caller" catchswitch within a
funclet pad that has an unwind destination other than caller; it is
undefined behavior for such a call or catchswitch to unwind.

Normally when inlining an invoke, calls in the inlined sequence are
rewritten to invokes that unwind to the callsite invoke's unwind
destination, and "unwind to caller" catchswitches in the inlined sequence
are rewritten to unwind to the callsite invoke's unwind destination.
However, if such a call or "unwind to caller" catchswitch is located in a
callee funclet that has another exceptional exit with an unwind
destination within the callee, applying the normal transformation would
give that callee funclet multiple unwind destinations for its exceptional
exits.  There would be no way for EH table generation to determine which
is the "true" exit, and the verifier would reject the function

Add logic to the inliner to detect these cases and leave such calls and
"unwind to caller" catchswitches as calls and "unwind to caller"
catchswitches in the inlined sequence.

This fixes PR26147.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: alexcrichton, llvm-commits

Differential Revision: http://reviews.llvm.org/D16319

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

7 years agoMerging r258308: [AArch64] Fix two bugs in the .inst directive
Renato Golin [Wed, 20 Jan 2016 18:01:05 +0000 (18:01 +0000)]
Merging r258308: [AArch64] Fix two bugs in the .inst directive

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

7 years agoMerging r258221:
Quentin Colombet [Wed, 20 Jan 2016 01:14:03 +0000 (01:14 +0000)]
Merging r258221:
r258221 | qcolombet | 2016-01-19 15:29:03 -0800 (Tue, 19 Jan 2016) | 8 lines

[X86] Do not run shrink-wrapping on function with split-stack attribute or HiPE
calling convention.
The implementation of the related callbacks in the x86 backend for such
functions are not ready to deal with a prologue block that is not the entry
block of the function.

This fixes PR26107, but the longer term solution would be to fix those callbacks.


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

7 years agoMerging r258207:
Quentin Colombet [Wed, 20 Jan 2016 01:09:12 +0000 (01:09 +0000)]
Merging r258207:
r258207 | qcolombet | 2016-01-19 14:31:12 -0800 (Tue, 19 Jan 2016) | 1 line

[MachineFunction] Constify getter. NFC.

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

7 years agoMerging r257977:
Hans Wennborg [Wed, 20 Jan 2016 00:48:30 +0000 (00:48 +0000)]
Merging r257977:
r257977 | kfischer | 2016-01-15 17:11:33 -0800 (Fri, 15 Jan 2016) | 1 line

[DwarfDebug] Move MergeValues to .cpp, NFC
Merging r257979:
r257979 | kfischer | 2016-01-15 17:15:32 -0800 (Fri, 15 Jan 2016) | 11 lines

[DwarfDebug] Don't merge DebugLocEntries if their pieces overlap

Later in DWARF emission we check that DebugLocEntries have
non-overlapping pieces, so we should create any such entries
by merging here.

Fixes PR26163.

Reviewers: aprantl
Differential Revision: http://reviews.llvm.org/D16249

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

7 years ago[r257857] lli: use llvm::utostr() instead of std::to_string().
NAKAMURA Takumi [Wed, 20 Jan 2016 00:32:09 +0000 (00:32 +0000)]
[r257857] lli: use llvm::utostr() instead of std::to_string().

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

7 years ago[r257732] Mark remote-JIT tests as XFAIL, as well as win32, for targeting mingw32.
NAKAMURA Takumi [Wed, 20 Jan 2016 00:28:22 +0000 (00:28 +0000)]
[r257732] Mark remote-JIT tests as XFAIL, as well as win32, for targeting mingw32.

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

7 years agoMerging r257875:
Hans Wennborg [Tue, 19 Jan 2016 20:49:25 +0000 (20:49 +0000)]
Merging r257875:
r257875 | jamesm | 2016-01-15 01:20:19 -0800 (Fri, 15 Jan 2016) | 11 lines

[InstCombine] Rewrite bswap/bitreverse handling completely.

There are several requirements that ended up with this design;
  1. Matching bitreversals is too heavyweight for InstCombine and doesn't really need to be done so early.
  2. Bitreversals and byteswaps are very related in their matching logic.
  3. We want to implement support for matching more advanced bswap/bitreverse patterns like partial bswaps/bitreverses.
  4. Bswaps are best matched early in InstCombine.

The result of these is that a new utility function is created in Transforms/Utils/Local.h that can be configured to search for bswaps, bitreverses or both. InstCombine uses it to find only bswaps, CGP uses it to find only bitreversals.

We can then extend the matching logic in one place only.

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

7 years agoMerging r258168:
Hans Wennborg [Tue, 19 Jan 2016 19:28:41 +0000 (19:28 +0000)]
Merging r258168:
r258168 | hans | 2016-01-19 11:21:58 -0800 (Tue, 19 Jan 2016) | 3 lines

test-release.sh: Use CMake also for Darwin

This didn't work for 3.7, but hopefully it should work now.

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

7 years agoMerging r257925, r257929, r257930, and r257997:
Hans Wennborg [Tue, 19 Jan 2016 18:53:02 +0000 (18:53 +0000)]
Merging r257925, r257929, r257930, and r257997:
r257925 | mren | 2016-01-15 11:35:42 -0800 (Fri, 15 Jan 2016) | 10 lines

CXX_FAST_TLS calling convention: fix issue on X86-64.

When we have a single basic block, the explicit copy-back instructions should
be inserted right before the terminator. Before this fix, they were wrongly
placed at the beginning of the basic block.

I will commit fixes to other platforms as well.


r257929 | mren | 2016-01-15 12:13:28 -0800 (Fri, 15 Jan 2016) | 10 lines

CXX_FAST_TLS calling convention: fix issue on AArch64.

When we have a single basic block, the explicit copy-back instructions should
be inserted right before the terminator. Before this fix, they were wrongly
placed at the beginning of the basic block.

I will commit fixes to other platforms as well.


r257930 | mren | 2016-01-15 12:24:11 -0800 (Fri, 15 Jan 2016) | 8 lines

CXX_FAST_TLS calling convention: fix issue on ARM.

When we have a single basic block, the explicit copy-back instructions should
be inserted right before the terminator. Before this fix, they were wrongly
placed at the beginning of the basic block.


r257997 | mren | 2016-01-16 08:39:46 -0800 (Sat, 16 Jan 2016) | 12 lines

CXX_FAST_TLS calling convention: fix issue on x86-64.

%RBP can't be handled explicitly. We generate the following code:
    pushq %rbp
    movq  %rsp, %rbp
    movq  %rbx, (%rbp)  ## 8-byte Spill
where %rbp will be overwritten by the spilled value.

The fix is to let PEI handle %RBP.

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

7 years agoMerging r257902 (and r257775)
Hans Wennborg [Tue, 19 Jan 2016 18:26:37 +0000 (18:26 +0000)]
Merging r257902 (and r257775)

r257775 | jyknight | 2016-01-14 08:33:21 -0800 (Thu, 14 Jan 2016) | 3 lines

Revert "Stop increasing alignment of externally-visible globals on ELF platforms."

This reverts commit r257719, due to PR26144.

r257902 | jyknight | 2016-01-15 08:33:06 -0800 (Fri, 15 Jan 2016) | 17 lines

Stop increasing alignment of externally-visible globals on ELF

With ELF, the alignment of a global variable in a shared library will
get copied into an executables linked against it, if the executable even
accesss the variable. So, it's not possible to implicitly increase
alignment based on access patterns, or you'll break existing binaries.

This happened to affect libc++'s std::cout symbol, for example. See
thread: http://thread.gmane.org/gmane.comp.compilers.clang.devel/45311

(This is a re-commit of r257719, without the bug reported in
PR26144. I've tweaked the code to not assert-fail in
enforceKnownAlignment when computeKnownBits doesn't recurse far enough
to find the underlying Alloca/GlobalObject value.)

Differential Revision: http://reviews.llvm.org/D16145

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

7 years agoMerging r257905:
Hans Wennborg [Tue, 19 Jan 2016 17:28:24 +0000 (17:28 +0000)]
Merging r257905:
r257905 | hans | 2016-01-15 09:04:45 -0800 (Fri, 15 Jan 2016) | 3 lines

test-release.sh: Fix clang-tools-extra symlink for CMake build

The CMake and Autoconf builds want the symlink set up differently.

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

7 years agoMerging r257791:
Hans Wennborg [Thu, 14 Jan 2016 23:24:17 +0000 (23:24 +0000)]
Merging r257791:
r257791 | hans | 2016-01-14 11:21:14 -0800 (Thu, 14 Jan 2016) | 4 lines

Exclude test-suite from CMake builds in test-release.sh

It's broken. In 3.7 there wasn't a CMake build for test-suite at all,
so we're not losing something we had before.

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

7 years agoMerging r257730:
Hans Wennborg [Thu, 14 Jan 2016 17:52:28 +0000 (17:52 +0000)]
Merging r257730:
r257730 | majnemer | 2016-01-13 17:20:03 -0800 (Wed, 13 Jan 2016) | 11 lines

[X86] Don't alter HasOpaqueSPAdjustment after we've relied on it

We rely on HasOpaqueSPAdjustment not changing after we've calculated
things based on it.  Things like whether or not we can use 'rep;movs' to
copy bytes around, that sort of thing.  If it changes, invariants in the
backend will quietly break.  This situation arose when we had a call to
memcpy *and* a COPY of the FLAGS register where we would attempt to
reference local variables using %esi, a register that was clobbered by
the 'rep;movs'.

This fixes PR26124.

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

7 years agoReleaseNotes.rst: a few entries from Rafael
Hans Wennborg [Thu, 14 Jan 2016 00:23:32 +0000 (00:23 +0000)]
ReleaseNotes.rst: a few entries from Rafael

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

7 years agoMerging r257648:
Hans Wennborg [Wed, 13 Jan 2016 21:18:59 +0000 (21:18 +0000)]
Merging r257648:
r257648 | hans | 2016-01-13 10:59:45 -0800 (Wed, 13 Jan 2016) | 1 line

Fix struct/class mismatch for MachineSchedContext

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

7 years agoMerging r257645:
Dimitry Andric [Wed, 13 Jan 2016 19:37:51 +0000 (19:37 +0000)]
Merging r257645:
r257645 | dim | 2016-01-13 19:29:46 +0100 (Wed, 13 Jan 2016) | 22 lines

Avoid undefined behavior in LinkAllPasses.h

The LinkAllPasses.h file is included in several main programs, to force
a large number of passes to be linked in.  However, the ForcePassLinking
constructor uses undefined behavior, since it calls member functions on
`nullptr`, e.g.:

      llvm::RGPassManager RGM;
      ((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);

When the optimization level is -O2 or higher, the code below the first
nullptr dereference is optimized away, and replaced by `ud2` (on x86).

Therefore, the calls after that first dereference are never emitted.  In
my case, I noticed there was no call to `llvm::sys::RunningOnValgrind()`!

Replace instances of dereferencing `nullptr` with either objects on the
stack, or regular function calls.

Differential Revision: http://reviews.llvm.org/D15996


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

7 years agoDrop 'svn' suffix from version.
Hans Wennborg [Wed, 13 Jan 2016 19:03:44 +0000 (19:03 +0000)]
Drop 'svn' suffix from version.

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

7 years agoCreating release_38 branch off revision 257626
Hans Wennborg [Wed, 13 Jan 2016 17:34:56 +0000 (17:34 +0000)]
Creating release_38 branch off revision 257626

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

7 years agofix typo
Sanjay Patel [Wed, 13 Jan 2016 17:23:52 +0000 (17:23 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257626 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Fix a GPU hang with POS_W_FLOAT enabled
Marek Olsak [Wed, 13 Jan 2016 17:23:20 +0000 (17:23 +0000)]
AMDGPU/SI: Fix a GPU hang with POS_W_FLOAT enabled

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16037

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257625 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Add tests for non-void functions and InitialPSInputAddr
Marek Olsak [Wed, 13 Jan 2016 17:23:15 +0000 (17:23 +0000)]
AMDGPU/SI: Add tests for non-void functions and InitialPSInputAddr

Reviewers: tstellarAMD, arsenm

Differential Revision: http://reviews.llvm.org/D16036

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257624 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Remove ending s_endpgm from non-void functions
Marek Olsak [Wed, 13 Jan 2016 17:23:12 +0000 (17:23 +0000)]
AMDGPU/SI: Remove ending s_endpgm from non-void functions

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16035

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257623 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Add s_waitcnt at the end of non-void functions
Marek Olsak [Wed, 13 Jan 2016 17:23:09 +0000 (17:23 +0000)]
AMDGPU/SI: Add s_waitcnt at the end of non-void functions

v2: Make ReturnsVoid private, so that I can another 8 lines of code and
    look more productive.

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16034

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257622 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Add support for non-void functions
Marek Olsak [Wed, 13 Jan 2016 17:23:04 +0000 (17:23 +0000)]
AMDGPU/SI: Add support for non-void functions

Return values can be stored in SGPRs (i32) and VGPRs (f32).

This will be used by functions which expect some bytecode or other binary to
be appended at the end. It allows defining in which registers the return
values will be stored.

v2: don't do this for compute shaders

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257621 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssemly] Invalidate liveness in CFG stackifier
Derek Schuff [Wed, 13 Jan 2016 17:10:28 +0000 (17:10 +0000)]
[WebAssemly] Invalidate liveness in CFG stackifier

WebAssemblyCFGStackify does not track liveness for EXPR_STACK, causing
verifier failure if liveness has not already been invalidated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257620 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix typo
Sanjay Patel [Wed, 13 Jan 2016 16:46:41 +0000 (16:46 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257617 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lit] Fix handling of per test timeout when the installed psutil version
Dan Liew [Wed, 13 Jan 2016 16:43:49 +0000 (16:43 +0000)]
[lit] Fix handling of per test timeout when the installed psutil version
is < ``2.0``.

Older versions of psutil (e.g. ``1.2.1`` which is the version shipped with
Ubuntu 14.04) use a different API for retrieving the child processes.
To handle this try the new API first and if that fails try the old API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257616 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix typo
Sanjay Patel [Wed, 13 Jan 2016 16:34:10 +0000 (16:34 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257613 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix typo
Sanjay Patel [Wed, 13 Jan 2016 16:30:44 +0000 (16:30 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257611 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Add SI Machine Scheduler
Nicolai Haehnle [Wed, 13 Jan 2016 16:10:10 +0000 (16:10 +0000)]
AMDGPU/SI: Add SI Machine Scheduler

It is off by default, but can be used
with --misched=si

Patch by: Axel Davy

Reviewers: arsenm, tstellarAMD, nhaehnle

Subscribers: nhaehnle, solenskiner, arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D11885

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257609 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixing warning by adding the X86ISD::VROTRI case.
Michael Zuckerman [Wed, 13 Jan 2016 15:48:42 +0000 (15:48 +0000)]
Fixing warning by adding the X86ISD::VROTRI case.

Differential Revision: http://reviews.llvm.org/D16052

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Do not insert non-phis before phis in bit simplification
Krzysztof Parzyszek [Wed, 13 Jan 2016 15:48:18 +0000 (15:48 +0000)]
[Hexagon] Do not insert non-phis before phis in bit simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257606 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX512] Adding PMOVSXBD/W/Q , PMOVZSDQ and PMOVZSWD/Q Intrinsics .
Michael Zuckerman [Wed, 13 Jan 2016 14:59:19 +0000 (14:59 +0000)]
[AVX512] Adding PMOVSXBD/W/Q , PMOVZSDQ and PMOVZSWD/Q Intrinsics .

Differential Revision: http://reviews.llvm.org/D16111

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257604 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX512] Adding PMOVZXBD/W/Q , PMOVZXDQ and PMOVZXWD/Q Intrinsics
Michael Zuckerman [Wed, 13 Jan 2016 14:25:21 +0000 (14:25 +0000)]
[AVX512] Adding PMOVZXBD/W/Q , PMOVZXDQ and PMOVZXWD/Q Intrinsics

Differential Revision:http://reviews.llvm.org/D16071

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257601 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PowerPC] Fix large code model with the ELFv2 ABI
Ulrich Weigand [Wed, 13 Jan 2016 13:12:23 +0000 (13:12 +0000)]
[PowerPC] Fix large code model with the ELFv2 ABI

The global entry point prologue currently assumes that the TOC
associated with a function is less than 2GB away from the function
entry point.  This is always true when using the medium or small
code model, but may not be the case when using the large code model.

This patch adds a new variant of the ELFv2 global entry point prologue
that lifts the 2GB restriction when building with -mcmodel=large.
This works by emitting a quadword containing the distance from the
function entry point to its associated TOC immediately before the
entry point, and then using a prologue like:

ld r2,-8(r12)
add r2,r2,r12

Since creation of the entry point prologue is now split across two
separate routines (PPCLinuxAsmPrinter::EmitFunctionEntryLabel emits
the data word, PPCLinuxAsmPrinter::EmitFunctionBodyStart the prolog
code), I've switched to using named labels instead of just temporaries
to indicate the locations of the global and local entry points and the
new TOC offset data word.

These names are provided by new routines in PPCFunctionInfo modeled
after the existing PPCFunctionInfo::getPICOffsetSymbol.

Note that a corresponding change was committed to GCC here:

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D15500

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257597 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX512] adding PRORQ , PRORD , PRORLVQ and PRORLVD Intrinsics
Michael Zuckerman [Wed, 13 Jan 2016 12:39:33 +0000 (12:39 +0000)]
[AVX512] adding PRORQ , PRORD , PRORLVQ and PRORLVD Intrinsics

Differential Revision: http://reviews.llvm.org/D16052

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257594 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Allow more shader inputs
Marek Olsak [Wed, 13 Jan 2016 11:46:48 +0000 (11:46 +0000)]
AMDGPU/SI: Allow more shader inputs

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16032

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257593 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Allow any number of PS inputs
Marek Olsak [Wed, 13 Jan 2016 11:46:10 +0000 (11:46 +0000)]
AMDGPU/SI: Allow any number of PS inputs

With the ability to concatenate shader binaries, the limit of 15 no longer

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16031

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257592 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Add new target attribute InitialPSInputAddr
Marek Olsak [Wed, 13 Jan 2016 11:45:36 +0000 (11:45 +0000)]
AMDGPU/SI: Add new target attribute InitialPSInputAddr

This allows Mesa to pass initial SPI_PS_INPUT_ADDR to LLVM.
The register assigns VGPR locations to PS inputs, while the ENA register
determines whether or not they are loaded.

Mesa needs to set some inputs as not-movable, so that a pixel shader prolog
binary appended at the beginning can assume where some inputs are.

v2: Make PSInputAddr private, because there is never enough silly getters
    and setters for people to read.

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16030

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257591 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Fix a bug in SIFoldOperands
Marek Olsak [Wed, 13 Jan 2016 11:44:29 +0000 (11:44 +0000)]
AMDGPU/SI: Fix a bug in SIFoldOperands

Summary: ret.ll will contain a test for this

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16029

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257590 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLEA code size optimization pass (Part 2): Remove redundant LEA instructions.
Andrey Turetskiy [Wed, 13 Jan 2016 11:30:44 +0000 (11:30 +0000)]
LEA code size optimization pass (Part 2): Remove redundant LEA instructions.

Make x86 OptimizeLEAs pass remove LEA instruction if there is another LEA
(in the same basic block) which calculates address differing only be a
displacement. Works only for -Oz.

Differential Revision: http://reviews.llvm.org/D13295

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257589 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd test cases that will show the bug that was fixed in r256725.
Craig Topper [Wed, 13 Jan 2016 07:53:11 +0000 (07:53 +0000)]
Add test cases that will show the bug that was fixed in r256725.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257584 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Cleanup output formatting and add llvm_unreachables to the output the...
Craig Topper [Wed, 13 Jan 2016 07:20:13 +0000 (07:20 +0000)]
[TableGen] Cleanup output formatting and add llvm_unreachables to the output the AsmMatcher uses when it overflows the 64-bit tables. No in tree targets use this code, but I tested it with an temporarily reduced table width.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257583 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Replace some hardcoded assumptions that the OpcodeInfo table is 64-bits...
Craig Topper [Wed, 13 Jan 2016 07:20:12 +0000 (07:20 +0000)]
[TableGen] Replace some hardcoded assumptions that the OpcodeInfo table is 64-bits for cleanliness. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257582 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Use std::remove_if instead of an n^2 loop. NFC
Craig Topper [Wed, 13 Jan 2016 07:20:10 +0000 (07:20 +0000)]
[TableGen] Use std::remove_if instead of an n^2 loop. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257581 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Fix up some stale comments in the AsmMatcher. NFC
Craig Topper [Wed, 13 Jan 2016 07:20:07 +0000 (07:20 +0000)]
[TableGen] Fix up some stale comments in the AsmMatcher. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257580 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Move calls to getValueAsInt out of a loop since they aren't simple functio...
Craig Topper [Wed, 13 Jan 2016 07:20:05 +0000 (07:20 +0000)]
[TableGen] Move calls to getValueAsInt out of a loop since they aren't simple functions. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257579 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove extra whitespace. NFC.
Junmo Park [Wed, 13 Jan 2016 07:03:42 +0000 (07:03 +0000)]
Remove extra whitespace. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257578 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ORC] Add extra debugging output to OrcRemoteTargetServer.
Lang Hames [Wed, 13 Jan 2016 06:34:57 +0000 (06:34 +0000)]
[ORC] Add extra debugging output to OrcRemoteTargetServer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257577 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ORC] Fix typo in debugging output.
Lang Hames [Wed, 13 Jan 2016 06:08:07 +0000 (06:08 +0000)]
[ORC] Fix typo in debugging output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257576 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Inliner] Merge the attributes of the caller and callee functions
Akira Hatanaka [Wed, 13 Jan 2016 06:02:45 +0000 (06:02 +0000)]
[Inliner] Merge the attributes of the caller and callee functions

This patch turns off the fast-math optimization attribute on the caller
if the callee's fast-math attribute is not turned on.

For example,

- before inlining
 caller: "less-precise-fpmad"="true"
 callee: "less-precise-fpmad"="false"

- after inlining
 caller: "less-precise-fpmad"="false"

Alternatively, it's possible to block inlining if the caller's and
callee's attributes don't match. If this approach is preferable to the
one in this patch, we can discuss post-commit.


Differential Revision: http://reviews.llvm.org/D7802

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257575 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix PointerIntPair so that it can use an enum class as its integer template argument.
Michael Gottesman [Wed, 13 Jan 2016 05:59:13 +0000 (05:59 +0000)]
Fix PointerIntPair so that it can use an enum class as its integer template argument.

The problem here is that an enum class can not be implicitly converted to an
integer. That assumption snuck back into PointerIntPair. This commit fixes the
issue and more importantly adds some unittests to make sure that we do not break
this again.


Reviewers: gribozavr

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16131

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257574 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDoc fix: code-quote load / store doc the same way
JF Bastien [Wed, 13 Jan 2016 04:52:26 +0000 (04:52 +0000)]
Doc fix: code-quote load / store doc the same way

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257573 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SPARC] Revamp AnalyzeBranch and add ReverseBranchCondition.
James Y Knight [Wed, 13 Jan 2016 04:44:14 +0000 (04:44 +0000)]
[SPARC] Revamp AnalyzeBranch and add ReverseBranchCondition.

AnalyzeBranch on X86 (and, previously, SPARC, which implementation was
copied from X86) tries to modify the branches based on block
layout (e.g. checking isLayoutSuccessor), when AllowModify is true.

The rest of the architectures leave that up to the caller, which can
call InsertBranch, RemoveBranch, and ReverseBranchCondition as
appropriate. That appears to be the preferred way to do it nowadays.

This commit makes SPARC like the rest: replaces AnalyzeBranch with an
implementation cribbed from AArch64, and adds a ReverseBranchCondition

Additionally, a test-case has been added (also cribbed from AArch64)
demonstrating that redundant branch sequences no longer get emitted.

E.g., it used to emit code like this:
         bne .LBB1_2
         ba .LBB1_1

And now emits:
        cmp %i0, 42
        be .LBB1_1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257572 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Coverage] Refactor coverage mapping reader code
Xinliang David Li [Wed, 13 Jan 2016 04:36:15 +0000 (04:36 +0000)]
[Coverage] Refactor coverage mapping reader code

(Resubmit after fixing a typo that breaks test on big endian

In this refactoring, member functions are introduced to access
CovMap header/func record members and hide layout details. This
will enable further code restructuring to support reading multiple
versions of coverage mapping data with shared/templatized code.
(When coveremap format version changes, backward compatibtility
should be preserved).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257571 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-readobj] Remove dead code. Add an assertion instead.
Davide Italiano [Wed, 13 Jan 2016 04:11:36 +0000 (04:11 +0000)]
[llvm-readobj] Remove dead code. Add an assertion instead.

When we arrive at the end of the function, the validation of
the object has been done already. In theory, so, we should never
arrive here with something broken as the object isn't mutated.
Practice sometimes proves theory to be wrong, so leave an assertion
instead, as suggested by David Blaikie, to catch bugs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257570 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRollback r257551 -- unexpected test failures TBI
Xinliang David Li [Wed, 13 Jan 2016 02:46:40 +0000 (02:46 +0000)]
Rollback r257551 -- unexpected test failures TBI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257564 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-Revert r257105 (Verifier debug info changes)
Keno Fischer [Wed, 13 Jan 2016 02:31:14 +0000 (02:31 +0000)]
Re-Revert r257105 (Verifier debug info changes)

While I investigate some new buildbot failures. This was originally reapplied
as r257550 and r257558.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257563 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-objdump] Use report_error() and improve error coverage.
Davide Italiano [Wed, 13 Jan 2016 02:03:31 +0000 (02:03 +0000)]
[llvm-objdump] Use report_error() and improve error coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257561 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] make sure to update CurrentUnit when drilling
Kostya Serebryany [Wed, 13 Jan 2016 01:58:27 +0000 (01:58 +0000)]
[libFuzzer] make sure to update CurrentUnit when drilling

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257560 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse utostr rather than std::to_string
Keno Fischer [Wed, 13 Jan 2016 01:26:57 +0000 (01:26 +0000)]
Use utostr rather than std::to_string

Looks like std::to_string is not available for Android. Hopefully
this fixes the bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257558 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAsmPrinter: Fix wrong OS X versions being emitted for darwin triples
Matthias Braun [Wed, 13 Jan 2016 01:18:13 +0000 (01:18 +0000)]
AsmPrinter: Fix wrong OS X versions being emitted for darwin triples

The version numbers of the darwin kernel are different from the version
numbers of OS X, so we need adjustments if we had "*-*-darwin" triples.
Use the existing utility functions in TargetTriple for this.

Fixes rdar://22056966

Differential Revision: http://reviews.llvm.org/D14601

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257555 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeView] Mark our lines as statements, not expressions
David Majnemer [Wed, 13 Jan 2016 01:05:23 +0000 (01:05 +0000)]
[CodeView] Mark our lines as statements, not expressions

The line tables for CodeView make a distinction between expressions and
statements.  As it turns out, MSVC always emits them as statements and
we always emit them as expressions.  Let's switch to statements to match
the CodeView that they emit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257553 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeView] Improve the line table dumper
David Majnemer [Wed, 13 Jan 2016 01:05:16 +0000 (01:05 +0000)]
[CodeView] Improve the line table dumper

This change has us print out fields we didn't previously understand.  To
improve readability, we now group column information with it's
respective line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257552 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Coverage] Refactor coverage mapping reader code /NFC
Xinliang David Li [Wed, 13 Jan 2016 00:53:46 +0000 (00:53 +0000)]
[Coverage] Refactor coverage mapping reader code /NFC

(Resubmit after fixing build bot failures)

In this refactoring, member functions are introduced to access
CovMap header/func record members and hide layout details. This
will enable further code restructuring to support reading multiple
versions of coverage mapping data with shared/templatized code.
(When coveremap format version changes, backward compatibtility
should be preserved).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257551 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapply r257105 "[Verifier] Check that debug values have proper size"
Keno Fischer [Wed, 13 Jan 2016 00:31:44 +0000 (00:31 +0000)]
Reapply r257105 "[Verifier] Check that debug values have proper size"

The follow extra changes were made to test cases:

Manually making the variable be the actual type instead of a pointer
to avoid pointer-size differences in generic code:

    LLVM :: DebugInfo/Generic/2010-03-24-MemberFn.ll
    LLVM :: DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
    LLVM :: DebugInfo/Generic/2010-05-03-DisableFramePtr.ll
    LLVM :: DebugInfo/Generic/varargs.ll

Delete sizing information from debug info for the same reason
(but the presence of the pointer was important to the test case):

    LLVM :: DebugInfo/Generic/restrict.ll
    LLVM :: DebugInfo/Generic/tu-composite.ll
    LLVM :: Linker/type-unique-type-array-a.ll
    LLVM :: Linker/type-unique-simple2.ll

Fixing an incorrect DW_OP_deref

    LLVM :: DebugInfo/Generic/2010-05-03-OriginDIE.ll

Fixing a missing DW_OP_deref

    LLVM :: DebugInfo/Generic/incorrect-variable-debugloc.ll

Additionally, clang should no longer complain during bootstrap should no
longer happen after r257534.

The original commit message was:
Teach the Verifier to make sure that the storage size given to llvm.dbg.declare
or the value size given to llvm.dbg.value agree with what is declared in
DebugInfo. This is implicitly assumed in a number of passes (e.g. in SROA).
Additionally this catches a number of common mistakes, such as passing a
pointer when a value was intended or vice versa.

One complication comes from stack coloring which modifies the original IR when
it merges allocas in order to make sure that if AA falls back to the IR it gets
the correct result. However, given this new invariant, indiscriminately
replacing one alloca by a different (differently sized one) is no longer valid.
Fix this by just undefing out any use of the alloca in a dbg.declare in this

Additionally, I had to fix a number of test cases. Of particular note:
- I regenerated dbg-changes-codegen-branch-folding.ll from the given source as
  it was affected by the bug fixed in r256077
- two-cus-from-same-file.ll was changed to avoid having a variable-typed debug
  variable as that would depend on the target, even though this test is
  supposed to be generic
- I had to manually declared size/align for reference type. See also the
  discussion for D14275/r253186.
- fpstack-debuginstr-kill.ll required changing `double` to `long double`
- most others were just a question of adding OP_deref

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257550 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRollback r257547 -- buildbot failure TBI
Xinliang David Li [Wed, 13 Jan 2016 00:27:24 +0000 (00:27 +0000)]
Rollback r257547 -- buildbot failure TBI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257549 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFor llvm-objdump, add the option -private-header (without the trailing ’s’)
Kevin Enderby [Wed, 13 Jan 2016 00:25:36 +0000 (00:25 +0000)]
For llvm-objdump, add the option -private-header (without the trailing ’s’)
to only print the first private header.

Which for Mach-O files only prints the Mach header and not the subsequent load
commands.  Which is used by scripts to match what the darwin otool(1) with the
-h flag does without the -l flag.

For non-Mach-O files it has the same functionality as -private-headers (with
the trailing ’s’).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257548 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Coverage] Refactor coverage mapping reader code /NFC
Xinliang David Li [Wed, 13 Jan 2016 00:16:43 +0000 (00:16 +0000)]
[Coverage] Refactor coverage mapping reader code /NFC

In this refactoring, member functions are introduced to access
CovMap header/func record members and hide layout details. This
will enable further code restructuring to support reading multiple
versions of coverage mapping data with shared/templatized code.
(When coveremap format version changes, backward compatibtility
should be preserved).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257547 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGuard fabs to bfc convert with V6T2 flag
Ana Pazos [Wed, 13 Jan 2016 00:03:35 +0000 (00:03 +0000)]
Guard fabs to bfc convert with V6T2 flag

BFC instructions are available in ARMv6T2 and above.

Reviewers: t.p.northover

Subscribers: aemerson

Differential Revision: http://reviews.llvm.org/D16076

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257546 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Mark VMOV with immediate: isAsCheapAsMove.
Quentin Colombet [Wed, 13 Jan 2016 00:02:40 +0000 (00:02 +0000)]
[ARM] Mark VMOV with immediate: isAsCheapAsMove.
VMOVs are not strictly speaking cheap, but they are as expensive as a vector
copy (VORR), so we should prefer rematerialization over splitting when it


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257545 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCannotBeOrderedLessThanZero: add some missing cases
Fiona Glaser [Tue, 12 Jan 2016 23:37:30 +0000 (23:37 +0000)]
CannotBeOrderedLessThanZero: add some missing cases

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257542 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCOFF: Teach llvm-objdump how to dump DLL forwarder symbols.
Rui Ueyama [Tue, 12 Jan 2016 23:28:42 +0000 (23:28 +0000)]
COFF: Teach llvm-objdump how to dump DLL forwarder symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257539 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Fix disassembler shared-libs build
Derek Schuff [Tue, 12 Jan 2016 23:03:40 +0000 (23:03 +0000)]
[WebAssembly] Fix disassembler shared-libs build

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257536 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRegisterPressure: Expose RegisterOperands API
Matthias Braun [Tue, 12 Jan 2016 22:57:35 +0000 (22:57 +0000)]
RegisterPressure: Expose RegisterOperands API

Previously the RegisterOperands have only been used internally in
RegisterPressure.cpp. However this datastructure can be useful for other
tasks as well and allows refactoring of PDiff initialisation out of

This patch:
- Exposes RegisterOperands as public API
- Splits RPTracker::recede() into a part that skips DebugValues and
  maintains the region borders, and the core that changes register
  pressure when given a set of RegisterOperands.
- This allows to move the PDiff initialisation out recede() into a
  method of the PressureDiffs class.
- The upcoming subregister scheduling code will also use
  RegisterOperands to avoid pushing more unrelated functionality into

Differential Revision: http://reviews.llvm.org/D15473

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257535 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Utils] Insert DW_OP_bit_piece when only describing part of the variable
Keno Fischer [Tue, 12 Jan 2016 22:46:09 +0000 (22:46 +0000)]
[Utils] Insert DW_OP_bit_piece when only describing part of the variable

Summary: The dbg.declare -> dbg.value conversion looks through any zext/sext
to find a value to describe the variable (in the expectation that those
zext/sext instruction will go away later). However, those values do not
cover the entire variable and thus need a DW_OP_bit_piece.

Reviewers: aprantl
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D16061

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257534 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support] Add saturating multiply-add support function
Nathan Slingerland [Tue, 12 Jan 2016 22:34:00 +0000 (22:34 +0000)]
[Support] Add saturating multiply-add support function

Summary: Add SaturatingMultiplyAdd convenience function template since A + (X * Y) comes up frequently when doing weighted arithmetic.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15385

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257532 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeView] Initialize column-end to zero
David Majnemer [Tue, 12 Jan 2016 21:58:20 +0000 (21:58 +0000)]
[CodeView] Initialize column-end to zero

CodeView, unlike DWARF, can associate code with a range of columns.
However, LLVM can only represent a single column position internally.

We used to claim that the end column and start column were the same
which yielded less than satisfactory results: we would stop printing at
the _beginning_ of the source expression!  Instead, mark the column-end
as 'zero' to indicate that we don't have one (as per the documentation
for IDiaLineNumber::get_lineNumberEnd).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257528 91177308-0d34-0410-b5e6-96231b3b80d8