Commit Graph

142615 Commits

Author SHA1 Message Date
Chandler Carruth
ffd2617d2d [ADT] Add a generic concatenating iterator and range.
This allows both defining convenience iterator/range accessors on types
which walk across N different independent ranges within the object, and
more direct and simple usages with range based for loops such as shown
in the unittest. The same facilities are used for both. They end up
quite small and simple as it happens.

I've also switched an iterator on `Module` to use this. I would like to
add another convenience iterator that includes even more sequences as
part of it and seeing this one already present motivated me to actually
abstract it away and introduce a general utility.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290512 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-25 08:22:50 +00:00
Mehdi Amini
3116661386 MetadataLoader: replace the tracking of ForwardReferences and UnresolvedNodes with a set-based solution (NFC)
This makes it explicit what is the exact list to handle, and it
looks much more easy to manipulate and understand that the
previous custom tracking of min/max to express the range where
to look for.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-25 04:22:54 +00:00
Mehdi Amini
172025bbab MetadataLoader: add an extra assertion in Placeholders flush (NFC)
We don't expect any forward reference at this point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-25 03:55:53 +00:00
Daniel Berlin
f8f8d10eb0 Add range iterator for blocks in MemoryPhi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290504 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 21:52:10 +00:00
Simon Pilgrim
8ebe3e8df4 [InstCombine][X86] Add tests showing missed opportunities to simplify PMULUDQ/PMULDQ inputs.
PMULUDQ/PMULDQ - only the even elements (0, 2, 4, 6) of the vXi32 inputs are required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 17:30:19 +00:00
Bryant Wong
8830eb8360 Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 17:26:38 +00:00
Davide Italiano
b9072a62d0 [NewGVN] Prefer auto to explicit type when the latter is obvious.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 17:17:21 +00:00
Davide Italiano
65b85989f6 [NewGVN] Simplify several equals() member functions. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290498 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 17:14:19 +00:00
Davide Italiano
2e0351ada9 [PM] Remove vestiges of NoAA. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 16:14:05 +00:00
Ed Maste
82c36cf6c5 llvm-objdump: sort phdr type strings in advance of adding new ones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290494 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 14:53:45 +00:00
Simon Pilgrim
a3ff10f4aa [SelectionDAG] Early out from computeKnownBits when we know we will have no common bits.
Avoid extra (recursive) calls to computeKnownBits if we already know that there are no common known bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290490 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 12:59:35 +00:00
Chandler Carruth
356e45bf08 [PM] Try to improve the comments here to make what's going on more
clear.

