Ulrich Weigand [Fri, 6 Dec 2019 11:08:26 +0000 (12:08 +0100)]
[X86] Regenerate test to fix build bot failures
After my recent commit daee549 the following test case is failing:
CodeGen/X86/vector-constrained-fp-intrinsics.ll
Not sure why I didn't catch this earlier, seems to be affected
by other changes that came in recently.
Fixed by regerenating the test again. Sorry for the disruption!
Cullen Rhodes [Fri, 6 Dec 2019 10:04:23 +0000 (10:04 +0000)]
[AArch64][SVE] Implement integer compare intrinsics
Summary:
Adds intrinsics for the following:
* cmphs, cmphi
* cmpge, cmpgt
* cmpeq, cmpne
* cmplt, cmple
* cmplo, cmpls
Includes a minor change to `TLI.getMemValueType` that fixes a crash due to the
scalable flag being dropped.
Reviewers: sdesmalen, efriedma, rengolin, rovka, dancgr, huntergr
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70889
Mikael Holmen [Fri, 6 Dec 2019 10:13:56 +0000 (11:13 +0100)]
[clangd] Fix gcc warning about extra ";" [NFC]
gcc complained with
/data/repo/master/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:326:30: warning: extra ';' [-Wpedantic]
REGISTER_TWEAK(DefineOutline);
^
Raphael Isemann [Fri, 6 Dec 2019 10:04:33 +0000 (11:04 +0100)]
[lldb][NFC] Move [SU]Int64ValueIsValidForByteSize to RegisterValue
These functions are an implementation detail of RegisterValue, so
it doesn't make a lot of sense to implement them in a totally
unrelated class.
Ulrich Weigand [Fri, 6 Dec 2019 10:02:11 +0000 (11:02 +0100)]
[FPEnv][SelectionDAG] Relax chain requirements
This patch implements the following changes:
1) SelectionDAGBuilder::visitConstrainedFPIntrinsic currently treats
each constrained intrinsic like a global barrier (e.g. a function call)
and fully serializes all pending chains. This is actually not required;
it is allowed for constrained intrinsics to be reordered w.r.t one
another or (nonvolatile) memory accesses. The MI-level scheduler already
allows for that flexibility, so it makes sense to allow it at the DAG
level as well.
This patch therefore changes the way chains for constrained intrisincs
are created, and handles them basically like load operations are handled.
This has the effect that constrained intrinsics are no longer serialized
against one another or (nonvolatile) loads. They are still serialized
against stores, but that seems hard to change with the current DAG chain
setup, and it also doesn't seem to be a big problem preventing DAG
2) The OPC_CheckFoldableChainNode check requires that each of the
intermediate nodes in a multi-node pattern match only has a single use.
This check tends to fail if those intermediate nodes are strict operations
as those have a chain output that typically indeed has another use.
However, we don't really need to consider chains here at all, since they
will all be rewritten anyway by UpdateChains later. Other parts of the
matcher therefore already ignore chains, but this hasOneUse check doesn't.
This patch replaces hasOneUse by a custom test that verifies there is no
more than one use of any non-chain output value.
In theory, this change could affect code unrelated to strict FP nodes,
but at least on SystemZ I could not find any single instance of that
happening
3) The SystemZ back-end currently does not allow matching multiply-and-
extend operations (32x32 -> 64bit or 64x64 -> 128bit FP multiply) for
strict FP operations. This was not possible in the past due to the
problems described under 1) and 2) above.
With those issues fixed, it is now possible to fully support those
instructions in strict mode as well, and this patch does so.
Differential Revision: https://reviews.llvm.org/D70913
Pavel Labath [Thu, 5 Dec 2019 15:21:23 +0000 (16:21 +0100)]
[lldb/DWARF] Fix DW_AT_addr_base & DW_AT_low_pc interaction
In DWARF5 DW_AT_low_pc (and DW_AT_entry_pc, and possibly others) can use
DW_FORM_addrx to refer to the address indirectly. This means we need to
have processed the DW_AT_addr_base attribute before we can do anything
with these.
Since we were processing the unit attributes serially, this created a
problem in cases where the DW_AT_addr_base comes after DW_AT_low_pc --
we would end up computing the wrong unit base address, which also
corrupted any values which later depended on that (for instance range
lists). Clang currently always emits DW_AT_addr_base last.
The fix is simple -- process DW_AT_addr_base first, regardless of its
position in the attribute list.
Raphael Isemann [Fri, 6 Dec 2019 08:44:50 +0000 (09:44 +0100)]
[lldb][NFC] Remove ability to pass a custom printf format to DataExtractor::PutToLog
This is luckily not used anywhere.
Pavel Labath [Thu, 5 Dec 2019 14:30:18 +0000 (15:30 +0100)]
[lldb/DWARF] Fix DW_AT_rnglists_base handling for dwo files
the value of DW_AT_rnglists_base of the skeleton unit is for that unit
alone (e.g. used in DW_AT_ranges of the unit DIE) and should not apply
to the split unit.
The split unit has a hardcoded range list base value -- we should
initialize range list code whenever we detect a nonempty
debug_rnglists.dwo section.
Raphael Isemann [Fri, 6 Dec 2019 08:53:44 +0000 (09:53 +0100)]
[lldb] Migrate VMRange::Dump to raw_ostream
Pavel Labath [Tue, 26 Nov 2019 15:41:26 +0000 (16:41 +0100)]
[lldb/IRExecutionUnit] Stop searching based on demangled names
Summary:
This was causing problems on linux, where we'd end up calling the
deleting destructor instead of a regular one (because they have the same
demangled name), making a lot of mischief in the process.
The only place where this was necessary (according to the test suite, at
least) was to call a base structor instead of a complete one, but this
is now handled in a more targeted fashion.
TestCallOverriddenMethod is now re-enabled as it now passes reliably.
Reviewers: teemperor, JDevlieghere
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70722
Pavel Labath [Fri, 6 Dec 2019 09:10:04 +0000 (10:10 +0100)]
[lldb/DWARF] Remove DWARFDebugRangesBase abstract class
now that we use llvm to parse debug_rnglists, this abstraction is not
useful.
Alexander Kornienko [Thu, 5 Dec 2019 11:11:06 +0000 (12:11 +0100)]
[clang-tidy] Fix PR26274
Summary:
This commit fixes http://llvm.org/PR26274 in a simpler and more correct way than
4736d63f752f8d13f4c6a9afd558565c32119718 did. See
https://reviews.llvm.org/D69855#1767089 for details.
Reviewers: gribozavr, aaron.ballman, gribozavr2
Reviewed By: aaron.ballman, gribozavr2
Subscribers: gribozavr2, merge_guards_bot, xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70974
LLVM GN Syncbot [Fri, 6 Dec 2019 08:55:53 +0000 (08:55 +0000)]
gn build: Merge
99768b243cd
Sam McCall [Fri, 29 Nov 2019 18:37:48 +0000 (19:37 +0100)]
[clangd] (take 2) Try harder to find a plausible `clang` as argv0, particularly on Mac.
Summary:
This was originally committed in
88bccded8fa169481fa367debf5ec615640635a1,
and reverted in
93f77617abba512d2861e2fc50ce385883f587b6.
This version is now much more testable: the "detect toolchain properties" part
is still not tested but also not active in tests.
All the command manipulation based on the detected properties is
directly tested, and also not active in other tests.
Fixes https://github.com/clangd/clangd/issues/211
Fixes https://github.com/clangd/clangd/issues/178
Reviewers: kbobyrev, ilya-biryukov
Subscribers: mgorny, ormris, cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71029
Raphael Isemann [Fri, 6 Dec 2019 07:38:23 +0000 (08:38 +0100)]
[lldb][NFC] Migrate FileSpec::Dump to raw_ostream
Konrad Kleine [Tue, 3 Dec 2019 14:38:21 +0000 (09:38 -0500)]
[lldb] NFC: less nesting in SearchFilter.cpp
I was working on SearchFilter.cpp and felt it a bit too complex in some cases in terms of nesting and logic flow.
Reviewers: teemperor, JDevlieghere
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71022
Michał Górny [Tue, 3 Dec 2019 13:44:33 +0000 (14:44 +0100)]
[compiler-rt] [test] Disable ASLR on ASAN/MSAN/TSAN tests on NetBSD
Use a new %run wrapper for ASAN/MSAN/TSAN tests that calls paxctl
in order to disable ASLR on the test executables. This makes it
possible to test sanitizers on systems where ASLR is enabled by default.
Differential Revision: https://reviews.llvm.org/D70958
LLVM GN Syncbot [Fri, 6 Dec 2019 07:03:37 +0000 (07:03 +0000)]
gn build: Merge
9e8c799e2b0
Alexey Lapshin [Thu, 5 Dec 2019 10:11:32 +0000 (13:11 +0300)]
[Dsymutil][NFC] Move NonRelocatableStringpool into common CodeGen folder.
That refactoring moves NonRelocatableStringpool into common CodeGen folder.
So that NonRelocatableStringpool could be used not only inside dsymutil.
Differential Revision: https://reviews.llvm.org/D71068
Daniil Suchkov [Thu, 21 Nov 2019 10:56:02 +0000 (17:56 +0700)]
[LCSSA] Don't use VH callbacks to invalidate SCEV when creating LCSSA phis
In general ValueHandleBase::ValueIsRAUWd shouldn't be called when not
all uses of the value were actually replaced, though, currently
formLCSSAForInstructions calls it when it inserts LCSSA-phis.
Calls of ValueHandleBase::ValueIsRAUWd were added to LCSSA specifically
to update/invalidate SCEV. In the best case these calls duplicate some
of the work already done by SE->forgetValue, though in case when SCEV of
the value is SCEVUnknown, SCEV replaces the underlying value of
SCEVUnknown with the new value (i.e. acts like LCSSA-phi actually fully
replaces the value it is created for), which leads to SCEV being
corrupted because LCSSA-phi rarely dominates all uses of its inputs.
Fixes bug https://bugs.llvm.org/show_bug.cgi?id=44058.
Reviewers: fhahn, efriedma, reames, sanjoy.google
Reviewed By: fhahn
Subscribers: hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70593
Douglas Yung [Fri, 6 Dec 2019 04:15:52 +0000 (20:15 -0800)]
Fix build of LookupResult.cpp from aeda128 with Visual C++.
Lang Hames [Fri, 6 Dec 2019 04:04:53 +0000 (20:04 -0800)]
[JITLink] Use Blocks rather than Symbols for SectionRange.
This ensures that anonymous blocks are included in the section range.
Lang Hames [Fri, 6 Dec 2019 03:57:51 +0000 (19:57 -0800)]
[JITLink] Remove the Section::symbols_empty() method.
llvm::empty(Sec.symbols()) can be used instead.
David Blaikie [Fri, 6 Dec 2019 03:51:30 +0000 (19:51 -0800)]
DebugInfo: Pull out a common expression.
This is for the case where -gmlt -gsplit-dwarf -fsplit-dwarf-inlining
are used together in some but not all units during LTO (or, in the
reduced case, even without LTO) - ensuring that no split dwarf is used
(because split-dwarf-inlining puts the same data in the .o file, so
there's no need to duplicate it into the .dwo file)
George Burgess IV [Fri, 6 Dec 2019 03:42:33 +0000 (19:42 -0800)]
llvm-reduce: Add a space to an option's --help
Otherwise, we get "filewith".
Huihui Zhang [Thu, 5 Dec 2019 21:38:07 +0000 (13:38 -0800)]
[ConstantFold][SVE] Skip scalable vectors in ConstantFoldInsertElementInstruction.
Summary:
Should not constant fold insertelement instruction for scalable vector type.
Reviewers: huntergr, sdesmalen, spatel, levedev.ri, apazos, efriedma, willlovett
Reviewed By: efriedma, spatel
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70985
Richard Smith [Fri, 6 Dec 2019 02:04:46 +0000 (18:04 -0800)]
Fix crash if a user-defined conversion is applied in the middle of a
rewrite of an operator in terms of operator<=>.
Douglas Yung [Fri, 6 Dec 2019 02:35:08 +0000 (18:35 -0800)]
Tighten up CHECK lines added in
a9f10ebffa to work on ARM.
On ARM platforms, the compiler generates an additional line containing `-CXXRecordDecl which is not the intended line, but preceeds the intended match causing the test to fail.
Peter Collingbourne [Tue, 19 Nov 2019 22:51:48 +0000 (14:51 -0800)]
gn build: Add support for building scudo and its unit tests.
Differential Revision: https://reviews.llvm.org/D71081
Peter Collingbourne [Tue, 19 Nov 2019 22:40:21 +0000 (14:40 -0800)]
gn build: Bump Android API level to 29, and NDK to r21.
These are both necessary in order to use ELF TLS, which is needed
by the scudo unit tests.
Differential Revision: https://reviews.llvm.org/D71079
Craig Topper [Fri, 6 Dec 2019 01:47:33 +0000 (17:47 -0800)]
[X86] Make X86TargetLowering::BuildFILD return a std::pair of SDValues so we explicitly return the chain instead of calling getValue on the single SDValue.
We shouldn't assume that the returned result can be used to get
the other result.
This is prep-work for strict FP where we will also need to pass
the chain result along in more cases.
Liu, Chen3 [Fri, 6 Dec 2019 01:44:33 +0000 (09:44 +0800)]
Add strict fp support for instructions fadd/fsub/fmul/fdiv
Differential Revision: https://reviews.llvm.org/D68757
LLVM GN Syncbot [Fri, 6 Dec 2019 00:53:40 +0000 (00:53 +0000)]
gn build: Merge
aeda128a96c
LLVM GN Syncbot [Fri, 6 Dec 2019 00:53:39 +0000 (00:53 +0000)]
gn build: Merge
6470497817e
Greg Clayton [Wed, 4 Dec 2019 00:44:02 +0000 (16:44 -0800)]
Add lookup functions for efficient lookups of addresses when using GsymReader classes.
Summary:
Lookup functions are designed to not fully decode a FunctionInfo, LineTable or InlineInfo, they decode only what is needed into a LookupResult object. This allows lookups to avoid costly memory allocations and avoid parsing large amounts of information one a suitable match is found.
LookupResult objects contain the address that was looked up, the concrete function address range, the name of the concrete function, and a list of source locations. One for each inline function, and one for the concrete function. This allows one address to turn into multiple frames and improves the signal you get when symbolicating addresses in GSYM files.
Reviewers: labath, aprantl
Subscribers: mgorny, hiraditya, llvm-commits, lldb-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70993
Sterling Augustine [Fri, 6 Dec 2019 00:16:08 +0000 (16:16 -0800)]
Revert "[AST] Traverse the class type loc inside the member type loc."
This reverts commit
7f93cb62280a73e3e899d49c45be8bfbac634b7d.
The assertion at RecursiveASTVisitor.h:1169 fails when passed a TypeLocNode.
Not sure if the correct fix is to use getTypeLocClass or something else.
Teresa Johnson [Tue, 3 Dec 2019 21:56:07 +0000 (13:56 -0800)]
[ThinLTO] Add option to disable readonly/writeonly attribute propagation
Summary:
Add an option to allow the attribute propagation on the index to be
disabled, to allow a workaround for issues (such as that fixed by
D70977).
Also move the setting of the WithAttributePropagation flag on the index
into propagateAttributes(), and remove some old stale code that predated
this flag and cleared the maybe read/write only bits when we need to
disable the propagation (previously only when importing disabled, now
also when the new option disables it).
Reviewers: evgeny777, steven_wu
Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70984
Quentin Colombet [Wed, 4 Dec 2019 23:36:35 +0000 (15:36 -0800)]
[RegisterCoalescer] Fix the creation of subranges when rematerialization is used
* Context *
During register coalescing, we use rematerialization when coalescing is not
possible. That means we may rematerialize a super register when only a smaller
register is actually used.
E.g.,
0B v1 = ldimm 0xFF
1B v2 = COPY v1.low8bits
2B = v2
=>
0B v1 = ldimm 0xFF
1B v2 = ldimm 0xFF
2B = v2.low8bits
Where xB are the slot indexes.
Here v2 grew from a 8-bit register to a 16-bit register.
When that happens and subregister liveness is enabled, we create subranges for
the newly created value.
E.g., before remat, the live range of v2 looked like:
main range: [1r, 2r)
(Reads v2 is defined at index 1 slot register and used before the slot register
of index 2)
After remat, it should look like:
main range: [1r, 2r)
low 8 bits: [1r, 2r)
high 8 bits: [1r, 1d) <-- dead def
I.e., the unsused lanes of v2 should be marked as dead definition.
* The Problem *
Prior to this patch, the live-ranges from the previous exampel, would have the
full live-range for all subranges:
main range: [1r, 2r)
low 8 bits: [1r, 2r)
high 8 bits: [1r, 2r) <-- too long
* The Fix *
Technically, the code that this patch changes is not wrong:
When we create the subranges for the newly rematerialized value, we create only
one subrange for the whole bit mask.
In other words, at this point v2 live-range looks like this:
main range: [1r, 2r)
low & high: [1r, 2r)
Then, it gets wrong when we call LiveInterval::refineSubRanges on low 8 bits:
main range: [1r, 2r)
low 8 bits: [1r, 2r)
high 8 bits: [1r, 2r) <-- too long
Ideally, we would like LiveInterval::refineSubRanges to be able to do the right
thing and mark the dead lanes as such. However, this is not possible, because by
the time we update / refine the live ranges, the IR hasn't been updated yet,
therefore we actually don't have enough information to do the right thing.
Another option to fix the problem would have been to call
LiveIntervals::shrinkToUses after the IR is updated. This is not desirable as
this may have a noticeable impact on compile time.
Instead, what this patch does is when we create the subranges for the
rematerialized value, we explicitly create one subrange for the lanes that were
used before rematerialization and one for the lanes that were not used. The used
one inherits the live range of the main range and the unused one is just created
empty. The existing rematerialization code then detects that the unused one are
not live and it correctly sets dead def intervals for them.
https://llvm.org/PR41372
Reid Kleckner [Fri, 6 Dec 2019 00:01:58 +0000 (16:01 -0800)]
Handle two corner cases in creduce-clang-crash.py
Summary:
First, call os.path.normpath on the filename argument. I passed in
./foo-asdf.cpp, and this meant that the script failed to find the
filename, and bad things happened.
Second, call os.path.abspath on binaries. CReduce runs the
interestingness test in a temp dir, so relative paths will not work.
Reviewers: akhuang
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71098
Wenlei He [Mon, 25 Nov 2019 07:54:07 +0000 (23:54 -0800)]
[AutoFDO] Top-down Inlining for specialization with context-sensitive profile
Summary:
AutoFDO's sample profile loader processes function in arbitrary source code order, so if I change the order of two functions in source code, the inline decision can change. This also prevented the use of context-sensitive profile to do specialization while inlining. This commit enforces SCC top-down order for sample profile loader. With this change, we can now do specialization, as illustrated by the added test case:
Say if we have A->B->C and D->B->C call path, we want to inline C into B when root inliner is B, but not when root inliner is A or D, this is not possible without enforcing top-down order. E.g. Once C is inlined into B, A and D can only choose to inline (B->C) as a whole or nothing, but what we want is only inline B into A and D, not its recursive callee C. If we process functions in top-down order, this is no longer a problem, which is what this commit is doing.
This change is guarded with a new switch "-sample-profile-top-down-load" for tuning, and it depends on D70653. Eventually, top-down can be the default order for sample profile loader.
Reviewers: wmi, davidxl
Subscribers: hiraditya, llvm-commits, tejohnson
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70655
Wenlei He [Mon, 25 Nov 2019 07:31:02 +0000 (23:31 -0800)]
[AutoFDO] Properly merge context-sensitive profile of inlinee back to outlined function
Summary:
When sample profile loader decides not to inline a previously inlined call-site, we adjust the profile of outlined function simply by scaling up its profile counts by call-site count. This means the context-sensitive profile of that inlined instance will be thrown away. This commit try to keep context-sensitive profile for such cases:
- Instead of scaling outlined function's profile, we now properly merge the FunctionSamples of inlined instance into outlined function, including all recursively inlined profile.
- Instead of adjusting the profile for negative inline decision at the end of the sample profile loader pass, we do the profile merge right after processing each function. This change paired with top-down ordering of annotation/inline-replay (a separate diff) will make sure we recursively merge profile back before the profile is used for annotation and inline replay.
A new switch -sample-profile-merge-inlinee is added to enable the new profile merge for tuning. It should be the default behavior eventually.
Reviewers: wmi, davidxl
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70653
LLVM GN Syncbot [Thu, 5 Dec 2019 23:54:18 +0000 (23:54 +0000)]
gn build: Merge
fdf80e86a52
Saar Raz [Thu, 5 Dec 2019 23:53:18 +0000 (01:53 +0200)]
[Concepts] Fix build failures in D41569
Fix build failures in previous commit.
Jordan Rupprecht [Thu, 5 Dec 2019 23:48:34 +0000 (15:48 -0800)]
[lldb] Update hardcoded Makefile.rules inclusions.
This replaces `include $(LEVEL)/Makefile.rules` with `include Makefile.rules`.
The lldb test driver already passes the include path when running make, and specifically looking for "../../Makefile.rules" forces the test to be in a specific location.
Removing this hardcoded relative path will make it possible to move this test as-is.
Saar Raz [Thu, 5 Dec 2019 23:30:21 +0000 (01:30 +0200)]
[Concepts] Constraint Enforcement & Diagnostics
Part of the C++20 concepts implementation effort.
- Associated constraints (requires clauses, currently) are now enforced when instantiating/specializing templates and when considering partial specializations and function overloads.
- Elaborated diagnostics give helpful insight as to why the constraints were not satisfied.
Phabricator: D41569
Re-commit, after fixing some memory bugs.
Fangrui Song [Thu, 5 Dec 2019 23:22:53 +0000 (15:22 -0800)]
[IR] Move ctor in the NDEBUG branch
Fangrui Song [Thu, 5 Dec 2019 23:00:30 +0000 (15:00 -0800)]
[IR] Add a default copy constructor for -Wdeprecated-copy
Richard Smith [Thu, 5 Dec 2019 21:39:38 +0000 (13:39 -0800)]
Properly convert all declaration non-type template arguments when
forming non-type template parameter values.
This reverts commit
93cc9dddd82f9e971f382ade6acf6634c5914966,
which reverted commit
11d10527852b4d3ed738aa90d8bec0f398160593.
We now always form `&x` when forming a pointer to a function rather than
trying to use function-to-pointer decay. This matches the behavior of
the old code in this case, but not the intent as described by the
comments.
Eric Christopher [Thu, 5 Dec 2019 22:16:04 +0000 (14:16 -0800)]
Add a default copy constructor for -Wdeprecated-copy warnings.
Jon Chesterfield [Thu, 5 Dec 2019 21:47:43 +0000 (21:47 +0000)]
[libomptarget][nfc] Introduce SHARED, ALIGN macros
Summary:
[libomptarget][nfc] Introduce SHARED, ALIGN macros
Move remaining cuda attributes behind such macros
Reviewers: ABataev, jdoerfert, grokos
Reviewed By: ABataev
Subscribers: openmp-commits, jvesely
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D71076
Adrian Prantl [Thu, 5 Dec 2019 21:19:37 +0000 (13:19 -0800)]
Debug Info: Apply a default location for cleanups if none is available.
This unbreaks the debuginfo-tests testsuite by replacing the assertion
with a default location. There are cleanups in helper functions that
don't have a valid source location such as block copy helpers and it's
not worth tracking each of them down.
rdar://
57630879
David Blaikie [Thu, 5 Dec 2019 20:45:13 +0000 (12:45 -0800)]
DebugInfo: Fix LTO+DWARFv5 loclists
The loclists_table_base was being overwritten for each CU even though
only one loclists contribution is made so everything but the last CU
would have a label that was never defined and fail to assemble.
Adrian Prantl [Thu, 5 Dec 2019 20:26:16 +0000 (12:26 -0800)]
Debug Info: Assert that location is available for cleanups
rdar://
57630879
Differential Revision: https://reviews.llvm.org/D71042
Adrian Prantl [Thu, 5 Dec 2019 19:25:46 +0000 (11:25 -0800)]
Set a source location for Objective-C accessor stubs
even when there is no explicit synthesize statement.
This fixes a regression introduced in https://reviews.llvm.org/D68108
that could lead to missing debug locations in cleanup code in
synthesized Objective-C++ properties.
rdar://
57630879
Differential Revision: https://reviews.llvm.org/D71084
Jon Chesterfield [Thu, 5 Dec 2019 20:34:14 +0000 (20:34 +0000)]
[libomptarget][nfc] Move omptarget-nvptx under common
Summary:
[libomptarget][nfc] Move omptarget-nvptx under common
Almost all files depend on require omptarget-nvptx, which no longer
contains any obviously architecture dependent code. Moving it under
common unblocks task/loop for amdgcn, and allows moving other code.
At some point there should probably be a widespread symbol renaming to
replace the nvptx string. I'd prefer to get things working first.
Building this (and task.cu, loop.cu) without a cuda library requires
some more refactoring, e.g. wrap threadfence(), use DEVICE macro more
consistently. Patches for that are orthogonal and will be posted shortly.
Reviewers: jdoerfert, ABataev, grokos
Reviewed By: ABataev
Subscribers: mgorny, fedor.sergeev, jfb, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D71073
David Tenty [Thu, 5 Dec 2019 20:21:53 +0000 (15:21 -0500)]
[AIX] Make sure to use QualNames for external global objects
Summary: Previously we only handled the case where the csect hadn't been set up yet, so we'd hit an assert later on.
Reviewers: jasonliu, DiggerLin, stevewan
Reviewed By: jasonliu
Subscribers: hubert.reinterpretcast, wuzish, nemanjai, hiraditya, kbarton, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71032
Aaron Ballman [Thu, 5 Dec 2019 20:12:01 +0000 (15:12 -0500)]
Add documentation headings for the OpenCL attributes.
This fixes the documentation build.
cchen [Thu, 5 Dec 2019 18:43:48 +0000 (13:43 -0500)]
[OpenMP50] Add parallel master construct
Reviewers: ABataev, jdoerfert
Reviewed By: ABataev
Subscribers: rnk, jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70726
Amy Huang [Wed, 4 Dec 2019 22:47:05 +0000 (14:47 -0800)]
Use diff -b on zlib tests so they pass on Windows
Reviewers: hubert.reinterpretcast
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71036
Nathan Ridge [Thu, 5 Dec 2019 19:28:56 +0000 (14:28 -0500)]
[clangd] Highlighting dependent types in more contexts
Fixes https://github.com/clangd/clangd/issues/214.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70746
Nathan Ridge [Thu, 5 Dec 2019 19:27:23 +0000 (14:27 -0500)]
[clangd] Find reference to template parameter in 'sizeof...' expression
Fixes https://github.com/clangd/clangd/issues/213.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70740
Florian Hahn [Thu, 5 Dec 2019 19:29:21 +0000 (19:29 +0000)]
Revert "[DSE] Fix for a dangling point bug in DeadStoreElimination."
The commit causes a failure:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/20911
This reverts commit
1847fd9d85506ecee692230cb2500e3774ec628e.
Evgenii Stepanov [Mon, 25 Nov 2019 23:45:17 +0000 (15:45 -0800)]
LowerDbgDeclare: look through bitcasts.
Summary:
Emit a value debug intrinsic (with OP_deref) when an alloca address is
passed to a function call after going through a bitcast.
This generates an FP or SP-relative location for the local variable in
the following case:
int x;
use((void *)&x;
Reviewers: aprantl, vsk, pcc
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70752
Peter Collingbourne [Thu, 5 Dec 2019 18:41:37 +0000 (10:41 -0800)]
scudo: Fix one of the C wrapper tests on Android.
The test ScudoWrappersCTest.Realloc expects realloc of memalign to work on
Android, but this relies on dealloc_type_mismatch being set to false. Commit
0d3d4d3b0 caused us to start setting it to true in the C wrapper tests,
which broke the test. Set it to the correct value on Android.
Differential Revision: https://reviews.llvm.org/D71078
Peter Collingbourne [Tue, 19 Nov 2019 23:22:09 +0000 (15:22 -0800)]
scudo: Fix the build of wrappers_c_test.cpp on Android.
The Android headers don't provide a declaration of valloc or pvalloc, so we
need to declare them ourselves.
Differential Revision: https://reviews.llvm.org/D71077
Volkan Keles [Thu, 5 Dec 2019 19:09:50 +0000 (11:09 -0800)]
[GlobalISel] Localizer: Allow targets not to run the pass conditionally
Summary:
Previously, it was not possible to skip running the localizer pass
conditionally. This patch adds an input function to the pass which
decides if the pass should run on the given MachineFunction or not.
No test case as there is no upstream target needs this functionality.
Reviewers: qcolombet
Reviewed By: qcolombet
Subscribers: rovka, hiraditya, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71038
Craig Topper [Thu, 5 Dec 2019 18:24:10 +0000 (10:24 -0800)]
[X86] Remove ProcIntelGLM/ProcIntelGLP/ProcIntelTRM and replace them with a single feature flag covers the two places they were used.
Differential Revision: https://reviews.llvm.org/D71048
Bob Haarman [Tue, 3 Dec 2019 01:23:54 +0000 (17:23 -0800)]
Revert "[InstCombine] keep assumption before sinking calls"
Summary:
This reverts commit
c3b06d0c393e533eab712922911d14e5a079fa5d.
Reason for revert: Caused miscompiles when inserting assume for undef.
Also adds a test to prevent similar breakage in future.
Fixes PR44154.
Reviewers: rnk, jdoerfert, efriedma, xbolva00
Reviewed By: rnk
Subscribers: thakis, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70933
Alexey Bataev [Thu, 5 Dec 2019 18:22:15 +0000 (13:22 -0500)]
[OPENMP50]Add support for if clause for simd part in distribute parallel for simd directive.
According to OpenMP 5.0, the if clause can be applied to simd
subdirective in the combined directives.
Roman Lebedev [Thu, 5 Dec 2019 17:44:22 +0000 (20:44 +0300)]
[InstCombine] Invert `add A, sext(B) --> sub A, zext(B)` canonicalization (to `sub A, zext B -> add A, sext B`)
Summary:
D68408 proposes to greatly improve our negation sinking abilities.
But in current canonicalization, we produce `sub A, zext(B)`,
which we will consider non-canonical and try to sink that negation,
undoing the existing canonicalization.
So unless we explicitly stop producing previous canonicalization,
we will have two conflicting folds, and will end up endlessly looping.
This inverts canonicalization, and adds back the obvious fold
that we'd miss:
* `sub [nsw] Op0, sext/zext (bool Y) -> add [nsw] Op0, zext/sext (bool Y)`
https://rise4fun.com/Alive/xx4
* `sext(bool) + C -> bool ? C - 1 : C`
https://rise4fun.com/Alive/fBl
It is obvious that `@ossfuzz_9880()` / `@lshr_out_of_range()`/`@ashr_out_of_range()`
(oss-fuzz 4871) are no longer folded as much, though those aren't really worrying.
Reviewers: spatel, efriedma, t.p.northover, hfinkel
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71064
Fangrui Song [Mon, 2 Dec 2019 22:20:42 +0000 (14:20 -0800)]
[ELF][PPC64] Support long branch thunks with addends
Fixes PPC64 part of PR40438
// clang -target ppc64le -c a.cc
// .text.unlikely may be placed in a separate output section (via -z keep-text-section-prefix)
// The distance between bar in .text.unlikely and foo in .text may be larger than 32MiB.
static void foo() {}
__attribute__((section(".text.unlikely"))) static int bar() { foo(); return 0; }
__attribute__((used)) static int dummy = bar();
This patch makes such thunks with addends work for PPC64.
AArch64: .text -> `__AArch64ADRPThunk_ (adrp x16, ...; add x16, x16, ...; br x16)` -> target
PPC64: .text -> `__long_branch_ (addis 12, 2, ...; ld 12, ...(12); mtctr 12; bctr)` -> target
AArch64 can leverage ADRP to jump to the target directly, but PPC64
needs to load an address from .branch_lt . Before Power ISA v3.0, the
PC-relative ADDPCIS was not available. .branch_lt was invented to work
around the limitation.
Symbol::ppc64BranchltIndex is replaced by
PPC64LongBranchTargetSection::entry_index which take addends into
consideration.
The tests are rewritten: ppc64-long-branch.s tests -no-pie and
ppc64-long-branch-pi.s tests -pie and -shared.
Reviewed By: sfertile
Differential Revision: https://reviews.llvm.org/D70937
Sanne Wouda [Thu, 5 Dec 2019 18:09:08 +0000 (18:09 +0000)]
[AArch64] Fix MUL/SUB fusing
Summary:
When MUL is the first operand to SUB, we can't use MLS because the accumulator
should be negated. Emit a NEG of the accumulator and an MLA instead, similar to
what we do for FMUL / FSUB fusing.
Reviewers: dmgreen, SjoerdMeijer, fhahn, Gerolf, mstorsjo, asbirlea
Reviewed By: asbirlea
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71067
shafik [Thu, 5 Dec 2019 17:28:08 +0000 (09:28 -0800)]
[LLDB] Replacing use of ul suffix in GetMaxU64Bitfield since it not guarenteed to be 64 bit
GetMaxU64Bitfield(...) uses the ul suffix but we require a 64 bit unsigned integer and ul could be 32 bit. So this replacing it with a explicit cast and refactors the code around it to use an early exit.
Differential Revision: https://reviews.llvm.org/D70992
Puyan Lotfi [Thu, 28 Nov 2019 21:43:56 +0000 (16:43 -0500)]
[llvm] llvm-ifs: Support for handling empty IFS and merging weak+strong symbols.
The following changes enable llvm-ifs to handle the following merge conflicts:
* Weak + Strong symbol merging for the same symbol
* empty vs non-empty triple field
* empty vs non-empty object file format
Differential Revision: https://reviews.llvm.org/D70834
Ankit [Thu, 5 Dec 2019 17:43:04 +0000 (17:43 +0000)]
[DSE] Fix for a dangling point bug in DeadStoreElimination.
The patch makes sure that the LastThrowing pointer does not point to any instruction deleted by call to DeleteDeadInstruction.
While iterating through the instructions the pass maintains a pointer to the lastThrowing Instruction. A call to deleteDeadInstruction deletes a dead store and other instructions feeding the original dead instruction which also become dead. The instruction pointed by the lastThrowing pointer could also be deleted by the call to DeleteDeadInstruction and thus it becomes a dangling pointer. Because of this, we see an error in the next iteration.
In the patch, we maintain a list of throwing instructions encountered previously and use the last non deleted throwing instruction from the container.
Patch by Ankit <quic_aankit@quicinc.com>
Reviewers: fhahn, bcahoon, efriedma
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D65326
Fangrui Song [Mon, 2 Dec 2019 23:31:11 +0000 (15:31 -0800)]
[ELF][PPC64] Don't copy ppc64BranchltIndex in replaceWithDefined
replaceWithDefined is used by canonical PLT and copy relocations, which
imply that the symbol is preemptable. ppc64BranchltIndex is only used by
non-preemptable cases, and it can only be the default value in
replaceWithDefined.
Gabor Horvath [Thu, 5 Dec 2019 17:00:16 +0000 (09:00 -0800)]
[scan-build-py] Set of small fixes
* Unhandled exceptions
* Typos
Differential Revision: https://reviews.llvm.org/D70693
Balázs Kéri [Thu, 5 Dec 2019 15:21:21 +0000 (16:21 +0100)]
[ASTImporter] Various source location and range import fixes.
Summary:
ASTImporter contained wrong or missing imports of SourceLocation
and SourceRange for some objects. At least a part of such errors
is fixed now.
Source location import fixes in namespace, enum, record,
class template specialization declarations and DeclRefExpr,
UnresolvedLookupExpr, UnresolvedMemberExpr, NestedNameSpecifierLoc.
Reviewers: martong, a.sidorin, shafik
Reviewed By: shafik
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60499
Alexey Bataev [Thu, 5 Dec 2019 16:31:45 +0000 (11:31 -0500)]
[OPENMP50]Add support for if clause for simd part in parallel master taskloop simd directive.
According to OpenMP 5.0, the if clause can be applied to simd
subdirective in the combined directives.
Scott Linder [Tue, 3 Dec 2019 22:18:21 +0000 (17:18 -0500)]
[AMDGPU][HIP] Improve opt-level handling
Summary:
The HIP toolchain invokes `llc` without an explicit opt-level, meaning
it always uses the default (-O2). This makes it impossible to use -O1,
for example. The HIP toolchain also coerces -Os/-Oz to -O2 even when
invoking opt, and it coerces -Og to -O2 rather than -O1.
Forward the opt-level to `llc` as well as `opt`, and only coerce levels
where it is required.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70987
Sanjay Patel [Thu, 5 Dec 2019 16:12:44 +0000 (11:12 -0500)]
[InstCombine] narrow select with FP casts
Select doesn't change values, so truncate of extended operand cancels out.
Sanjay Patel [Thu, 5 Dec 2019 15:50:43 +0000 (10:50 -0500)]
[InstCombine] add FMF guard to builder in fptrunc transform; NFC
This makes no difference currently because we don't apply FMF
to FP casts, but that may change.
This could also be a place to add a fold for select with fptrunc,
so it will make that patch easier/smaller.
Jeremy Morse [Thu, 5 Dec 2019 15:12:25 +0000 (15:12 +0000)]
[DebugInfo] Don't create multiple DBG_VALUEs when sinking
This patch addresses a performance problem reported in PR43855, and
present in the reapplication in in
001574938e5. It turns out that
MachineSink will (often) move instructions to the first block that
post-dominates the current block, and then try to sink further. This
means if we have a lot of conditionals, we can needlessly create large
numbers of DBG_VALUEs, one in each block the sunk instruction passes
through.
To fix this, rather than immediately sinking DBG_VALUEs, record them in
a pass structure. When sinking is complete and instructions won't be
sunk any further, new DBG_VALUEs are added, avoiding lots of
intermediate DBG_VALUE $noregs being created.
Differential revision: https://reviews.llvm.org/D70676
Jeremy Morse [Thu, 5 Dec 2019 15:03:33 +0000 (15:03 +0000)]
[DebugInfo] Don't reorder DBG_VALUEs when sunk
Fix part of PR43855, resolving a problem that comes from the reapplication
in
001574938e5. If we have two DBG_VALUE insts in a block that specify
the location of the same variable, for example:
%0 = someinst
DBG_VALUE %0, !123, !DIExpression()
%1 = anotherinst
DBG_VALUE %1, !123, !DIExpression()
if %0 were to sink, the corresponding DBG_VALUE would sink too, past the
next DBG_VALUE, effectively re-ordering assignments. To fix this, I've
added a SeenDbgVars set recording what variable locations have been seen in
a block already (working bottom up), and now flag DBG_VALUEs that would
pass a later DBG_VALUE for the same variable.
NB, this only works for repeated DBG_VALUEs in the same basic block, the
general case involving control flow is much harder, which I've written
up in PR44117.
Differential revision: https://reviews.llvm.org/D70672
Jeremy Morse [Thu, 5 Dec 2019 14:46:11 +0000 (14:46 +0000)]
[DebugInfo] Re-apply two patches to MachineSink
These were:
* D58386 /
f5e1b718a67 / reverted in
d382a8a768b
* D58238 /
ee50590e168 / reverted in
a8db456b53a
Of which the latter has a performance regression tracked in PR43855,
fixed by D70672 / D70676, which will be committed atomically with this
reapplication.
Contains a minor difference to account for a change in the IsCopyInstr
signature.
Sanjay Patel [Thu, 5 Dec 2019 14:55:56 +0000 (09:55 -0500)]
[InstCombine] add tests for fpext+select+fptrunc; NFC
Alexey Bataev [Thu, 5 Dec 2019 15:44:07 +0000 (10:44 -0500)]
[OPENMP][DOCS]Update list of the supported features, NFC.
Ilya Biryukov [Thu, 5 Dec 2019 15:12:28 +0000 (16:12 +0100)]
[Syntax] Show input code on tests failures. NFC
Alexey Bataev [Thu, 5 Dec 2019 14:50:18 +0000 (09:50 -0500)]
[OPENMP50]Add support for if clause for simd part in master taskloop simd directive.
According to OpenMP 5.0, the if clause can be applied to simd
subdirective in the combined directives.
Danilo Carvalho Grael [Thu, 5 Dec 2019 13:07:02 +0000 (08:07 -0500)]
[AArch64][SVE] Integer reduction instructions pattern/intrinsics.
Added pattern matching/intrinsics for the following SVE instructions:
-- saddv, uaddv
-- smaxv, sminv, umaxv, uminv
-- orv, eorv, andv
Haojian Wu [Thu, 5 Dec 2019 14:30:04 +0000 (15:30 +0100)]
[clangd] Simplify the code, NFC.
AST.getASTContext().getSourceManager() => AST.getSourceManager().
LLVM GN Syncbot [Thu, 5 Dec 2019 14:23:58 +0000 (14:23 +0000)]
gn build: Merge
7f93cb62280
Sam Parker [Thu, 5 Dec 2019 14:19:44 +0000 (14:19 +0000)]
[ARM] Enable TypePromotion by default
ARMCodeGenPrepare has already been generalized and renamed to
TypePromotion. We've had it enabled and tested downstream for a
while, so enable it by default.
Differential Revision: https://reviews.llvm.org/D70998
Haojian Wu [Fri, 29 Nov 2019 12:05:42 +0000 (13:05 +0100)]
[AST] Traverse the class type loc inside the member type loc.
Summary:
We are missing this currently.
This would fix https://github.com/clangd/clangd/issues/216.
Reviewers: ilya-biryukov
Subscribers: mgorny, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70849
Raphael Isemann [Thu, 5 Dec 2019 13:41:09 +0000 (14:41 +0100)]
[lldb][NFC] Move Address and AddressRange functions out of Stream and let them take raw_ostream
Summary:
Yet another step on the long road towards getting rid of lldb's Stream class.
We probably should just make this some kind of member of Address/AddressRange, but it seems quite often we just push
in random integers in there and this is just about getting rid of Stream and not improving arbitrary APIs.
I had to rename another `DumpAddress` function in FormatEntity that is dumping the content of an address to make Clang happy.
Reviewers: labath
Reviewed By: labath
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71052
Hans Wennborg [Wed, 4 Dec 2019 14:19:21 +0000 (15:19 +0100)]
Also check /Fo when deciding on the .gcna / .gcda filename (PR44208)
Differential revision: https://reviews.llvm.org/D71012
Roman Lebedev [Thu, 5 Dec 2019 12:10:25 +0000 (15:10 +0300)]
[InstCombine] Extend `0 - (X sdiv C) -> (X sdiv -C)` fold to non-splat vectors
Split off from https://reviews.llvm.org/D68408
Victor Lomuller [Tue, 25 Jun 2019 12:57:48 +0000 (13:57 +0100)]
[AST] Enable expression of OpenCL language address spaces an attribute
Summary:
Enable a way to set OpenCL language address space using attributes
in addition to existing keywords.
Signed-off-by: Victor Lomuller victor@codeplay.com
Reviewers: aaron.ballman, Anastasia
Subscribers: yaxunl, ebevhan, cfe-commits, Naghasan
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71005
Signed-off-by: Alexey Bader <alexey.bader@intel.com>
Pavel Labath [Wed, 4 Dec 2019 15:06:44 +0000 (16:06 +0100)]
[lldb/DWARF] Switch to llvm debug_rnglists parser
Summary:
Our rnglist support was working only for the trivial cases (one CU),
because we only ever parsed one contribution out of the debug_rnglists
section. This means we were never able to resolve range lists for the
second and subsequent units (DW_FORM_sec_offset references came out
blang, and DW_FORM_rnglistx references always used the ranges lists from
the first unit).
Since both llvm and lldb rnglist parsers are sufficiently
self-contained, and operate similarly, we can fix this problem by
switching to the llvm parser instead. Besides the changes which are due
to variations in the interface, the main thing is that now the range
list object is a member of the DWARFUnit, instead of the entire symbol
file. This ensures that each unit can get it's own private set of range
list indices, and is consistent with how llvm's DWARFUnit does it
(overall, I've tried to structure the code the same way as the llvm
version).
I've also added a test case for the two unit scenario.
Reviewers: JDevlieghere, aprantl, clayborg
Subscribers: dblaikie, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71021
Melanie Blower [Wed, 4 Dec 2019 20:23:46 +0000 (12:23 -0800)]
Reapply
af57dbf12e54 "Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="
Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048
The original patch is modified to set the strictfp IR attribute
explicitly in CodeGen instead of as a side effect of IRBuilder.
In the 2nd attempt to reapply there was a windows lit test fail, the
tests were fixed to use wildcard matching.
Differential Revision: https://reviews.llvm.org/D62731