Johannes Doerfert [Wed, 30 Oct 2019 22:20:20 +0000 (17:20 -0500)]
[Attributor] Pointer privatization attribute (argument promotion)
A pointer is privatizeable if it can be replaced by a new, private one.
Privatizing pointer reduces the use count, interaction between unrelated
code parts. This is a first step towards replacing argument promotion.
While we can already handle recursion (unlike argument promotion!) we
are restricted to stack allocations for now because we do not analyze
the uses in the callee.
Reviewed By: uenoku
Differential Revision: https://reviews.llvm.org/D68852
LLVM GN Syncbot [Thu, 30 Jan 2020 01:35:57 +0000 (01:35 +0000)]
[gn build] Port
f2af0607000
Derek Schuff [Thu, 30 Jan 2020 01:30:57 +0000 (17:30 -0800)]
[llvm-objcopy] Initial support for wasm in llvm-objcopy
Currently only supports simple copying, other operations to follow.
Reviewers: sbc100, alexshap, jhenderson
Differential Revision: https://reviews.llvm.org/D70930
This is a reland of
a928d127a with a one-line fix to ensure that
the wasm version number is written as little-endian (it's the only
field in all of the binary format that's not a single byte or an
LEB, but we may have to watch out more when we start handling the
linking section).
Louis Dionne [Thu, 30 Jan 2020 01:28:34 +0000 (17:28 -0800)]
[libc++] Explicitly specify LIBCXX_ENABLE_SHARED to try and fix CI
Configuring libc++abi with LIBCXX_ENABLE_STATIC=OFF is broken since
https://reviews.llvm.org/D71894, so this patch fixes the issue for
Apple platforms to unblock our CI.
Johannes Doerfert [Thu, 30 Jan 2020 00:02:42 +0000 (18:02 -0600)]
[Attributor] Fix TODO to avoid recomputation of results
The helpers AAReturnedFromReturnedValues and
AACallSiteReturnedFromReturned are useful not only to avoid code
duplication but also to avoid recomputation of results. If we have N
call sites we should not recompute the function return information N
times but once. These are mostly straightforward usages with some minor
improvements on the helpers and addition of a new one
(IRPosition::getAssociatedType) that knows about function return types.
Jonas Devlieghere [Thu, 30 Jan 2020 01:16:31 +0000 (17:16 -0800)]
[lldb/Reproducers] Add unittest for char** (de)serializer
Jonas Devlieghere [Thu, 30 Jan 2020 00:32:41 +0000 (16:32 -0800)]
[lldb/Reproducers] Account for char** being a nullptr
Nico Weber [Thu, 30 Jan 2020 00:12:08 +0000 (19:12 -0500)]
[gn build] add a FIXME about using /Gw on win
Gabor Horvath [Wed, 29 Jan 2020 01:13:12 +0000 (17:13 -0800)]
[LTO] Add optimization remarks for removed functions
This only works with regular LTO for now.
Differential Revision: https://reviews.llvm.org/D73597
Craig Topper [Wed, 29 Jan 2020 23:48:09 +0000 (15:48 -0800)]
[X86] Improve X86 cmpps/cmppd/cmpss/cmpsd intrinsics with strictfp
The constrained fcmp intrinsics don't allow the TRUE/FALSE predicates.
Using them will assert. To workaround this I'm emitting the old X86 specific intrinsics that were never removed from the backend when we switched to using fcmp in IR. We have no way to mark them as being strict, but that's true of all target specific intrinsics so doesn't seem like we need to solve that here.
I've also added support for selecting between signaling and quiet.
Still need to support SAE which will require using a target specific
intrinsic. Also need to fix masking to not use an AND instruction
after the compare.
Differential Revision: https://reviews.llvm.org/D72906
Craig Topper [Wed, 29 Jan 2020 19:40:52 +0000 (11:40 -0800)]
[X86] Fix the cost model for v16i16->v16i32 zero_extend/sign_extend with AVX2
We seem to be inheriting the cost from sse4.1. But if we have 256-bit registers we should be able to do this with just one extract to split the 16i16 and two v8i16->v8i32 operations so our cost should be 3 not 4.
Differential Revision: https://reviews.llvm.org/D73646
aartbik [Wed, 29 Jan 2020 23:21:30 +0000 (15:21 -0800)]
[mlir] [VectorOps] consolidate all vector utilities to one header/cc file
Reviewers: nicolasvasilache, andydavis1, dcaballe
Reviewed By: andydavis1, dcaballe
Subscribers: dcaballe, merge_guards_bot, mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73593
Matt Arsenault [Mon, 27 Jan 2020 20:50:55 +0000 (15:50 -0500)]
GlobalISel: Add observer argument to legalizeIntrinsic
This is passed to legalizeCustom, but not intrinsic. Also remove the
MRI argument, since you can get that from the MachineIRBuilder.
I'm not sure why MachineIRBuilder has a private observer member, and
this is passed separately.
Yuanfang Chen [Wed, 29 Jan 2020 22:59:14 +0000 (14:59 -0800)]
[compiler-rt][profile] fix test/instrprof-set-filename.c on windows
Summary: `.cmd` is interpreted as script in windows console.
Reviewers: davidxl, rnk
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D73327
Matt Arsenault [Thu, 16 Jan 2020 02:23:07 +0000 (21:23 -0500)]
AMDGPU/GlobalISel: Select permlane16/permlanex16
Yuanfang Chen [Mon, 20 Jan 2020 01:52:08 +0000 (17:52 -0800)]
[opt viewer] Python compat - decode/encode string
Summary:
Use io.open instead of codecs.open according to here
https://stackoverflow.com/questions/
10971033/backporting-python-3-openencoding-utf-8-to-python-2
Add `u` prefix to string literal to make them utf-8 in python2.
Reviewers: anemet, serge-sans-paille
Reviewed by: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D73011
Jonas Devlieghere [Wed, 29 Jan 2020 22:06:20 +0000 (14:06 -0800)]
[lldb/Reproducers] Add (de)serialization overload for char**
This patch adds an overload to serialize and deserialize char** types.
This is necessary for things like the SBLaunchInfo ctor. We serialize
the array length followed by each individual item.
Kostya Kortchinsky [Wed, 29 Jan 2020 20:35:44 +0000 (12:35 -0800)]
[scudo][standalone] Revert some perf-degrading changes
Summary:
A couple of seemingly innocuous changes ended up having a large impact
on the 32-bit performance. I still have to make those configurable at
some point, but right now it will have to do.
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D73658
Jonas Devlieghere [Wed, 29 Jan 2020 21:48:39 +0000 (13:48 -0800)]
[SmallString] Remove StringRef indirection for std::string conversion.
There's no need to go through StringRef to convert a SmallString to a
std::string, the conversion operator can create a std::string directly.
Differential revision: https://reviews.llvm.org/D73640
Siva Chandra Reddy [Mon, 27 Jan 2020 05:50:27 +0000 (21:50 -0800)]
[libc] Add a library of standalone C++ utilities.
Some of the existing utils in utils/UnitTest/Test.h have been moved to
this new library.
Reviewers: abrachet, gchatelet
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D73530
Cameron McInally [Wed, 29 Jan 2020 21:22:14 +0000 (15:22 -0600)]
[NFC][AArch64][SVE] Rename Destructive enumerator from DestructiveInstType
Rename Destructive enumerator in preparation for a larger set of patches to
support prefixing destructive oeprations with MOVPRFX.
Differential Revision: https://reviews.llvm.org/D73212
Shoaib Meenai [Wed, 29 Jan 2020 21:40:36 +0000 (13:40 -0800)]
[build] Fix LLVM_ENABLE_RUNTIMES override condition
I forgot to add parentheses in
fa44d72b9e43, though I prefer the
expanded form anyway.
Amara Emerson [Wed, 29 Jan 2020 17:42:26 +0000 (09:42 -0800)]
[GlobalISel] Add new combine to convert scalar G_MUL to G_SHL.
For pow2 constants we should use G_SHL for pattern matching (and perf)
purposes later.
Vector support not yet implemented.
Differential Revision: https://reviews.llvm.org/D73659
Siva Chandra Reddy [Wed, 29 Jan 2020 21:29:52 +0000 (13:29 -0800)]
[libc] Fix build after
777180a32b61070a10dd330b4f038bf24e916af1.
Implicit conversion from llvm::StringRef to std::string was made
explicit in the above commit.
LLVM GN Syncbot [Wed, 29 Jan 2020 21:19:26 +0000 (21:19 +0000)]
[gn build] Port
5ea83eef4d6
Stella Stamenova [Wed, 29 Jan 2020 21:19:04 +0000 (13:19 -0800)]
[lldb] Fix build break in ProcessDebugger due to StringRef usage changes
Derek Schuff [Wed, 29 Jan 2020 21:12:56 +0000 (13:12 -0800)]
Revert "[llvm-objcopy] Initial support for wasm in llvm-objcopy"
This reverts commit
a928d127a52a061733d2e42c4c9159a267f7dbd4.
It seems to cause issues with big-endian architectures.
Jessica Paquette [Wed, 29 Jan 2020 20:50:48 +0000 (12:50 -0800)]
[AArch64][GlobalISel] Fix TBNZ/TBZ opcode selection
When the bit is <= 32, we have to use the W register variant for TB(N)Z.
This is because of the way the instruction is encoded.
Differential Revision: https://reviews.llvm.org/D73660
LLVM GN Syncbot [Wed, 29 Jan 2020 21:06:15 +0000 (21:06 +0000)]
[gn build] Port
24962ced814
Hiroshi Yamauchi [Tue, 10 Dec 2019 22:41:30 +0000 (14:41 -0800)]
[Loads] Handle simple cases with same base pointer with constant offsets in FindAvailableLoadedValue when AA is null.
Summary:
This will help with devirtualization (store forwarding with vtable pointers in
the presence of other stores into members in the constructor.) During inlining,
we don't have AA.
Reviewers: davidxl
Subscribers: mgorny, Prazek, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71307
Cameron McInally [Wed, 29 Jan 2020 20:44:04 +0000 (14:44 -0600)]
[NFCI][AArch64][SVE] Set default DestructiveInstType in AArch64Inst class
Some housekeeping for the DestructiveInstType enum before a larger set of patches to support prefixing destructive oeprations with MOVPRFX.
Differential Revision: https://reviews.llvm.org/D73141
Victor Huang [Wed, 29 Jan 2020 20:32:13 +0000 (14:32 -0600)]
[PowerPC][Future] Add prefixed loads and stores for future CPU
A previous patch should have added pld and pstd and any support code in
the backend that is required for prefixed load and store type operations.
This patch adds a number of additional prefixed load and store type
instructions for the future CPU.
Differential Revision: https://reviews.llvm.org/D72577
Benjamin Kramer [Wed, 29 Jan 2020 20:40:19 +0000 (21:40 +0100)]
Rewrite test not to rely on StrEq with StringRef
StrEq has some magic inside that should do the explicit conversion from
StringRef to std::string, but apparently this doesn't work with GCC 5.
Just use EXPECT_EQ, it does the same thing with less magic.
Sanjay Patel [Wed, 29 Jan 2020 20:00:11 +0000 (15:00 -0500)]
[InstCombine] add splat binop tests; NFC
Martin Storsjö [Mon, 28 Oct 2019 08:39:44 +0000 (10:39 +0200)]
[libcxx] [Windows] Store the lconv struct returned from localeconv in locale_t
This fixes using non-default locales, which currently can crash when
e.g. formatting numbers.
Within the localeconv_l function, the per-thread locale is temporarily
changed with __libcpp_locale_guard, then localeconv() is called,
returning an lconv * struct pointer.
When localeconv_l returns, the __libcpp_locale_guard dtor restores
the per-thread locale back to the original. This invalidates the
contents of the earlier returned lconv struct, and all C strings
that are pointed to within it are also invalidated.
Thus, to have an actually working localeconv_l function, the
function needs to allocate some sort of storage for the returned
contents, that stays valid for as long as the caller needs to use
the returned struct.
Extend the libcxx/win32 specific locale_t class with storage for
a deep copy of a lconv struct, and change localeconv_l to take
a reference to the locale_t, to allow it to store the returned
lconv struct there.
This works fine for libcxx itself, but wouldn't necessarily be right
for a caller that uses libcxx's localeconv_l function.
This fixes around 11 of libcxx's currently failing tests on windows.
Differential Revision: https://reviews.llvm.org/D69505
Matt Arsenault [Wed, 29 Jan 2020 20:26:13 +0000 (12:26 -0800)]
AMDGPU/GlobalISel: Fix tests in release build
Irritatingly the failure output is different in release vs. debug
because of the legality check is removed without asserts, so a register
ends up constrained only in release builds.
Sean Silva [Wed, 29 Jan 2020 00:58:34 +0000 (16:58 -0800)]
Add IntegerAttr::verifyConstructionInvariants.
Summary:
This will help catch improper use of the MLIR API's. In particular, this
catches an error that was manifesting as nondeterministic assertion
failures (the nondeterminism was due to the failure happening only when the
StorageUniquer's DenseMap's probing happened to compare two specific
keys).
No test. The fact that all the existing tests pass with this additional
invariant gives confidence that it is correct/useful.
Differential Revision: https://reviews.llvm.org/D73645
Sterling Augustine [Fri, 24 Jan 2020 01:51:33 +0000 (17:51 -0800)]
Print discriminators when printing .debug_line in GNU style.
Summary:
gnu addr2line prints DWARF line table discriminators like so:
<file>:<line> (discriminator <Number>)
This matches that behavior.
Document how and when --output-style=GNU prints discriminators
Add test for new GNU-style discriminator printing.
Reviewers: rupprecht, labath, jhenderson
Subscribers: aprantl, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73318
Shoaib Meenai [Wed, 29 Jan 2020 20:16:40 +0000 (12:16 -0800)]
[build] Fix runtimes build after
2e745ba6b0ba
I missed the NOT in the condition; this part is actually responsible for
passing LLVM_ENABLE_RUNTIMES to the per-target runtime configures, which
in turn makes them actually build.
I'll put up a more general solution for review, but restore this in the
meantime to fix the runtimes build.
Nikita Popov [Wed, 29 Jan 2020 17:58:48 +0000 (18:58 +0100)]
[InstCombine] Support non-splat vectors in icmp eq + add/sub fold
For the
icmp eq (add X, C1), C2 => icmp eq X, C2-C1
icmp eq (sub C1, X), C2 => icmp eq X, C1-C2
folds, this allows C1 to be non-splat and contain undefs.
C2 is still splat, due to the structure of the code.
This is to address the remaining part of the regression in D73411,
where demanded element analysis replaces some elements with undef.
Differential Revision: https://reviews.llvm.org/D73647
Nikita Popov [Wed, 29 Jan 2020 17:57:56 +0000 (18:57 +0100)]
[InstCombine] Add undef/non-splat tests for add/sub + icmp eq; NFC
Amara Emerson [Wed, 29 Jan 2020 17:34:33 +0000 (09:34 -0800)]
[GlobalISel][IRTranslator] Follow convention and put constant offset of getelementptr arithmetic on RHS.
We were needlessly putting known constant values on the LHS of a G_MUL, which
is suboptimal.
Differential Revision: https://reviews.llvm.org/D73650
Nico Weber [Wed, 29 Jan 2020 19:26:50 +0000 (14:26 -0500)]
attempt to fix symbolize-paths.s everywhere after cd68f4
Nico Weber [Wed, 29 Jan 2020 19:23:00 +0000 (14:23 -0500)]
attempt to fix symbolize-paths.s on windows
Huihui Zhang [Wed, 29 Jan 2020 19:17:19 +0000 (11:17 -0800)]
Revert "[AArch64] Fix data race on RegisterBank initialization."
Buildbot failure, revert first while looking at the issue.
This reverts commit
a5a4a47d691459afffc552bd3be7abfc86a49793.
Huihui Zhang [Wed, 29 Jan 2020 19:16:27 +0000 (11:16 -0800)]
Revert "[AMDGPU] Fix data race on RegisterBank initialization."
There looks to be buildbot failure related.
This reverts commit
8bb6c8a22af845618cfd6c27853dca1b48d30ce0.
Huihui Zhang [Wed, 29 Jan 2020 19:15:07 +0000 (11:15 -0800)]
Revert "[ARM] Fix data race on RegisterBank initialization."
There looks to be buildbot failure related.
This reverts commit
91618d940ea3009d7e1489df4c8ca12017a0f612.
Fangrui Song [Wed, 22 Jan 2020 20:26:04 +0000 (12:26 -0800)]
[AsmPrinter][ELF] Define local aliases (.Lfoo$local) for GlobalObjects
For `MC_GlobalAddress` operands referencing **certain** GlobalObjects,
we can lower them to STB_LOCAL aliases to avoid costs brought by
assembler/linker's conservative decisions about symbol interposition:
* An assembler conservatively assumes a global default visibility symbol interposable (ELF
semantics). So relocations in object files are needed even if the code generator assumed
the definition exact and non-interposable.
* The relocations can cause the creation of PLT entries on some targets for -shared links.
A linker conservatively assumes a global default visibility symbol interposable (if not
otherwise constrained by -Bsymbolic/--dynamic-list/VER_NDX_LOCAL/etc).
"certain" refers to GlobalObjects in the intersection of
`hasExactDefinition() and !isInterposable()`: `external`, `appending`, `internal`, `private`.
Local linkages (`internal` and `private`) cannot be interposed. `appending` is for very
few objects LLVM interpret specially. So the set just includes `external`.
This patch emits STB_LOCAL aliases (.Lfoo$local) for such GlobalObjects, so that targets can lower
MC_GlobalAddress operands to STB_LOCAL aliases if applicable.
We may extend the scope and include GlobalAlias in the future.
LLVM's existing -fno-semantic-interposition behaviors give us license to do such optimizations:
* Various optimizations (ipconstprop, inliner, sccp, sroa, etc) treat normal ExternalLinkage
GlobalObjects as non-interposable.
* Before D72197, MC resolved a PC-relative VK_None fixup to a non-local symbol at assembly time (no
outstanding relocation), if the target is defined in the same section. Put it simply, even if IR
optimizations failed to optimize and allowed interposition for the function call in
`void foo() {} void bar() { foo(); }`, the assembler would disallow it.
This patch sets up AsmPrinter infrastructure to make -fno-semantic-interposition more so.
With and without the patch, the object file output should be identical:
`.Lfoo$local` does not take a symbol table entry.
Reviewed By: sfertile
Differential Revision: https://reviews.llvm.org/D73228
Sterling Augustine [Tue, 28 Jan 2020 22:17:20 +0000 (14:17 -0800)]
Handle non-absolute include dirs properly for both dwarf4 and dwarf5.
Summary:
Add test case for the same. This test case will also serve as a
starting point for later symbolizer tests.
Reviewers: dblaikie, jdoerfert
Subscribers: hiraditya, llvm-commits, jhenderson
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73583
Simon Pilgrim [Wed, 29 Jan 2020 18:48:55 +0000 (18:48 +0000)]
[DAGCombiner] ISD::SHL/SRA/SRL - use general SelectionDAG::FoldConstantArithmetic
This handles all the constant splat / opaque testing for us.
Huihui Zhang [Wed, 29 Jan 2020 18:48:57 +0000 (10:48 -0800)]
[ConstantFold][SVE] Fix constant folding for scalable vector binary operations.
Summary:
Scalable vector should not be evaluated element by element.
Add support to handle scalable vector UndefValue.
Reviewers: sdesmalen, huntergr, spatel, lebedev.ri, apazos, efriedma, willlovett
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71445
Sam McCall [Wed, 29 Jan 2020 11:22:03 +0000 (12:22 +0100)]
[clangd] Don't mmap source files on all platforms --> don't crash on git checkout
Summary:
Previously we mmapped on unix and not on windows: on windows mmap takes
an exclusive lock on the file and prevents the user saving changes!
The failure mode on linux is a bit more subtle: if the file is changed on disk
but the SourceManager sticks around, then subsequent operations on the
SourceManager will fail as invariants are violated (e.g. null-termination).
This commonly manifests as crashes after switching git branches with many files
open in clangd.
Nominally mmap is for performance here, and we should be willing to give some
up to stop crashing. Measurements on my system (linux+desktop+SSD) at least
show no measurable regression on an a fairly IO-heavy workload: drop disk caches,
open SemaOverload.cpp, wait for first diagnostics.
for i in `seq 100`; do
for variant in mmap volatile; do
echo 3 | sudo tee /proc/sys/vm/drop_caches
/usr/bin/time --append --quiet -o ~/timings -f "%C %E" \
bin/clangd.$variant -sync -background-index=0 < /tmp/mirror > /dev/null
done
done
bin/clangd.mmap -sync -background-index=0 0:07.60
bin/clangd.volatile -sync -background-index=0 0:07.89
bin/clangd.mmap -sync -background-index=0 0:07.44
bin/clangd.volatile -sync -background-index=0 0:07.89
bin/clangd.mmap -sync -background-index=0 0:07.42
bin/clangd.volatile -sync -background-index=0 0:07.50
bin/clangd.mmap -sync -background-index=0 0:07.90
bin/clangd.volatile -sync -background-index=0 0:07.53
bin/clangd.mmap -sync -background-index=0 0:07.64
bin/clangd.volatile -sync -background-index=0 0:07.55
bin/clangd.mmap -sync -background-index=0 0:07.75
bin/clangd.volatile -sync -background-index=0 0:07.47
bin/clangd.mmap -sync -background-index=0 0:07.90
bin/clangd.volatile -sync -background-index=0 0:07.50
bin/clangd.mmap -sync -background-index=0 0:07.81
bin/clangd.volatile -sync -background-index=0 0:07.95
bin/clangd.mmap -sync -background-index=0 0:07.55
bin/clangd.volatile -sync -background-index=0 0:07.65
bin/clangd.mmap -sync -background-index=0 0:08.15
bin/clangd.volatile -sync -background-index=0 0:07.54
bin/clangd.mmap -sync -background-index=0 0:07.78
bin/clangd.volatile -sync -background-index=0 0:07.61
bin/clangd.mmap -sync -background-index=0 0:07.78
bin/clangd.volatile -sync -background-index=0 0:07.55
bin/clangd.mmap -sync -background-index=0 0:07.41
bin/clangd.volatile -sync -background-index=0 0:07.40
bin/clangd.mmap -sync -background-index=0 0:07.54
bin/clangd.volatile -sync -background-index=0 0:07.42
bin/clangd.mmap -sync -background-index=0 0:07.45
bin/clangd.volatile -sync -background-index=0 0:07.49
bin/clangd.mmap -sync -background-index=0 0:07.95
bin/clangd.volatile -sync -background-index=0 0:07.66
bin/clangd.mmap -sync -background-index=0 0:08.04
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73617
Austin Kerbow [Tue, 7 Jan 2020 21:13:05 +0000 (13:13 -0800)]
[AMDGPU][GlobalISel] Select 8-byte LDS Ops with 4-byte alignment
Reviewers: arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73585
Jonas Devlieghere [Wed, 29 Jan 2020 18:35:34 +0000 (10:35 -0800)]
[lldb/Host] Fix implicit StringRef to std::string conversion
lldb\source\Host\windows\Host.cpp(228): error C2440: 'initializing':
cannot convert from 'llvm::StringRef' to
'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
Adrian Prantl [Wed, 29 Jan 2020 18:22:15 +0000 (10:22 -0800)]
Run clang-format on DwarfExpression (NFC)
Adrian Prantl [Wed, 29 Jan 2020 18:08:57 +0000 (10:08 -0800)]
DwarfExpression: Factor out getOrCreateBaseType() (NFC)
Jonas Devlieghere [Wed, 29 Jan 2020 17:39:46 +0000 (09:39 -0800)]
[SmallString] Add explicit conversion to std::string
With the conversion between StringRef and std::string now being
explicit, converting SmallStrings becomes more tedious. This patch adds
an explicit operator so you can write std::string(Str) instead of
Str.str().str().
Differential revision: https://reviews.llvm.org/D73640
Huihui Zhang [Wed, 29 Jan 2020 18:15:26 +0000 (10:15 -0800)]
[ARM] Fix data race on RegisterBank initialization.
Summary:
The initialization of RegisterBank needs to be done only once. The
logic of AlreadyInit has data race, use llvm::call_once instead.
This is continuing work of D73587.
Reviewers: arsenm, rovka, dsanders, t.p.northover, efriedma, apazos
Reviewed By: arsenm
Subscribers: wdng, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73605
Huihui Zhang [Wed, 29 Jan 2020 18:14:30 +0000 (10:14 -0800)]
[AMDGPU] Fix data race on RegisterBank initialization.
Summary:
The initialization of RegisterBank needs to be done only once. The
logic of AlreadyInit has data race, use llvm::call_once instead.
This is continuing work of D73587.
Reviewers: arsenm, tstellar, ronlieb, efriedma, apazos, nhaehnle
Reviewed By: nhaehnle
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73604
Huihui Zhang [Wed, 29 Jan 2020 18:12:21 +0000 (10:12 -0800)]
[AArch64] Fix data race on RegisterBank initialization.
Summary:
The initialization of RegisterBank needs to be done only once. The
logic of AlreadyInit has a data race, use llvm::call_once instead.
This issue was identified through thread sanitizer.
Reviewers: efriedma, apazos, qcolombet, dsanders
Reviewed By: efriedma
Subscribers: arsenm, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73587
Eric Fiselier [Wed, 29 Jan 2020 17:51:31 +0000 (12:51 -0500)]
[libcxx] Add a std::string_view pretty printer for libcxx.
This adds a std::string_view pretty printer for libcxx and updates the gdb
pretty printer test.
Patch by Ali Tamur (tamur@google.com)
Reviewed as https://reviews.llvm.org/D73514
Adrian Prantl [Wed, 29 Jan 2020 01:25:15 +0000 (17:25 -0800)]
Add dwarfdump support for DW_OP_regval_type.
Differential Revision: https://reviews.llvm.org/D73598
Fangrui Song [Tue, 28 Jan 2020 01:35:06 +0000 (17:35 -0800)]
[ELF] Mention symbol name in reportRangeError()
For an out-of-range relocation referencing a non-local symbol, report the symbol name and the object file that defines the symbol. As an example:
```
t.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -
281474974609120 is not in [-
2147483648,
2147483647]
```
=>
```
t.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -
281474974609120 is not in [-
2147483648,
2147483647]; references func
>>> defined in t1.o
```
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D73518
Simon Pilgrim [Wed, 29 Jan 2020 17:25:44 +0000 (17:25 +0000)]
[DAGCombiner] ISD::MUL - use general SelectionDAG::FoldConstantArithmetic
This handles all the constant splat / opaque testing for us.
Simon Pilgrim [Wed, 29 Jan 2020 17:12:41 +0000 (17:12 +0000)]
Fix switch covers all cases static analyzer warning. NFCI.
Nikita Popov [Sat, 25 Jan 2020 10:05:59 +0000 (11:05 +0100)]
[InstCombine] Regenerate test checks; NFC
Bjorn Pettersson [Wed, 29 Jan 2020 16:19:26 +0000 (17:19 +0100)]
[scudo] Skip building scudo standalone if sys/auxv.h can't be found
Summary:
Since commit
c299d1981deaf822dfaa06c791f3158bd6801e20 scudo
standalone can't be built without including sys/auxv.h.
I do not have that file on my system, and my builds have failed
when trying to simply build "all" runtimes. Assuming that "all"
means "all possible given the current environment" we need to
guard the setting of COMPILER_RT_HAS_SCUDO_STANDALONE=TRUE by
first checking if sys/auxv.h can be found.
Reviewers: pcc, cryptoad
Reviewed By: pcc
Subscribers: mgorny, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D73631
Jonas Devlieghere [Wed, 29 Jan 2020 17:15:13 +0000 (09:15 -0800)]
[lldb/Reproducers] Add logging to the string template specialization
Only the templated function had logging for deserialization. The string
deserializer is implemented as a specialization and now prints to the
log as well.
Craig Topper [Wed, 29 Jan 2020 17:00:33 +0000 (09:00 -0800)]
[X86] Custom lower ISD::FROUND with SSE4.1 to avoid a libcall.
ISD::FROUND is defined to round to nearest with ties rounding
away from 0. This mode isn't supported in hardware on X86.
But as long as we aren't compiling with trapping math, we can
emulate this with floor(X + copysign(nextafter(0.5, 0.0), X)).
We have to use nextafter to avoid some corner cases that adding
0.5 would have. For example, if X is nextafter(0.5, 0.0) it should
round to 0.0, but adding 0.5 would need one extra bit of mantissa
than can be stored so it rounds to 1.0. Adding nextafter(0.5, 0.0)
instead will just increase the exponent by 1 and leave the mantissa
as all 1s. This would be nextafter(1.0, 0.0) which will floor to 0.0.
Techically this requires -fno-trapping-math which isn't our default.
But if we care about exceptions we should be using constrained
intrinsics. Constrained intrinsics would use STRICT_FROUND which
won't go through this code.
Fixes PR42195.
Differential Revision: https://reviews.llvm.org/D73607
Francesco Petrogalli [Wed, 15 Jan 2020 19:50:44 +0000 (19:50 +0000)]
[llvm][docs] LangRef for IR attribute `vector-function-abi-variant`.
Reviewers: jdoerfert, andwar, simoll, rengolin, hfinkel, xtian
Reviewed By: jdoerfert
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72798
Jay Foad [Mon, 6 Jan 2020 15:33:15 +0000 (15:33 +0000)]
[AMDGPU] Cluster FLAT instructions with both vaddr and saddr
Reviewers: rampitec, arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73634
Sergey Dmitriev [Wed, 29 Jan 2020 16:35:15 +0000 (08:35 -0800)]
[Clang][Bundler] Add 'exclude' flag to target objects sections
Summary: This flag tells link editor to exclude section from linker inputs when linking executable or shared library.
Reviewers: ABataev, alexshap, jdoerfert
Reviewed By: ABataev
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73408
Simon Pilgrim [Wed, 29 Jan 2020 16:56:27 +0000 (16:56 +0000)]
[DAGCombiner] Sub/SUBSAT - use general SelectionDAG::FoldConstantArithmetic
This handles all the constant splat / opaque testing for us.
Simon Pilgrim [Wed, 29 Jan 2020 16:36:03 +0000 (16:36 +0000)]
[DAGCombiner] visitIMINMAX - use general SelectionDAG::FoldConstantArithmetic
This handles all the constant splat / opaque testing for us instead of the ConstantSDNode variant where we have to do it ourselves.
Craig Topper [Wed, 29 Jan 2020 16:14:29 +0000 (08:14 -0800)]
[X86] Use a shorter sequence to implement FLT_ROUNDS
This code needs to map from the FPCW 2-bit encoding for rounding mode to the 2-bit encoding defined for FLT_ROUNDS. The previous implementation did some clever swapping of bits and adding 1 modulo 4 to do the mapping.
This patch instead uses an 8-bit immediate as a lookup table of four 2-bit values. Then we use the 2-bit FPCW encoding to index the lookup table by using a right shift and an AND. This requires extracting the 2-bit value from FPCW and multipying it by 2 to make it usable as a shift amount. But still results in less code.
Differential Revision: https://reviews.llvm.org/D73599
Matt Arsenault [Fri, 24 Jan 2020 19:01:09 +0000 (14:01 -0500)]
AMDGPU/GlobalISel: Fix tablegen selection for scalar bin ops
Fixes selection for scalar G_SMULH/G_UMULH. Also switches to using
tablegen selected add/sub, which switch to the signed version of the
opcode. This matches the current DAG behavior. We can't drop the
manual selection for add/sub yet, because it's still both for VALU
add/sub and for G_PTR_ADD.
Jay Foad [Wed, 29 Jan 2020 16:46:45 +0000 (16:46 +0000)]
Add a test extracted from D69557 "AsmParser: Allow FMF on varargs call"
Kazushi (Jam) Marukawa [Wed, 29 Jan 2020 16:40:46 +0000 (17:40 +0100)]
[VE] (conditional) branch modification & isel patterns
Summary:
InstInfo for branch modification, (conditional) branch isel patterns and tests.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D73632
Matt Arsenault [Tue, 21 Jan 2020 23:38:19 +0000 (18:38 -0500)]
GlobalISel: Fix mask computation in lowerInsert
This is supposed to be the high bit index, not the width. Use the
wrapping form of getBitsSet and avoid the bitflip.
Matt Arsenault [Wed, 1 Jan 2020 02:54:33 +0000 (21:54 -0500)]
AMDGPU: Directly select 16-bank LDS case of llvm.amdgcn.interp.p1.f16
Manually select this is as a tablegen workraound. Both SelectionDAG
and GlobalISel end up misplacing the copy to m0 when both instructions
in the output need it. Neither considers that both output instructions
depend on m0. I don't know of any other pattern we need to handle this
case, so it's less effort to just workaround this for now.
Jay Foad [Thu, 19 Dec 2019 16:53:05 +0000 (16:53 +0000)]
[MachineScheduler] Ignore artificial edges when forming store chains
Summary:
BaseMemOpClusterMutation::apply forms store chains by looking for
control (i.e. non-data) dependencies from one mem op to another.
In the test case, clusterNeighboringMemOps successfully clusters the
loads, and then adds artificial edges to the loads' successors as
described in the comment:
// Copy successor edges from SUa to SUb. Interleaving computation
// dependent on SUa can prevent load combining due to register reuse.
The effect of this is that *data* dependencies from one load to a store
are copied as *artificial* dependencies from a different load to the
same store.
Then when BaseMemOpClusterMutation::apply looks at the stores, it finds
that some of them have a control dependency on a previous load, which
breaks the chains and means that the stores are not all considered part
of the same chain and won't all be clustered.
The fix is to only consider non-artificial control dependencies when
forming chains.
Subscribers: MatzeB, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71717
Matt Arsenault [Sun, 26 Jan 2020 04:20:38 +0000 (23:20 -0500)]
AMDGPU/GlobalISel: Handle LDS with relocations case
Elia Geretto [Wed, 29 Jan 2020 05:45:27 +0000 (05:45 +0000)]
[PassManagerBuilder] Remove global extension when a plugin is unloaded
This commit fixes PR39321.
GlobalExtensions is not guaranteed to be destroyed when optimizer plugins are unloaded. If it is indeed destroyed after a plugin is dlclose-d, the destructor of the corresponding ExtensionFn is not mapped anymore, causing a call to unmapped memory during destruction.
This commit guarantees that extensions coming from external plugins are removed from GlobalExtensions when the plugin is unloaded if GlobalExtensions has not been destroyed yet.
Differential Revision: https://reviews.llvm.org/D71959
Connor Abbott [Wed, 27 Nov 2019 13:09:13 +0000 (14:09 +0100)]
AMDGPU: Fix handling of infinite loops in fragment shaders
Summary:
Due to the fact that kill is just a normal intrinsic, even though it's
supposed to terminate the thread, we can end up with provably infinite
loops that are actually supposed to end successfully. The
AMDGPUUnifyDivergentExitNodes pass breaks up these loops, but because
there's no obvious place to make the loop branch to, it just makes it
return immediately, which skips the exports that are supposed to happen
at the end and hangs the GPU if all the threads end up being killed.
While it would be nice if the fact that kill terminates the thread were
modeled in the IR, I think that the structurizer as-is would make a mess if we
did that when the kill is inside control flow. For now, we just add a null
export at the end to make sure that it always exports something, which fixes
the immediate problem without penalizing the more common case. This means that
we sometimes do two "done" exports when only some of the threads enter the
discard loop, but from tests the hardware seems ok with that.
This fixes dEQP-VK.graphicsfuzz.while-inside-switch with radv.
Reviewers: arsenm, nhaehnle
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70781
Matt Arsenault [Sun, 26 Jan 2020 01:25:37 +0000 (20:25 -0500)]
AMDGPU/GlobalISel: Look through copies for source modifiers
When all VOP instructions are legalized to VGPRs, any SGPR source
modifiers will have a copy in the way.
Stanislav Mekhanoshin [Tue, 28 Jan 2020 22:14:37 +0000 (14:14 -0800)]
[AMDGPU] override isHighLatencyDef
SIMachineScheduler uses isHighLatencyInstruction with the same
sematincs, but TargetInstrInfo has virtual isHighLatencyDef
method, so override it instead.
Added FLAT to the list of high latency opcodes and a check for
mayLoad since stores are not technically high latency in terms
of data dependency.
This change did not produce any visible impact on our tests.
Differential Revision: https://reviews.llvm.org/D73582
Matt Arsenault [Tue, 28 Jan 2020 21:09:12 +0000 (16:09 -0500)]
GlobalISel: Assert on invalid bitcast in MIRBuilder
The other casts validate, so this should too.
Matt Arsenault [Sun, 26 Jan 2020 01:02:12 +0000 (20:02 -0500)]
AMDGPU/GlobalISel: Rewrite fadd select tests
Convert to the style most others use with one test instruction per
function, and use an implicit use to ensure the result register class
is constrained.
Change-Id: I6109148b0e3c80aa5535796a37abca583c19a936
Benjamin Kramer [Wed, 29 Jan 2020 15:46:18 +0000 (16:46 +0100)]
[clang-tidy] Initialize token before handing it to the lexer
Found by msan.
Simon Pilgrim [Wed, 29 Jan 2020 15:19:26 +0000 (15:19 +0000)]
Fix MSVC lamdba default capture mode warning. NFCI.
Hans Wennborg [Wed, 29 Jan 2020 15:21:08 +0000 (16:21 +0100)]
Work around PR44697 in CrashRecoveryContext
Matt Arsenault [Tue, 28 Jan 2020 18:14:06 +0000 (13:14 -0500)]
LLT: Add changeNumElements
This is the element analog of changeElementType/changeElementSize
LLVM GN Syncbot [Wed, 29 Jan 2020 15:15:45 +0000 (15:15 +0000)]
[gn build] Port
9a08a3fab99
Connor Abbott [Wed, 29 Jan 2020 15:14:52 +0000 (16:14 +0100)]
Revert "AMDGPU: Fix handling of infinite loops in fragment shaders"
This reverts commit
0994c485e61322a04e580d83617eab547292aba2.
Connor Abbott [Wed, 29 Jan 2020 15:14:49 +0000 (16:14 +0100)]
Revert "AMDGPU: Fix AMDGPUUnifyDivergentExitNodes with no normal returns"
This reverts commit
323bfde20c5f3e63db3d6b385b394ed38542abe6.
Adam Balogh [Thu, 16 Jan 2020 15:33:05 +0000 (16:33 +0100)]
[Analyzer] Split container modeling from iterator modeling
Iterator modeling depends on container modeling,
but not vice versa. This enables the possibility
to arrange these two modeling checkers into
separate layers.
There are several advantages for doing this: the
first one is that this way we can keep the
respective modeling checkers moderately simple
and small. Furthermore, this enables creation of
checkers on container operations which only
depend on the container modeling. Thus iterator
modeling can be disabled together with the
iterator checkers if they are not needed.
Since many container operations also affect
iterators, container modeling also uses the
iterator library: it creates iterator positions
upon calling the `begin()` or `end()` method of
a containter (but propagation of the abstract
position is left to the iterator modeling),
shifts or invalidates iterators according to the
rules upon calling a container modifier and
rebinds the iterator to a new container upon
`std::move()`.
Iterator modeling propagates the abstract
iterator position, handles the relations between
iterator positions and models iterator
operations such as increments and decrements.
Differential Revision: https://reviews.llvm.org/D73547
Whitney Tsang [Wed, 29 Jan 2020 15:02:21 +0000 (15:02 +0000)]
[LoopFusion] Move instructions from FC1.Preheader to FC0.Preheader when
proven safe.
Summary:
Currently LoopFusion give up when the second loop nest preheader is
not empty. For example:
for (int i = 0; i < 100; ++i) {}
x+=1;
for (int i = 0; i < 100; ++i) {}
The above example should be safe to fuse.
This PR moves instructions in FC1 preheader (e.g. x+=1; ) to
FC0 preheader, which then LoopFusion is able to fuse them.
Reviewer: kbarton, Meinersbur, jdoerfert, dmgreen, fhahn, hfinkel,
bmahjour, etiotto
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D71821
Kazushi (Jam) Marukawa [Wed, 29 Jan 2020 14:59:29 +0000 (15:59 +0100)]
[VE] udiv/sdiv/urem/srem/mul isel patterns
Summary:
udiv/sdiv/urem/srem/mul integer isel patterns and tests.
Pretend for now that integer division were always cheap in HW.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D73623
Guillaume Chatelet [Mon, 27 Jan 2020 09:55:32 +0000 (10:55 +0100)]
[libc] Fix benchmarks CMakeLists.txt
Summary:
This is a follow up on https://reviews.llvm.org/rGaba80d0734d1#886881.
`target_link_options` requires CMake>=3.13.
Reviewers: abrachet
Subscribers: mgorny, MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D73452
Nicolas Vasilache [Tue, 28 Jan 2020 18:44:37 +0000 (13:44 -0500)]
[mlir][Linalg] Introduce folding patterns to remove certain MemRefCastOp
Summary:
Canonicalization and folding patterns in StandardOps may interfere with the needs
of Linalg. This revision introduces specific foldings for dynamic memrefs that can
be proven to be static.
Very concretely:
Determines whether it is possible to fold it away in the parent Linalg op:
```mlir
%1 = memref_cast %0 : memref<8x16xf32> to memref<?x?xf32>
%2 = linalg.slice %1 ... : memref<?x?xf32> ...
// or
%1 = memref_cast %0 : memref<8x16xf32, affine_map<(i, j)->(16 * i + j)>>
to memref<?x?xf32>
linalg.generic(%1 ...) : memref<?x?xf32> ...
```
into
```mlir
%2 = linalg.slice %0 ... : memref<8x16xf32> ...
// or
linalg.generic(%0 ... : memref<8x16xf32, affine_map<(i, j)->(16 * i + j)>>
```
Reviewers: ftynse, aartbik, jsetoain, tetuante, asaadaldien
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73565