Based on post-commit review suggestion from Sean. (Thanks!)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 05:11:17 +00:00
Daniel Berlin
d49f798558 Mark isOnlyReachableViaThisEdge as const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290468 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 00:04:07 +00:00
Mehdi Amini
65dbfb31c8 Add an assertion for cl::opt names: they can't start with '-'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:55:26 +00:00
Mehdi Amini
8e3d0e728e llvm-size: remove leading dash in '-radix' option
cl::opt does not accept such option

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:55:08 +00:00
Mehdi Amini
5142beb6ca llvm-readobj: remove leading dash in '-a' option (ARMAttributesShort)
cl::opt does not accept such option

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290465 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:54:52 +00:00
Mehdi Amini
ec1ef03d3b llvm-lto2: remove leading '-' for cl::opt declaration
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:54:34 +00:00
Mehdi Amini
de4b9a37d4 llvm-lto2: Print diagnostics before exiting (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:54:17 +00:00
Mehdi Amini
cda4dc6c3d llvm-lto: pass errs() to the module verifier (NFC)
It is more friendly to have the actual diagnostic when the
verifier fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:53:57 +00:00
Chandler Carruth
fcb4147da2 [PM] Remove a bunch of junk that snuck in when I failed at manipulating
my editor to close and commit the patch. Sorry for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:39:31 +00:00
Chandler Carruth
9c2d7d1a26 [PM] Teach the always inlining test case to be much more strict about
whether functions are removed, and fix the new PM's always inliner to
actually pass this test.

Without this, the new PM's always inliner leaves all the functions
kicking around which won't work out very well given the semantics of
always inline.

Doing this really highlights how frustrating the current alwaysinline
semantic contract is though -- why can we put it on *external*
functions, etc?

Also I've added a number of tricky and interesting test cases for
removing functions with the always inliner. There is one remaining case
not handled -- fully removing comdats -- and I've left a FIXME about
this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:33:35 +00:00
Chandler Carruth
79b16276cb [PM] Clean up test case and comments a bit. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290456 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:33:32 +00:00
Chandler Carruth
759dd39154 [PM] Add support for building a default AA pipeline to the PassBuilder.
Pretty boring and lame as-is but necessary. This is definitely a place
we'll end up with extension hooks longer term. =]

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 20:38:19 +00:00
Mehdi Amini
096850a402 Function-import: Disable IRVerifier on lazy-loaded modules: the ODR TypeUniquing generates invalid debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 19:19:44 +00:00
Mehdi Amini
4b0e4b5398 Fix build after r290437 (missing include)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 18:04:51 +00:00
Mehdi Amini
f10311e872 FunctionImport: fix typo '#ifndef NDEBUG' instead of '#ifndef DEBUG'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 17:59:24 +00:00
Jan Vesely
0547dafe38 AMDGPU: split ret/noret patterns for global atomics
Differential Revision: https://reviews.llvm.org/D27989

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 15:34:51 +00:00
Davide Italiano
bb52a7179e [LICM] Plug a leak freeing the ASTs before clearing the map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 15:02:35 +00:00
Piotr Padlewski
9c8f573921 [MemDep] NFC changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 13:13:32 +00:00
Davide Italiano
7f2dba153c [LICM] Work around LICM needs to maintain state across loops.
The pass creates some state which expects to be cleaned up by
a later instance of the same pass. opt-bisect happens to expose
this not ideal design because calling skipLoop() will result in
this state not being cleaned up at times and an assertion firing
in `doFinalization()`. Chandler tells me the new pass manager will
give us options to avoid these design traps, but until it's not ready,
we need a workaround for the current pass infrastructure. Fix provided
by Andy Kaylor, see the review for a complete discussion.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 13:12:50 +00:00
Renato Golin
acb4edfa66 [AArch64] Cortex-A57 FDIV/FSQRT scheduling fix (W-unit)
According to the Cortex-A57 doc, FDIV/FSQRT instructions should use F0 unit
(W-unit in AArch64SchedA57.td, the same as cryptography instructions),
not F1 unit (X-unit in td, like ASIMD absolute diff accum SABA/UABA).

This patch changes FDIV/FSQRT scheduling declarations to use A57UnitW
instead of A57UnitX. Also, latencies for those instructions are
corrected.

Patch by Andrew Zhogin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 12:51:41 +00:00
Florian Hahn
6c22759cf8 Revert r290423 because it broke the sanitizer-x86_64-linux-autoconf buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 12:26:11 +00:00
Florian Hahn
da92dac728 [framelowering] Skip dbg values when getting next/previous instruction.
Summary:
In mergeSPUpdates, debug values need to be ignored when getting the
previous element, otherwise debug data could have an impact on codegen.

In eliminateCallFramePseudoInstr, debug values after the erased element
could have an impact on codegen and should be skipped.

Closes PR31319 (https://llvm.org/bugs/show_bug.cgi?id=31319)

Reviewers: mkuper, MatzeB, aprantl

Subscribers: gbedwell, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 11:35:00 +00:00
Davide Italiano
fa641c2b8d [NewGVN] Remove (for now) unused code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 10:28:30 +00:00
Mehdi Amini
90dfd72f29 [ThinLTO] Verify lazy-loaded source module for function importing when assertions are enabled (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 05:16:19 +00:00
Mehdi Amini
339c153eef MetadataLoader: split the creation of a single metadata out of a Record into its own function (NFC)
This is pure code motion, will just make it more reusable when I'll
attempt to lazy-load Metadats on-demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 03:59:18 +00:00
Dan Gohman
66b35bd23b [WebAssembly] Annotate call and load/store immediates.
These will be used to guide the binary encoding of these immediates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 03:23:52 +00:00
Zijiao Ma
e365f8338a Make the canonicalisation on shifts benifit to more case.
1.Fix pessimized case in FIXME.
2.Add tests for it.
3.The canonicalisation on shifts results in different sequence for
  tests of machine-licm.Correct some check lines.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 02:56:07 +00:00
Mehdi Amini
5e43d26bad MetadataLoader: Reinitialize MinFwdRef/MaxFwdRef after resolving cycles (NFC)
This put the Loader back in a consistent state.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 02:20:12 +00:00
Mehdi Amini
b1c75432e5 MetadataLoader: Add an assertion for the implicit invariant of PlaceHolder while loading Metadata (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 02:20:09 +00:00
Mehdi Amini
4408314ccf MetadataLoader: Make sure every member of MetadataLoader are initialized (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 02:20:07 +00:00
Mehdi Amini
49d3ce6568 MetadataLoader: Refactor "IsImporting" into the Pimpl for the MetadataLoader (NFC)
Keeping all the state together will make it easier to handle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 02:20:02 +00:00
Chandler Carruth
124a0916a2 Fix some DOS-style line endings that I suspect snuck in from one of the
frustrating Subversion clients that fails to do line ending translation
of text files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290404 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 02:02:26 +00:00
NAKAMURA Takumi
c9cceceaf3 KillTheDoctor.cpp: Appease cases on case-senstitive host, like mingw on linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 01:39:26 +00:00
NAKAMURA Takumi
0b79f4e661 KillTheDoctor: Add a required system lib, psapi. KillTheDoctor itself uses Win32 API directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 01:39:20 +00:00
Chandler Carruth
3abadf484b Enable '-Wstring-conversion' and fix some bad asserts that it helped
find.

Notable is the assert in NewGVN which had no effect because of the bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290400 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 01:38:06 +00:00
George Burgess IV
d4a4c08350 Don't consider allocsize functions to be allocation functions.
This patch fixes some ASAN unittest failures on FreeBSD. See the
cfe-commits email thread for r290169 for more on those.

According to the LangRef, the allocsize attribute only tells us about
the number of bytes that exist at the memory location pointed to by the
return value of a function. It does not necessarily mean that the
function will only ever allocate. So, we need to be very careful about
treating functions with allocsize as general allocation functions. This
patch makes us fully conservative in this regard, though I suspect that
we have room to be a bit more aggressive if we want.

This has a FIXME that can be fixed by a relatively straightforward
refactor; I just wanted to keep this patch minimal. If this sticks, I'll
come back and fix it in a few days.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 01:18:09 +00:00
Sanjoy Das
adf4cb67d7 NFC code motion in ImplicitNullChecks
Extract out two large lambdas into top level member functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 00:41:24 +00:00
Sanjoy Das
2f275ef1c8 Reimplement depedency tracking in the ImplicitNullChecks pass
Summary:
This change rewrites a core component in the ImplicitNullChecks pass for
greater simplicity since the original design was over-complicated for no
good reason.  Please review this as essentially a new pass.  The change
is almost NFC and I've added a test case for a scenario that this new
code handles that wasn't handled earlier.

The implicit null check pass, at its core, is a code hoisting transform.
It differs from "normal" code transforms in that it speculates
potentially faulting instructions (by design), but a lot of the usual
hazard detection logic (register read-after-write etc.) still applies.
We previously detected hazards by keeping track of registers defined and
used by machine instructions over an instruction range, but that was
unwieldy and did not actually confer any performance benefits.  The
intent was to have linear time complexity over the number of machine
instructions considered, but it ended up being N^2 is practice.

This new version is more obviously O(N^2) (with N capped to 8 by
default) in hazard detection.  It does not attempt to be clever in
tracking register uses or defs (the previous cleverness here was a
source of bugs).

Once this is checked in, I'll extract out the `IsSuitableMemoryOp` and
`CanHoistLoadInst` lambda into member functions (they're too complicated
to be inline lambdas) and do some other related NFC cleanups.

Reviewers: reames, anna, atrick

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 00:41:21 +00:00
Chris Bieneman
2feb23fd5e [ObjectYAML] Fixing a compiler warning
Accidentally re-defined the variable instead of setting it. Oops!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290388 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22 22:58:07 +00:00