138327 Commits

Author SHA1 Message Date
Nirav Dave
be08d6e6a3 Defer asm errors to post-statement failure
Recommitting after fixing AsmParser Initialization.

Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 13:55:06 +00:00
Chad Rosier
f565d64c70 [LoopInterchange] Minor refactor. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281334 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 13:30:30 +00:00
Andrea Di Biagio
93627d9415 [InstSimplify] Add tests to show missed bitcast folding opportunities.
InstSimplify doesn't always know how to fold a bitcast of a constant vector.
In particular, the logic in InstSimplify doesn't know how to handle the case
where the constant vector in input contains some undef elements, and the
number of elements is smaller than the number of elements of the bitcast
vector type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 13:17:42 +00:00
Chad Rosier
c732159461 Don't use else if after return. Tidy comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281331 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 13:08:53 +00:00
Chad Rosier
78490522e3 Typo. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 13:00:29 +00:00
Chad Rosier
bcfa2b15ee [LoopInterchange] Tidy up and remove unnecessary dyn_casts. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 12:56:04 +00:00
James Molloy
283b1c0454 Revert "[ARM] Promote small global constants to constant pools"
This reverts commit r281314. Speculatively revert as it's possible this caused linker errors: http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/19656

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 12:45:51 +00:00
Sam Parker
d2d2efe826 Remove InstCombine test file
My previous commit should of removed a test file but I missed it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 12:33:06 +00:00
Pablo Barrio
c8b398cd6b [ARM] Add ".code 32" to functions in the ARM instruction set
Before, only Thumb functions were marked as ".code 16". These
".code x" directives are effective until the next directive of its
kind is encountered. Therefore, in code with interleaved ARM and
Thumb functions, it was possible to declare a function as ARM and
end up with a Thumb function after assembly. A test has been added.

An existing test has also been fixed to take this change into
account.

Reviewers: aschwaighofer, t.p.northover, jmolloy, rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281324 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 12:18:15 +00:00
James Molloy
e81b6f3153 [Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more efficient instruction selection if the bitmask is one consecutive sequence of set bits (32 - clz(bm) - ctz(bm) == popcount(bm)).

1) If the bitmask touches the LSB, then we can remove all the upper bits and set the flags by doing one LSLS.
2) If the bitmask touches the MSB, then we can remove all the lower bits and set the flags with one LSRS.
3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit into the sign bit with one LSLS and change the condition query from NE/EQ to MI/PL (we could also implement this by shifting into the carry bit and branching on BCC/BCS).
4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower zero bits of the mask.

1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two 16-bit instructions but can elide the CMP and doesn't require materializing a complex immediate, so is also a win.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 12:12:32 +00:00
Sam Parker
7d764370b0 Enable simplify libcalls for ARM PCS
Teach SimplifyLibcalls that in can treat functions annotated with
apcs, aapcs or aapcs_vfp like normal C functions if they only take
and return integer or pointer values, and the target is not iOS.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 12:10:14 +00:00
Ying Yi
503f4620ba [llvm-cov] - Included footer "Generated by llvm-cov -- llvm version <version number>" in the coverage report.
The llvm-cov version information will be useful to the user when comparing the code coverage across different versions of llvm-cov. This patch provides the llvm-cov version information in the generated coverage report.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 11:28:31 +00:00
Peter Smith
d0c0b622fc [ARM] Support ldr.w in pseudo instruction ldr rd,=immediate
The changes made in r269352, r269353 and r269354 to support the 
transformation of the ldr rd,=immediate to mov introduced a regression
from 3.8 (ldr.w rd, =immediate) not supported.

This change puts support back in for ldr.w by means of a t2InstAlias for
the .w form. The .w is ignored in ARM state and propagated to the ldr in
Thumb2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 11:15:51 +00:00
James Molloy
2e1f8100c5 [ARM] Promote small global constants to constant pools
If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281314 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 10:28:11 +00:00
Eric Liu
ea8e2d383d [WebAssembly] Trying to fix broken tests in CodeGen/WebAssembly caused by r281285.
Reviewers: bkramer, ddcc, dschuff, sunfish

