George Burgess IV [Wed, 22 Aug 2018 18:02:46 +0000 (18:02 +0000)]
[MemorySSA] Move two simple getters; NFC
We're calling these functions quite a bit from outside of MemorySSA.cpp
now. Given that they're relatively simple one-liners, I think the style
preference is to have them inline.
llvm-svn: 340430
Aditya Nandakumar [Wed, 22 Aug 2018 17:59:18 +0000 (17:59 +0000)]
[GISel]: Add legalization support for widening bit counting operations
https://reviews.llvm.org/D51053
Added legalization for WidenScalar of various bitcounting opcodes.
Reviewed by arsenm.
llvm-svn: 340429
Sam Clegg [Wed, 22 Aug 2018 17:50:51 +0000 (17:50 +0000)]
[WebAssembly] Optimise relocation processing. NFC.
This is a rebased version https://reviews.llvm.org/D42176 which is patch
by Nicolas Wilson.
Addresses issue:
https://github.com/WebAssembly/tool-conventions/issues/32, and
https://bugs.llvm.org/show_bug.cgi?id=38650
Previously, for each function/segment we iterated over every relocation
to find the relevant ones, which is an n^2 operation. Now, we just make
a single pass.
Differential Revision: https://reviews.llvm.org/D51063
llvm-svn: 340428
Reid Kleckner [Wed, 22 Aug 2018 17:47:41 +0000 (17:47 +0000)]
Disable the aligned allocation test on old mac versions instead of XFAILing it
It looks like this test XPASSes when the deployment target is older than
the OS of the system the test is running on. It looks like we run the
tests with -mmacosx-version-min=10.12, and that makes the test expect to
fail, but it passes.
llvm-svn: 340427
Eric Fiselier [Wed, 22 Aug 2018 17:47:13 +0000 (17:47 +0000)]
Add diagnostics for min/max algorithms when a InputIterator is used.
These algorithms require a ForwardIterator or better. Ensure
we diagnose the contract violation at compile time instead of
of silently doing the wrong thing.
Further algorithms will be audited in upcoming patches.
llvm-svn: 340426
Sanjay Patel [Wed, 22 Aug 2018 17:46:28 +0000 (17:46 +0000)]
[x86] add tests for load scalar + insertelement; NFC
llvm-svn: 340425
Pirama Arumuga Nainar [Wed, 22 Aug 2018 17:43:05 +0000 (17:43 +0000)]
[Android] Default to -fno-math-errno
Summary: Android's libm does not set errno.
Reviewers: srhines, enh
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51068
llvm-svn: 340424
Sam Clegg [Wed, 22 Aug 2018 17:27:31 +0000 (17:27 +0000)]
[WebAssembly] Ensure relocation entries are ordered by offset
wasm-lld expects relocation entries to be sorted by offset. In most
cases llvm produces them in order, but the CODE section (which combines
many MCSections) is an exception because we order the functions in
Symbol order, not in section order. What is more, its not clear weather
`recordRelocation` is guaranteed to be called in offset order so this
sort of most likely needed in the general case too.
Differential Revision: https://reviews.llvm.org/D51065
llvm-svn: 340423
Matt Davis [Wed, 22 Aug 2018 17:15:25 +0000 (17:15 +0000)]
[llvm-mca] Remove unused decl. NFC.
llvm-svn: 340422
Chih-Hung Hsieh [Wed, 22 Aug 2018 17:13:40 +0000 (17:13 +0000)]
[Tooling] Allow -flto flags and filter out -Wa, flags
This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332
by allowing driver::Action::BackendJobClass to run with the analyzer.
Otherwise, such jobs will look up the non-existing compilation database
and then run without flags.
Also filter out the -Wa,* flags that could be passed to and ignored
by the clang compiler. Clang-tidy gives warnings about unused -Wa,* flags.
Differential Revision: http://reviews.llvm.org/D51002
llvm-svn: 340421
Nico Weber [Wed, 22 Aug 2018 16:47:16 +0000 (16:47 +0000)]
lld-link: Emit warning if one each of {main,wmain} and {WinMain,wWinMain} exist and no /subsystem: flag is passed.
Similar to link.exe's LNK4031.
https://reviews.llvm.org/D51076
llvm-svn: 340420
Samuel Pitoiset [Wed, 22 Aug 2018 16:08:48 +0000 (16:08 +0000)]
AMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space
32-bit constant address space is declared as 6, so the
maximum number of address spaces is 6, not 5.
Fixes "LLVM ERROR: Pointer address space out of range".
v5: rename MAX_COMMON_ADDRESS to MAX_AMDGPU_ADDRESS
v4: - fix compilation issues
- fix out of bounds access
v3: use static_assert()
v2: add a very simple test for 32-bit addr space
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106630
llvm-svn: 340417
Samuel Pitoiset [Wed, 22 Aug 2018 16:08:43 +0000 (16:08 +0000)]
AMDGPU: fix existing alias rules for constant and global
Constant and global may alias, also one rules table wasn't
ordered correctly.
Pinpointed by Matt.
v2: add a test with swapped parameters
llvm-svn: 340416
Simon Pilgrim [Wed, 22 Aug 2018 15:37:11 +0000 (15:37 +0000)]
[X86][SSE] LowerMULH vXi8 - use SSE shifts directly.
We know these vXi16 extended cases are legal constant splat shifts.
llvm-svn: 340414
Sid Manning [Wed, 22 Aug 2018 15:25:15 +0000 (15:25 +0000)]
[ELF][HEXAGON] Add R_HEX_16_X relocation
This relocation has only 6-bits the remaining are in the extender.
Differential Revision: https://reviews.llvm.org/D50603
llvm-svn: 340413
Haojian Wu [Wed, 22 Aug 2018 14:03:30 +0000 (14:03 +0000)]
[clang-tidy] Add Abseil prefix to documentation
Summary: Adds the Abseil prefix to the list of prefixes in the documentation
Patch by Deanna Garcia!
Reviewers: aaron.ballman, hokein
Reviewed By: hokein
Subscribers: xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D51100
llvm-svn: 340412
Haojian Wu [Wed, 22 Aug 2018 13:58:25 +0000 (13:58 +0000)]
[clang-tidy] Abseil: faster strsplit delimiter check
This check is an abseil specific check that checks for code using single character string literals as delimiters and transforms the code into characters.
The check was developed internally and has been running at google, this is just
a move to open source the check. It was originally written by @sbenza.
Patch by Deanna Garcia!
llvm-svn: 340411
Ilya Biryukov [Wed, 22 Aug 2018 13:51:19 +0000 (13:51 +0000)]
[clangd] Get rid of regexes in CanonicalIncludes
Summary: Replace them with suffix mappings.
Reviewers: ioeric, kbobyrev
Reviewed By: ioeric
Subscribers: MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51088
llvm-svn: 340410
Kirill Bobyrev [Wed, 22 Aug 2018 13:44:15 +0000 (13:44 +0000)]
[clangd] Implement BOOST iterator
This patch introduces BOOST iterator - a substantial block for efficient
and high-quality symbol retrieval. The concept of boosting allows
performing computationally inexpensive scoring on the query side so that
the final (expensive) scoring can only be applied on the items with the
highest preliminary score while eliminating the need to score too many
items.
Reviewed by: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D50970
llvm-svn: 340409
Akira Hatanaka [Wed, 22 Aug 2018 13:41:19 +0000 (13:41 +0000)]
[CodeGen] Look at the type of a block capture field rather than the type
of the captured variable when determining whether the capture needs
special handing when the block is copied or disposed.
This fixes bugs in the handling of variables captured by a block that is
nested inside a lambda that captures the variables by reference.
rdar://problem/
43540889
Differential Revision: https://reviews.llvm.org/D51025
llvm-svn: 340408
Henry Wong [Wed, 22 Aug 2018 13:30:46 +0000 (13:30 +0000)]
[analyzer] Improve `CallDescription` to handle c++ method.
Summary:
`CallDecription` can only handle function for the time being. If we want to match c++ method, we can only use method name to match and can't improve the matching accuracy through the qualifiers.
This patch add the support for `QualifiedName` matching to improve the matching accuracy.
Reviewers: xazax.hun, NoQ, george.karpenkov, rnkovacs
Reviewed By: xazax.hun, NoQ, rnkovacs
Subscribers: Szelethus, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits, MTC
Differential Revision: https://reviews.llvm.org/D48027
llvm-svn: 340407
Eric Fiselier [Wed, 22 Aug 2018 13:29:52 +0000 (13:29 +0000)]
Attempt to unbreak filesystem tests on certain linux distros.
On some platforms clock_gettime is in librt, which we don't
link by default when building the tests. However it is required
by the filesystem tests.
This patch introduces a workaround which links librt whenever
the filesystem tests are enabled. The workaround should later
be replaced with a patch that selectively links both libc++fs
and librt only when building filesystem specific tests. However,
the way the test configuration is set up right now, this is
non-trivial.
llvm-svn: 340406
Sam Parker [Wed, 22 Aug 2018 12:58:36 +0000 (12:58 +0000)]
[ARM] Rotated operand patterns for *xtb16
Add intrinsic isel patterns for sxtb16, sxtab16, uxtb16 and uxtab16
so that they can perform a ror.
Differential Revision: https://reviews.llvm.org/D51034
llvm-svn: 340405
Ilya Biryukov [Wed, 22 Aug 2018 12:43:17 +0000 (12:43 +0000)]
[clangd] Make FileIndex aware of the main file
Summary:
It was previously only indexing the preamble decls. The new
implementation will index both the preamble and the main AST and
report both sets of symbols, preferring the ones from the main AST
whenever the symbol is present in both.
The symbols in the main AST slab always store all information
available in the preamble symbols, possibly adding more,
e.g. definition locations.
Reviewers: hokein, ioeric
Reviewed By: ioeric
Subscribers: kadircet, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50889
llvm-svn: 340404
Haojian Wu [Wed, 22 Aug 2018 12:34:04 +0000 (12:34 +0000)]
[Preamble] Fix an undefined behavior when checking an empty preamble can be reused.
Summary: Passing nullptr to memcmp is UB.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50967
llvm-svn: 340403
Gabor Marton [Wed, 22 Aug 2018 11:52:14 +0000 (11:52 +0000)]
Fix import of class templates partial specialization
Summary:
Currently there are several issues with the import of class template
specializations. (1) Different TUs may have class template specializations
with the same template arguments, but with different set of instantiated
MethodDecls and FieldDecls. In this patch we provide a fix to merge these
methods and fields. (2) Currently, we search the partial template
specializations in the set of simple specializations and we add partial
specializations as simple specializations. This is bad, this patch fixes it.
Reviewers: a_sidorin, xazax.hun, r.stahl
Subscribers: rnkovacs, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D50451
llvm-svn: 340402
Ilya Biryukov [Wed, 22 Aug 2018 11:39:16 +0000 (11:39 +0000)]
[clangd] Add callbacks on parsed AST in addition to parsed preambles
Summary:
Will be used for updating the dynamic index on updates to the open files.
Currently we collect only information coming from the preamble
AST. This has a bunch of limitations:
- Dynamic index misses important information from the body of the
file, e.g. locations of definitions.
- XRefs cannot be collected at all, since we can only obtain full
information for the current file (preamble is parsed with skipped
function bodies, therefore not reliable).
This patch only adds the new callback, actually updates to the index
will be done in a follow-up patch.
Reviewers: hokein
Reviewed By: hokein
Subscribers: kadircet, javed.absar, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50847
llvm-svn: 340401
Martin Storsjo [Wed, 22 Aug 2018 11:35:02 +0000 (11:35 +0000)]
[COFF] Move a comment close to the code it refers to. NFC.
llvm-svn: 340400
Martin Storsjo [Wed, 22 Aug 2018 11:34:58 +0000 (11:34 +0000)]
[COFF] Change fatal() into error() when writing chunks to the output
In most of these cases, it's easy to go on despite the error,
printing as many valuable error messages as possible from one run
as possible.
Differential Revision: https://reviews.llvm.org/D51087
llvm-svn: 340399
David Green [Wed, 22 Aug 2018 11:34:28 +0000 (11:34 +0000)]
[AArch64] Add Tiny Code Model for AArch64
Adds a tiny code model to Clang along side rL340397.
Differential Revision: https://reviews.llvm.org/D49674
llvm-svn: 340398
David Green [Wed, 22 Aug 2018 11:31:39 +0000 (11:31 +0000)]
[AArch64] Add Tiny Code Model for AArch64
This adds the plumbing for the Tiny code model for the AArch64 backend. This,
instead of loading addresses through the normal ADRP;ADD pair used in the Small
model, uses a single ADR. The 21 bit range of an ADR means that the code and
its statically defined symbols need to be within 1MB of each other.
This makes it mostly interesting for embedded applications where we want to fit
as much as we can in as small a space as possible.
Differential Revision: https://reviews.llvm.org/D49673
llvm-svn: 340397
Matt Arsenault [Wed, 22 Aug 2018 11:09:45 +0000 (11:09 +0000)]
AMDGPU: Fix not respecting byval alignment in call frame setup
This was hackily adding in the 4-bytes reserved for the callee's
emergency stack slot. Treat it like a normal stack allocation
so we get the correct alignment padding behavior. This fixes
an inconsistency between the caller and callee.
llvm-svn: 340396
Andrea Di Biagio [Wed, 22 Aug 2018 10:23:28 +0000 (10:23 +0000)]
[llvm-mca] Improved code comments and moved some method definitions from Scheduler.h to Scheduler.cpp. NFC
llvm-svn: 340395
Simon Pilgrim [Wed, 22 Aug 2018 10:08:53 +0000 (10:08 +0000)]
Fix Wdocumentation warnings. NFCI.
llvm-svn: 340394
Simon Pilgrim [Wed, 22 Aug 2018 09:47:12 +0000 (09:47 +0000)]
[X86][SSE] Add sdiv test case from PR38658
llvm-svn: 340393
Stefan Maksimovic [Wed, 22 Aug 2018 09:34:44 +0000 (09:34 +0000)]
[mips] Handle missing CondCodes
Add patterns for unhandled CondCode enumerables:
SETEQ, SETGE, SETGT, SETLE, SETLT, SETNE.
Stated at the ISD::CondCode enum declaration:
`All of these (except for the 'always folded ops')
should be handled for floating point.`
Add patterns which use these nodes, same as corresponding
'ordered' CondCode nodes.
Referring to 'Ordered means that neither operand is a QNAN'
we assume it is safe to match ex. SETLT node to the same
instruction as SETOLT.
Differential Revision: https://reviews.llvm.org/D50757
llvm-svn: 340392
Stefan Maksimovic [Wed, 22 Aug 2018 09:26:25 +0000 (09:26 +0000)]
[clang][mips] Set __mips_fpr correctly for -mfpxx
Set __mips_fpr to 0 if o32 ABI is used with either -mfpxx
or none of -mfp32, -mfpxx, -mfp64 being specified.
Introduce additional checks:
-mfpxx is only to be used in conjunction with the o32 ABI.
report an error when incompatible options are provided.
Formerly no errors were raised when combining n32/n64 ABIs
with -mfp32 and -mfpxx.
There are other cases when __mips_fpr should be set to 0
that are not covered, ex. using o32 on a mips64 cpu
which is valid but not supported in the backend as of yet.
Differential Revision: https://reviews.llvm.org/D50557
llvm-svn: 340391
Simon Tatham [Wed, 22 Aug 2018 09:20:39 +0000 (09:20 +0000)]
[clang-tblgen] Add -print-records and -dump-json modes.
Currently, if clang-tblgen is run without a mode option, it defaults
to the first mode in its 'enum Action', which happens to be
-gen-clang-attr-classes. I think it makes more sense for it to behave
the same way as llvm-tblgen, i.e. print a diagnostic dump if it's not
given any more specific instructions.
I've also added the same -dump-json that llvm-tblgen supports. This
means any tblgen command line (whether llvm- or clang-) can be
mechanically turned into one that processes the same input into JSON.
Reviewers: nhaehnle
Reviewed By: nhaehnle
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50771
llvm-svn: 340390
Dean Michael Berris [Wed, 22 Aug 2018 07:37:55 +0000 (07:37 +0000)]
[XRay] Refactor file header reading (NFC)
Summary:
This patch moves out the definition of the XRay log file header from
binary logs into its own header and implementation file.
This is one part of the refactoring being done in D50441.
Reviewers: eizan
Subscribers: mgorny, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D51086
llvm-svn: 340389
Kirill Bobyrev [Wed, 22 Aug 2018 07:17:59 +0000 (07:17 +0000)]
[clangd] Cleanup after D50897
The wrong diff that was uploaded to Phabricator was building the wrong
index.
llvm-svn: 340388
Rui Ueyama [Wed, 22 Aug 2018 07:02:26 +0000 (07:02 +0000)]
Change how we handle -wrap.
We have an issue with -wrap that the option doesn't work well when
renamed symbols get PLT entries. I'll explain what is the issue and
how this patch solves it.
For one -wrap option, we have three symbols: foo, wrap_foo and real_foo.
Currently, we use memcpy to overwrite wrapped symbols so that they get
the same contents. This works in most cases but doesn't when the relocation
processor sets some flags in the symbol. memcpy'ed symbols are just
aliases, so they always have to have the same contents, but the
relocation processor breaks that assumption.
r336609 is an attempt to fix the issue by memcpy'ing again after
processing relocations, so that symbols that are out of sync get the
same contents again. That works in most cases as well, but it breaks
ASan build in a mysterious way.
We could probably fix the issue by choosing symbol attributes that need
to be copied after they are updated. But it feels too complicated to me.
So, in this patch, I fixed it once and for all. With this patch, we no
longer memcpy symbols. All references to renamed symbols point to new
symbols after wrapSymbols() is done.
Differential Revision: https://reviews.llvm.org/D50569
llvm-svn: 340387
Hiroshi Inoue [Wed, 22 Aug 2018 05:43:27 +0000 (05:43 +0000)]
[AST] correct the behavior of -fvisibility-inlines-hidden option (don't make static local variables hidden)
The command line option -fvisibility-inlines-hidden makes inlined method hidden, but it is expected not to affect the visibility of static local variables in the function.
However, Clang makes the static local variables in the function also hidden as reported in PR37595. This problem causes LLVM bootstarp failure on Fedora 28 if configured with -DBUILD_SHARED_LIBS=ON.
This patch makes the behavior of -fvisibility-inlines-hidden option to be consistent with that of gcc; the option does not change the visibility of the static local variables if the containing function does not associated with explicit visibility attribute and becomes hidden due to this option.
Differential Revision: https://reviews.llvm.org/D50968
llvm-svn: 340386
Marshall Clow [Wed, 22 Aug 2018 04:28:43 +0000 (04:28 +0000)]
Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept tests for all the containers that have clear().
llvm-svn: 340385
Philip Reames [Wed, 22 Aug 2018 03:36:42 +0000 (03:36 +0000)]
[AST] Fix a whitespace typo [NFC]
llvm-svn: 340384
Philip Reames [Wed, 22 Aug 2018 03:33:55 +0000 (03:33 +0000)]
[AST] Reorder code to reduce a future patch diff [NFC]
llvm-svn: 340383
Philip Reames [Wed, 22 Aug 2018 03:32:52 +0000 (03:32 +0000)]
[AST] Move a function definition into the cpp [NFC]
llvm-svn: 340382
Max Kazantsev [Wed, 22 Aug 2018 02:40:49 +0000 (02:40 +0000)]
[GuardWidening] Ignore guards with trivial conditions
Guard widening should not spend efforts on dealing with guards with trivial true/false conditions.
Such guards can easily be eliminated by any further cleanup pass like instcombine. However we
should not unconditionally delete them because it may be profitable to widen other conditions
into such guards.
Differential Revision: https://reviews.llvm.org/D50247
Reviewed By: fedor.sergeev
llvm-svn: 340381
Fangrui Song [Wed, 22 Aug 2018 02:11:36 +0000 (02:11 +0000)]
[gold] -thinlto-object-suffix-replace: don't append new suffix if path does not end with old suffix
Summary: This is to be consistent with lld behavior since rLLD340364.
Reviewers: tejohnson
Reviewed By: tejohnson
Subscribers: steven_wu, eraman, mehdi_amini, inglorion, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51060
llvm-svn: 340380
Vedant Kumar [Wed, 22 Aug 2018 01:23:31 +0000 (01:23 +0000)]
[CodeGenPrepare] Set debug loc when widening a switch condition
Set a debug location on the cast instruction used to widen a switch
condition.
llvm-svn: 340379
George Karpenkov [Wed, 22 Aug 2018 01:17:09 +0000 (01:17 +0000)]
[analyzer] [NFC] Fix minor formatting issues in RetainCountChecker
Differential Revision: https://reviews.llvm.org/D51072
llvm-svn: 340378
George Karpenkov [Wed, 22 Aug 2018 01:16:49 +0000 (01:16 +0000)]
[analyzer] [NFC] Extract a method for creating RefVal from RetEffect in RetainCountChecker
Differential Revision: https://reviews.llvm.org/D51071
llvm-svn: 340377
Stephen Kelly [Wed, 22 Aug 2018 01:11:18 +0000 (01:11 +0000)]
Update the docs for using LLVM toolset in Visual Studio
Reviewers: hans
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51079
llvm-svn: 340376
Bob Haarman [Wed, 22 Aug 2018 00:52:16 +0000 (00:52 +0000)]
[Support][CachePruning] prune least recently accessed files first
Summary:
Before this change, pruning order was based on size. This changes it
to be based on time of last use instead, preferring to keep recently
used files and prune older ones.
Reviewers: pcc, rnk, espindola
Reviewed By: rnk
Subscribers: emaste, arichardson, hiraditya, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51062
llvm-svn: 340374
Heejin Ahn [Wed, 22 Aug 2018 00:33:34 +0000 (00:33 +0000)]
[WebAssembly] Fix typos in mem.grow/memory.grow opcodes
This should be not 0x3f but 0x40.
llvm-svn: 340373
Heejin Ahn [Wed, 22 Aug 2018 00:20:02 +0000 (00:20 +0000)]
[WebAssembly] Change comments on SP writing back (NFC)
Summary: We now write back not to memory but to __stack_pointer global.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51074
llvm-svn: 340372
Vedant Kumar [Wed, 22 Aug 2018 00:10:37 +0000 (00:10 +0000)]
[CodeGenPrepare] Set debug locations when splitting selects
When splitting a select into a diamond, set debug locations on
newly-created branch instructions and phi nodes.
llvm-svn: 340371
Vedant Kumar [Tue, 21 Aug 2018 23:43:08 +0000 (23:43 +0000)]
[CodeGenPrepare] Clean up dbg.value use-before-def as late as possible
CodeGenPrepare has a strategy for moving dbg.values so that a value's
definition always dominates its debug users. This cleanup was happening
too early (before certain CGP transforms were run), resulting in some
dbg.value use-before-def errors.
Perform this cleanup as late as possible to avoid use-before-def.
llvm-svn: 340370
Vedant Kumar [Tue, 21 Aug 2018 23:42:53 +0000 (23:42 +0000)]
[CodeGenPrepare] Pre-commit debug info test for optimizeSelectInst
This test shows that optimizeSelectInst splits a select and sinks a
`fdiv` operation to one side of the diamond. However, the dbg.value for
the operation isn't moved.
llvm-svn: 340369
Vedant Kumar [Tue, 21 Aug 2018 23:42:38 +0000 (23:42 +0000)]
[CodeGenPrepare] Scan past debug intrinsics to find select candidates (NFC)
In optimizeSelectInst, when scanning for candidate selects to rewrite
into branches, scan past debug intrinsics. This makes the debug-enabled
and non-debug paths through optimizeSelectInst more congruent.
NFC because every select is eventually visited either way.
llvm-svn: 340368
Vedant Kumar [Tue, 21 Aug 2018 23:42:23 +0000 (23:42 +0000)]
[CodeGenPrepare] Exit earlier when optimizing selects (NFC)
When optimizing for size, this allows optimizeSelectInst to skip a
linear scan and exit early.
llvm-svn: 340367
Vedant Kumar [Tue, 21 Aug 2018 23:42:08 +0000 (23:42 +0000)]
Avoid dbg.value use-before-def in a few tests (NFC)
This is preparation for landing a use-before-def verifier for debug
intrinsics (D46100).
As a drive-by, remove `tail` from debug intrinsic calls because it
doesn't mean anything in that context.
llvm-svn: 340366
Alina Sbirlea [Tue, 21 Aug 2018 23:32:03 +0000 (23:32 +0000)]
Update MemorySSA in BasicBlockUtils.
Summary:
Extend BasicBlocksUtils to update MemorySSA.
Subscribers: sanjoy, arsenm, nhaehnle, jlebar, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D45300
llvm-svn: 340365
Fangrui Song [Tue, 21 Aug 2018 23:28:12 +0000 (23:28 +0000)]
[ELF] -thinlto-object-suffix-replace=: don't error if the path does not end with old suffix
Summary:
For -thinlto-object-suffix-replace=old\;new, in
tools/gold/gold-plugin.cpp, the thinlto object filename is Path minus
optional old suffix.
static std::string getThinLTOObjectFileName(StringRef Path, StringRef OldSuffix,
StringRef NewSuffix) {
if (OldSuffix.empty() && NewSuffix.empty())
return Path;
StringRef NewPath = Path;
NewPath.consume_back(OldSuffix);
std::string NewNewPath = NewPath;
NewNewPath += NewSuffix;
return NewNewPath;
}
Currently lld will error that the path does not end with old suffix.
This patch makes lld accept such paths but only add new suffix if Path
ends with old suffix. This fixes a link error where bitcode members in
an archive are regular LTO objects without old suffix.
Acording to tejohnson, this will "enable supporting mix and match of
minimized ThinLTO bitcode files with normal ThinLTO bitcode files in a
single link (where we want to apply the suffix replacement to the
minimized files, and just ignore it for the normal ThinLTO files)."
Reviewers: ruiu, pcc, tejohnson, espindola
Reviewed By: tejohnson
Subscribers: emaste, inglorion, arichardson, eraman, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51055
llvm-svn: 340364
Alina Sbirlea [Tue, 21 Aug 2018 23:13:02 +0000 (23:13 +0000)]
[MemorySSA] Update comment for move APIs to clarify behavior (NFC).
llvm-svn: 340362
Richard Trieu [Tue, 21 Aug 2018 22:55:26 +0000 (22:55 +0000)]
Add space to TemplateArgument dump
Add a missing space when dumping a template argument which is a template
expansion. Found during debugging so no test.
llvm-svn: 340357
Zachary Turner [Tue, 21 Aug 2018 22:52:52 +0000 (22:52 +0000)]
[MS Demangler] Print template constructor args.
Previously if you had something like this:
template<typename T>
struct Foo {
template<typename U>
Foo(U);
};
Foo F(3.7);
this would mangle as ??$?0N@?$Foo@H@@QEAA@N@Z
and this would be demangled as:
undname: __cdecl Foo<int>::Foo<int><double>(double)
llvm-undname: __cdecl Foo<int>::Foo<int>(double)
Note the lack of the constructor template parameter in our
demangling.
This patch makes it so we print the constructor argument list.
llvm-svn: 340356
Kuba Mracek [Tue, 21 Aug 2018 22:35:52 +0000 (22:35 +0000)]
[tsan] Adjust setjmp/longjmp handling on Darwin for macOS Mojave
On macOS Mojave, the OS started using the XOR-by-a-secret-key scheme (same as glibc is alread doing) for storing the SP value in setjmp environment. We need to adjust for that to keep supporting setjmp/longjmp on latest Darwin. The patch is basically doing the same what we're already doing for glibc.
rdar://problem/
43542596
Differential Revision: https://reviews.llvm.org/D51064
llvm-svn: 340350
Nico Weber [Tue, 21 Aug 2018 22:19:55 +0000 (22:19 +0000)]
Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().
EmitX86BuiltinExpr() emits all args into Ops at the beginning, so don't do that
work again.
This changes behavior: If e.g. ++a was passed as an arg, we incremented a twice
previously. This change fixes that bug.
https://reviews.llvm.org/D50979
llvm-svn: 340348
Kuba Mracek [Tue, 21 Aug 2018 22:03:28 +0000 (22:03 +0000)]
Fixup for r340342: Avoid Block_release'ing the block since we're no longer making a copy.
rdar://problem/
42242579
llvm-svn: 340347
Tom Stellard [Tue, 21 Aug 2018 21:48:43 +0000 (21:48 +0000)]
MachineScheduler: Refactor setPolicy() to limit computing remaining latency
Summary:
Computing the remaining latency can be very expensive especially
on graphs of N nodes where the number of edges approaches N^2.
This reduces the compile time of a pathological case with the
AMDGPU backend from ~7.5 seconds to ~3 seconds. This test case has
a basic block with 2655 stores, each with somewhere between 500
and 1500 successors and predecessors.
Reviewers: atrick, MatzeB, airlied, mareko
Reviewed By: mareko
Subscribers: tpr, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D50486
llvm-svn: 340346
Philip Reames [Tue, 21 Aug 2018 21:27:26 +0000 (21:27 +0000)]
[LICM] Fix a test so it actualy checks what was meant [NFC]
llvm-svn: 340344
Scott Linder [Tue, 21 Aug 2018 21:24:31 +0000 (21:24 +0000)]
[AMDGPU] Consider loads from flat addrspace to be potentially divergent
In general we can't assume flat loads are uniform, and cases where we can prove
they are should be handled through infer-address-spaces.
Differential Revision: https://reviews.llvm.org/D50991
llvm-svn: 340343
Kuba Mracek [Tue, 21 Aug 2018 21:24:22 +0000 (21:24 +0000)]
[tsan] Avoid calling Block_copy in the "sync" GCD interceptors
The synchronous dispatch functions in GCD (dispatch_sync, dispatch_barrier_sync), don't make a copy of the passed block. To maintain binary compatibility, we should avoid doing that as well in TSan, as there's no reason to do that. The synchronous dispatch functions will not return before the block is actually executed.
rdar://problem/
42242579
Differential Revision: https://reviews.llvm.org/D50920
llvm-svn: 340342
Zachary Turner [Tue, 21 Aug 2018 21:23:49 +0000 (21:23 +0000)]
[MS Demangler] Fix a few more edge cases.
I found these by running llvm-undname over a couple hundred
megabytes of object files generated as part of building chromium.
The issues fixed in this patch are:
1) decltype-auto return types.
2) Indirect vtables (e.g. const A::`vftable'{for `B'})
3) Pointers, references, and rvalue-references to member pointers.
I have exactly one remaining symbol out of a few hundred MB of object
files that produces a name we can't demangle, and it's related to
back-referencing.
llvm-svn: 340341
Zachary Turner [Tue, 21 Aug 2018 21:23:29 +0000 (21:23 +0000)]
Print "invalid mangled name" when we can't demangle something.
llvm-svn: 340340
Heejin Ahn [Tue, 21 Aug 2018 21:23:07 +0000 (21:23 +0000)]
[WebAssembly] Restore __stack_pointer after catch instructions
Summary:
After the stack is unwound due to a thrown exception, the
`__stack_pointer` global can point to an invalid address. This inserts
instructions that restore `__stack_pointer` global.
Reviewers: jgravelle-google, dschuff
Subscribers: mgorny, sbc100, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D50980
llvm-svn: 340339
Anna Thomas [Tue, 21 Aug 2018 21:12:02 +0000 (21:12 +0000)]
NFC: update the test comments in LV test about early exit loops
llvm-svn: 340337
Thomas Lively [Tue, 21 Aug 2018 21:03:18 +0000 (21:03 +0000)]
[WebAssembly] v128.const
Summary:
This CL implements v128.const for each vector type. New operand types
are added to ensure the vector contents can be serialized without LEB
encoding. Tests are added for instruction selection, encoding,
assembly and disassembly.
Reviewers: aheejin, dschuff, aardappel
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D50873
llvm-svn: 340336
Fangrui Song [Tue, 21 Aug 2018 21:00:54 +0000 (21:00 +0000)]
[docs][gold] Fix a typo
llvm-svn: 340335
Martin Storsjo [Tue, 21 Aug 2018 20:41:17 +0000 (20:41 +0000)]
[CodeGen] Implicitly set stackrealign on the main function, if custom stack alignment is used
If using a custom stack alignment, one is expected to make sure
that all callers provide such alignment, or realign the stack in
all entry points (and callbacks).
Despite this, the compiler can assume that the main function will
need realignment in these cases, since the startup routines calling
the main function most probably won't provide the custom alignment.
This matches what GCC does in similar cases; if compiling with
-mincoming-stack-boundary=X -mpreferred-stack-boundary=X, GCC normally
assumes such alignment on entry to a function, but specifically for
the main function still does realignment.
Differential Revision: https://reviews.llvm.org/D51026
llvm-svn: 340334
Marcello Maggioni [Tue, 21 Aug 2018 20:30:14 +0000 (20:30 +0000)]
[LICM] Refactor some AliasSetTracker code to get rid of new/deletes. NFC
Differential Revision: https://reviews.llvm.org/D51024
llvm-svn: 340333
Florian Hahn [Tue, 21 Aug 2018 20:07:46 +0000 (20:07 +0000)]
[CodeExtractor] Use 'normal destination' BB as insert point to store invoke results.
Currently CodeExtractor tries to use the next node after an invoke to
place the store for the result of the invoke, if it is an out parameter
of the region. This fails, as the invoke terminates the current BB.
In that case, we can place the store in the 'normal destination' BB, as
the result will only be available in that case.
Reviewers: davidxl, davide, efriedma
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D51037
llvm-svn: 340331
Heejin Ahn [Tue, 21 Aug 2018 20:04:42 +0000 (20:04 +0000)]
[WebAssembly] Don't make wasm cleanuppads into funclet entries
Summary:
Catchpads and cleanuppads are not funclet entries; they are only EH
scope entries. We already dont't set `isEHFuncletEntry` for catchpads.
This patch does the same thing for cleanuppads.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D50654
llvm-svn: 340330
Heejin Ahn [Tue, 21 Aug 2018 19:52:19 +0000 (19:52 +0000)]
[WebAssembly] Change writeSPToMemory to writeSPToGlobal (NFC)
Summary: SP is now a __stack_pointer global and not a memory address anymore.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51046
llvm-svn: 340328
Bjorn Pettersson [Tue, 21 Aug 2018 19:47:32 +0000 (19:47 +0000)]
[RegisterCoalescer] Use substPhysReg in reMaterializeTrivialDef
Summary:
When RegisterCoalescer::reMaterializeTrivialDef is substituting
a register use in a DBG_VALUE instruction, and the old register
is a subreg, and the new register is a physical register,
then we need to use substPhysReg in order to extract the correct
subreg.
Reviewers: wmi, aprantl
Reviewed By: wmi
Subscribers: hiraditya, MatzeB, qcolombet, tpr, llvm-commits
Differential Revision: https://reviews.llvm.org/D50844
llvm-svn: 340326
Heejin Ahn [Tue, 21 Aug 2018 19:44:11 +0000 (19:44 +0000)]
[WebAssembly] Add isEHScopeReturn instruction property
Summary:
So far, `isReturn` property is used to mean both a return instruction
from a functon and the end of an EH scope, a scope that starts with a EH
scope entry BB and ends with a catchret or a cleanupret instruction.
Because WinEH uses funclets, all EH-scope-ending instructions are also
real return instruction from a function. But for wasm, they only serve
as the end marker of an EH scope but not a return instruction that
exits a function. This mismatch caused incorrect prolog and epilog
generation in wasm EH scopes. This patch fixes this.
This patch is in the same vein with rL333045, which splits
`MachineBasicBlock::isEHFuncletEntry` into `isEHFuncletEntry` and
`isEHScopeEntry`.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D50653
llvm-svn: 340325
Simon Pilgrim [Tue, 21 Aug 2018 19:29:39 +0000 (19:29 +0000)]
Fix Wdocumentation warning. NFCI.
llvm-svn: 340324
Craig Topper [Tue, 21 Aug 2018 19:17:00 +0000 (19:17 +0000)]
[InstCombine] Pull simple checks above a more complicated one. NFCI
I'm assuming its easier to make sure the RHS of an XOR is all ones than it is to check for the many select patterns we have. So lets check that first. Same with the one use check.
llvm-svn: 340321
Florian Hahn [Tue, 21 Aug 2018 19:11:27 +0000 (19:11 +0000)]
[GVN] Assign new value number to calls reading memory, if there is no MemDep info.
Currently we assign the same value number to two calls reading the same
memory location if we do not have MemoryDependence info. Without MemDep
Info we cannot guarantee that there is no store between the two calls, so we
have to assign a new number to the second call.
It also adds a new option EnableMemDep to enable/disable running
MemoryDependenceAnalysis and also renamed NoLoads to NoMemDepAnalysis to
be more explicit what it does. As it also impacts calls that read memory,
NoLoads is a bit confusing.
Reviewers: efriedma, sebpop, john.brawn, wmi
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D50893
llvm-svn: 340319
Krzysztof Parzyszek [Tue, 21 Aug 2018 19:01:26 +0000 (19:01 +0000)]
[RegisterCoalscer] Manually remove leftover segments when commuting def
In removeCopyByCommutingDef, segments from the source live range are
copied into (and merged with) the segments of the target live range.
This is performed for all subranges of the source interval. It can
happen that there will be subranges of the target interval that had
no corresponding subranges in the source interval, and in such cases
these subrages will not be updated. Since the copy being coalesced
is about to be removed, these ranges need to be updated by removing
the segments that are started by the copy.
llvm-svn: 340318
Benjamin Kramer [Tue, 21 Aug 2018 18:44:25 +0000 (18:44 +0000)]
[NVPTX] Remove ftz variants of cvt with rounding mode
These do not exist in ptxas, it refuses to compile them.
Differential Revision: https://reviews.llvm.org/D51042
llvm-svn: 340317
Matt Davis [Tue, 21 Aug 2018 18:39:20 +0000 (18:39 +0000)]
[llvm-mca] Remove unused decl. NFC.
llvm-svn: 340316
Eric Christopher [Tue, 21 Aug 2018 18:35:08 +0000 (18:35 +0000)]
Temporarily Revert "[PowerPC] Generate Power9 extswsli extend sign and shift immediate instruction" due to it causing a compiler crash on valid.
This reverts commit r340016, testcase forthcoming.
llvm-svn: 340315
Andrea Di Biagio [Tue, 21 Aug 2018 18:20:16 +0000 (18:20 +0000)]
[llvm-mca] Add the ability to customize the instruction selection strategy in the Scheduler.
The constructor of Scheduler now accepts a SchedulerStrategy object, which is
used internally by method Scheduler::select() to drive the instruction selection
process.
The goal of this patch is to enable the definition of custom selection
strategies while reusing the same algorithms implemented by class Scheduler.
The motivation is that, on some targets, the default strategy may not well
approximate the selection logic in the hardware schedulers.
This patch also adds the ability to pass a ResourceManager object to the
constructor of Scheduler. This gives a bit more flexibility to the design, and
potentially it allows to expose processor resources to SchedulerStrategy
objects.
Differential Revision: https://reviews.llvm.org/D51051
llvm-svn: 340314
Simon Pilgrim [Tue, 21 Aug 2018 18:02:28 +0000 (18:02 +0000)]
[X86][SSE] Add non-uniform udiv test that is mostly divide by 1.
The test demonstrates over-complicated codegen for a udiv that only has one divisor that doesn't equal 1. This should have allowed the codegen to be a lot simpler (uniform shifts etc.) but only the SSE2 manages to make use of this......
llvm-svn: 340313
Philip Reames [Tue, 21 Aug 2018 17:59:11 +0000 (17:59 +0000)]
[AST] Remove notion of volatile from alias sets [NFCI]
Volatility is not an aliasing property. We used to model volatile as if it had extremely conservative aliasing implications, but that hasn't been true for several years now. So, it doesn't make sense to be in AliasSet.
It also turns out the code is entirely a noop. Outside of the AST code to update it, there was only one user: load store promotion in LICM. L/S promotion doesn't need the check since it walks all the users of the address anyway. It already checks each load or store via !isUnordered which causes us to bail for volatile accesses. (Look at the lines immediately following the two remove asserts.)
There is the possibility of some small compile time impact here, but the only case which will get noticeably slower is a loop with a large number of loads and stores to the same address where only the last one we inspect is volatile. This is sufficiently rare it's not worth optimizing for..
llvm-svn: 340312
Erik Pilkington [Tue, 21 Aug 2018 17:50:10 +0000 (17:50 +0000)]
Address Aaron Ballman's post-commit review comments from r340306, NFC
llvm-svn: 340311
Yury Delendik [Tue, 21 Aug 2018 17:48:28 +0000 (17:48 +0000)]
Update DBG_VALUE register operand during LiveInterval operations
Summary:
Handling of DBG_VALUE in ConnectedVNInfoEqClasses::Distribute() was fixed in
PR16110. However DBG_VALUE register operands are not getting updated. This
patch properly resolves the value location.
Reviewers: MatzeB, vsk
Reviewed By: MatzeB
Subscribers: kparzysz, thegameg, vsk, MatzeB, dschuff, sbc100, jgravelle-google, aheejin, sunfish, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D48994
llvm-svn: 340310
Aditya Nandakumar [Tue, 21 Aug 2018 17:30:31 +0000 (17:30 +0000)]
Revert "Revert rr340111 "[GISel]: Add Legalization/lowering code for bit counting operations""
This reverts commit
d1341152d91398e9a882ba2ee924147ea2f9b589.
This patch originally made use of Nested MachineIRBuilder buildInstr
calls, and since order of argument processing is not well defined, the
instructions were built slightly in a different order (still correct).
I've removed the nested buildInstr calls to have a defined order now.
Patch was tested by Mikael.
llvm-svn: 340309
Vlad Tsyrklevich [Tue, 21 Aug 2018 17:29:01 +0000 (17:29 +0000)]
SafeStack: Use correct unsafe stack sizes
Summary:
When deallocating thread stacks, we use one thread's unsafe stack size
to deallocate another thread's unsafe stack; however, the two sizes may
differ. Record an unsafe stack's size in the thread stack linked list.
Reviewers: pcc, eugenis
Reviewed By: eugenis
Subscribers: delcypher, llvm-commits, #sanitizers, kcc
Differential Revision: https://reviews.llvm.org/D51016
llvm-svn: 340308