Subscribers: jfb, llvm-commits, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 10:05:44 +00:00
Ayman Musa
7dc5b7e72a Remove MVT:i1 xor instruction before SELECT. (Performance improvement).
Differential Revision: https://reviews.llvm.org/D23764


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 09:12:45 +00:00
Sjoerd Meijer
48f6957bd7 Revert of r281304 as it is causing build bot failures in hexagon
hwloop regression tests. These tests pass locally; will be investigating
where these differences come from.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 08:51:59 +00:00
Sjoerd Meijer
0298251f19 This adds a new field isAdd to MCInstrDesc. The ARM and Hexagon instruction
descriptions now tag add instructions, and the Hexagon backend is using this to
identify loop induction statements.

Patch by Sam Parker and Sjoerd Meijer.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 08:08:06 +00:00
Elena Demikhovsky
9cb541b51a AVX-512: Fix for PR28175 - Scalar code optimization.
Optimized (truncate (assertzext x) to i1) and anyext i1 to i8/16/32.
Optimization of this patterns is a one more step towards i1 optimization on AVX-512.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281302 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 07:57:00 +00:00
Diana Picus
8da7897bb9 [AArch64] Support stackmap/patchpoint in getInstSizeInBytes
We currently return 4 for stackmaps and patchpoints, which is very optimistic
and can in rare cases cause the branch relaxation pass to fail to relax certain
branches.

This patch causes getInstSizeInBytes to return a pessimistic estimate of the
size as the number of bytes requested in the stackmap/patchpoint. In the future,
we could provide a more accurate estimate by sharing some of the logic in
AArch64::LowerSTACKMAP/PATCHPOINT.

Fixes part of https://llvm.org/bugs/show_bug.cgi?id=28750

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281301 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 07:45:17 +00:00
Craig Topper
5db4eb4adf [X86] Remove masked shufpd/shufps intrinsics and autoupgrade to native vector shuffles. They were removed from clang previously but accidentally left in the backend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281300 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 07:40:53 +00:00
Craig Topper
7e9a83f20e [X86] Remove some dead intrinsics. They aren't implemented and clang doesn't reference them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281299 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 07:40:48 +00:00
Davide Italiano
6a92b76991 [Docs] Fix a broken link in the Kaleidoscope tutorial.
Patch by:	Alfred Perlstein <alfred@FreeBSD.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 06:31:37 +00:00
Davide Italiano
9a5abd08fa [LTO] Only expose the dataLayout string instead of the whole module.
Differential Revision:	https://reviews.llvm.org/D24494

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 06:29:17 +00:00
Zachary Turner
95da21422c Revert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"
This reverts r281290, as it breaks unit tests.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/303

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 04:11:57 +00:00
Dean Michael Berris
5021054629 [Support][CommandLine] Add cl::getRegisteredSubcommands()
This should allow users of the library to get a range to iterate through
all the subcommands that are registered to the global parser. This
allows users to define subcommands in libraries that self-register to
have dispatch done at a different stage (like main). It allows for
writing code like the following:

    for (auto *S : cl::getRegisteredSubcommands()) {
      if (*S) {
	// Dispatch on S->getName().
      }
    }

This change also contains tests that show this usage pattern.

Reviewers: zturner, dblaikie, echristo

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 02:35:00 +00:00
Davide Italiano
2cee504d52 [lib/LTO] Expose getModule() in lto::InputFile.
lld will use this to get the datalayout string and emit a
diagnostic if empty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281289 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 02:22:02 +00:00
Peter Collingbourne
5420de3f15 DebugInfo: New metadata representation for global variables.
This patch reverses the edge from DIGlobalVariable to GlobalVariable.
This will allow us to more easily preserve debug info metadata when
manipulating global variables.

Fixes PR30362. A program for upgrading test cases is attached to that
bug.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 01:12:59 +00:00
Michael Kuperstein
8d684cae12 [DAG] Refactor BUILD_VECTOR combine to make it easier to extend. NFCI.
This should make it easier to add cases that we currently don't cover,
like supporting more kinds of type mismatches and more than 2 input vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 00:57:43 +00:00
Hans Wennborg
45564d960b X86: Conditional tail calls should not have isBarrier = 1
That confuses e.g. machine basic block placement, which then doesn't
realize that control can fall through a block that ends with a conditional
tail call. Instead, isBranch=1 should be set.

Also, mark EFLAGS as used by these instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 00:21:32 +00:00
Eric Christopher
f016a03393 Temporarily Revert "[MC] Defer asm errors to post-statement failure" as it's causing errors on the sanitizer bots.
This reverts commit r281249.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281280 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 00:19:29 +00:00
Adam Nemet
29e20b96d3 [OptDiag] Add getHotness accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 23:46:34 +00:00
Philip Reames
3551718895 [LVI] Complete the abstract of the cache layer [NFCI]
Convert the previous introduced is-a relationship between the LVICache and LVIImple clases into a has-a relationship and hide all the implementation details of the cache from the lazy query layer.

The only slightly concerning change here is removing the addition of a queried block into the SeenBlock set in LVIImpl::getBlockValue.  As far as I can tell, this was effectively dead code.  I think it *used* to be the case that getCachedValueInfo wasn't const and might end up inserting elements in the cache during lookup.  That's no longer true and hasn't been for a while.  I did fixup the const usage to make that more obvious.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 22:38:44 +00:00
Sanjay Patel
0df9c0a9b5 add more tests for PR30273
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 22:28:29 +00:00
Lang Hames
d87460fb31 [ORC] Clang-format RPCSerialization.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281269 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 22:05:14 +00:00
Lang Hames
0f4402773f [ORC] Add some more documentation to RPCSerialization.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 22:05:12 +00:00
Philip Reames
ac22fbed43 [LVI] Sink a couple more cache manipulation routines into the cache itself [NFCI]
The only interesting bit here is the refactor of the handle callback and even that's pretty straight-forward.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 22:03:36 +00:00
Philip Reames
8efea574b6 [LVI] Abstract out the actual cache logic [NFCI]
Seperate the caching logic from the implementation of the lazy analysis.  For the moment, the lazy analysis impl has a is-a relationship with the cache; this will change to a has-a relationship shortly.  This was done as two steps merely to keep the changes simple and the diff understandable.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 21:46:58 +00:00
Nico Weber
eebb0bcce0 Revert r281215, it caused PR30358.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281263 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 21:40:50 +00:00
Nico Weber
6e9445ddf8 attempt to unbreak build after r281254
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281262 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 21:15:44 +00:00
Lang Hames
08170c3c1c [ORC] Add missing <thread> header to RPCSerialization.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 20:45:01 +00:00
Lang Hames
b57c915405 [ORC] Replace the serialize/deserialize function pair with a SerializationTraits
class.

SerializationTraits provides serialize and deserialize methods corresponding to
the earlier functions, but also provides a name for the type. In future, this
name will be used to render function signatures as strings, which will in turn
be used to negotiate and verify API support between RPC clients and servers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 20:34:41 +00:00
Dehao Chen
77ad09277a Fix the bug introduced in r281252.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281253 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 20:29:54 +00:00
Dehao Chen
8c8aa02da6 Lower consecutive select instructions correctly.
Summary: If consecutive select instructions are lowered separately in CGP, it will introduce redundant condition check and branches that cannot be removed by later optimization phases. This patch lowers all consecutive select instructions at the same to to avoid inefficent code as demonstrated in https://llvm.org/bugs/show_bug.cgi?id=29095

Reviewers: davidxl

Subscribers: vsk, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 20:23:28 +00:00
Nirav Dave
a50fabab60 [MC] Defer asm errors to post-statement failure
Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 20:03:02 +00:00
Sanjay Patel
06b5f13936 [InstCombine] add test for PR30327
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281248 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 19:50:08 +00:00
Sanjay Patel
6979660cda [InstCombine] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281247 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 19:29:26 +00:00
Elena Demikhovsky
1f6cc3cfe9 AVX-512: Added a test for -O0 mode. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281246 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 19:03:21 +00:00
Elena Demikhovsky
291712591e AVX-512: Simplified masked_gather_scatter test. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 18:50:47 +00:00
Hemant Kulkarni
f4ef2f71ee Fix test failure in r281232
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 17:40:10 +00:00