Sanjay Patel [Thu, 8 Mar 2018 15:46:38 +0000 (15:46 +0000)]
[InstCombine] regenerate checks; NFC
We may not need any of these tests after rL327012, but leaving
them here for now until that's confirmed.
llvm-svn: 327014
Pavel Labath [Thu, 8 Mar 2018 15:41:13 +0000 (15:41 +0000)]
[LLDB][PPC64] Fix single step and LldbGdbServer tests
Summary:
On PPC64, the tested functions were being entered through their local entry point, while the tests expected the program to stop at the function start address, that, for PPC64, corresponds to the global entry point.
To fix the issue, the test program was modified to call the functions to be tested through function pointers, which, on PPC64, force the calls through the global entry point, while not affecting the test on other platforms.
Reviewers: clayborg, labath
Reviewed By: labath
Subscribers: alexandreyy, lbianc
Differential Revision: https://reviews.llvm.org/D43768
Patch by Leandro Lupori <leandro.lupori@gmail.com>.
llvm-svn: 327013
Sanjay Patel [Thu, 8 Mar 2018 15:39:39 +0000 (15:39 +0000)]
[InstSimplify] add more tests for FP undef; NFC
llvm-svn: 327012
Pavel Labath [Thu, 8 Mar 2018 15:34:42 +0000 (15:34 +0000)]
DWARFVerifier: Basic verification of .debug_names
Summary:
This patch adds basic .debug_names verification capabilities to the
DWARF verifier. Right now, it checks that the headers and abbreviation
tables of the individual name indexes can be parsed correctly, it
verifies the buckets table and the cross-checks the CU lists for
consistency. I intend to add further checks in follow-up patches.
Reviewers: JDevlieghere, aprantl, probinson, dblaikie
Subscribers: vleschuk, echristo, clayborg, llvm-commits
Differential Revision: https://reviews.llvm.org/D44211
llvm-svn: 327011
Andrea Di Biagio [Thu, 8 Mar 2018 15:34:38 +0000 (15:34 +0000)]
[llvm-mca] Emit the 'Instruction Info' table before the resource pressure view.
In future, both the summary information and the 'instruction info' table should
be moved into a separate "Summary" view.
llvm-svn: 327010
Eric Liu [Thu, 8 Mar 2018 15:28:42 +0000 (15:28 +0000)]
[clangd:vscode] Resolve symlinks for file paths from clangd.
Summary:
For features like go-to-definition, clangd can point clients to symlink paths
(e.g. in bazel execroot) which might not be desired if the symlink points to a
file in the workspace. Clangd might not be able to build the file, and users
might prefer to edit the file on the real path.
This change converts file paths from clangd to real path (e.g. resolving symlinks).
Long term, we might want to the symlink handling logic to clangd where clangd
can better decide whether symlinks should be resolved according to e.g. compile
commands.
Reviewers: sammccall
Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits
Differential Revision: https://reviews.llvm.org/D44158
llvm-svn: 327009
Alexey Bataev [Thu, 8 Mar 2018 15:24:08 +0000 (15:24 +0000)]
[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
using.
We may emit the code in wrong order because of incorrect implementation
of the runtime functions for task reductions. Threadprivate storages may
be initialized after real initialization of the reduction items. Patch
fixes this problem.
llvm-svn: 327008
Michal Gorny [Thu, 8 Mar 2018 15:09:38 +0000 (15:09 +0000)]
[cmake] Append -Wl,-rpath-link conditionally to GNULD
Append -Wl,-rpath-link conditionally to whether GNU ld.bfd is used
rather than the Linux+!gold conditionals. Also move it out of 'else'
branch of *BSD handling. This fixes build failures with ld.bfd
on Gentoo/FreeBSD, and should cause no harm on other systems using
ld.bfd.
This patch improves the original logic by reusing results of linker
detection introduced in r307852.
Differential Revision: https://reviews.llvm.org/D43751
llvm-svn: 327007
George Rimar [Thu, 8 Mar 2018 15:06:58 +0000 (15:06 +0000)]
[ELF] - Fix crash relative to SHF_LINK_ORDER sections.
Our code assumes all input sections in an output SHF_LINK_ORDER
section has SHF_LINK_ORDER flag. We do not check that and that can cause a crash.
That happens because we call
std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition);,
where compareByFilePosition predicate does not expect to see
null when calls getLinkOrderDep.
The same might happen when sections refer to non-regular sections.
Test cases demonstrate the issues, patch fixes them.
Differential revision: https://reviews.llvm.org/D44193
llvm-svn: 327006
Marshall Clow [Thu, 8 Mar 2018 15:01:50 +0000 (15:01 +0000)]
Implement LWG#2518 - Non-member swap for propagate_const should call member swap
llvm-svn: 327005
Sanjay Patel [Thu, 8 Mar 2018 14:57:08 +0000 (14:57 +0000)]
[InstCombine, NewGVN] remove FP undef from tests
I'm trying to preserve the intent of these tests by using
non-undef operands; if we fix FP undef folding these tests
will not pass.
llvm-svn: 327004
George Rimar [Thu, 8 Mar 2018 14:54:38 +0000 (14:54 +0000)]
[ELF] - Support "INSERT AFTER" statement.
This implements INSERT AFTER in a following way:
During reading scripts it collects all insert statements.
After we done and read all files it inserts statements into script commands list.
With that:
* Rest of code does know nothing about INSERT.
* Approach is straightforward and have no visible limitations.
* It is also easy to support INSERT BEFORE (was seen in clang code once).
* Should work for PR35877 and similar cases.
Cons:
* It assumes we have "main" scripts that describes sections.
Differential revision: https://reviews.llvm.org/D43468
llvm-svn: 327003
David Zarzycki [Thu, 8 Mar 2018 14:43:24 +0000 (14:43 +0000)]
[CMake] Add missing test dependency
This makes 'ninja clean ; ninja check-all' work again.
llvm-svn: 327002
Hans Wennborg [Thu, 8 Mar 2018 14:27:28 +0000 (14:27 +0000)]
[COFF] Make the DOS stub a real DOS program
It only adds a few bytes and is nice for backward compatibility.
Differential Revision: https://reviews.llvm.org/D44018
llvm-svn: 327001
Ed Maste [Thu, 8 Mar 2018 13:52:04 +0000 (13:52 +0000)]
Use ellipsis ... to indicate omitted commands
In an example like "clang -fxray-instrument .." the .. could be confused
with a literal .. (parent directory), which is used in commands like
"cmake -GNinja .."
llvm-svn: 327000
Andrea Di Biagio [Thu, 8 Mar 2018 13:43:11 +0000 (13:43 +0000)]
Add llvm-mca.rst to the table of contents in docs/CommandGuide.
This should fix the documentation error reported by builder llvm-sphinx-docs
(build #16407) after r326998.
llvm-svn: 326999
Andrea Di Biagio [Thu, 8 Mar 2018 13:05:02 +0000 (13:05 +0000)]
[llvm-mca] LLVM Machine Code Analyzer.
llvm-mca is an LLVM based performance analysis tool that can be used to
statically measure the performance of code, and to help triage potential
problems with target scheduling models.
llvm-mca uses information which is already available in LLVM (e.g. scheduling
models) to statically measure the performance of machine code in a specific cpu.
Performance is measured in terms of throughput as well as processor resource
consumption. The tool currently works for processors with an out-of-order
backend, for which there is a scheduling model available in LLVM.
The main goal of this tool is not just to predict the performance of the code
when run on the target, but also help with diagnosing potential performance
issues.
Given an assembly code sequence, llvm-mca estimates the IPC (instructions per
cycle), as well as hardware resources pressure. The analysis and reporting style
were mostly inspired by the IACA tool from Intel.
This patch is related to the RFC on llvm-dev visible at this link:
http://lists.llvm.org/pipermail/llvm-dev/2018-March/121490.html
Differential Revision: https://reviews.llvm.org/D43951
llvm-svn: 326998
Krasimir Georgiev [Thu, 8 Mar 2018 11:29:27 +0000 (11:29 +0000)]
[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings
Summary:
This makes the formatter of raw string literals use NestedBlockIndent for
determining the 0 column of the content inside. This makes the formatting use
less horizonal space and fixes a case where two newlines before and after the
raw string prefix were selected instead of a single newline after it:
Before:
```
aaaa = ffff(
R"pb(
key: value)pb");
```
After:
```
aaaa = ffff(R"pb(
key: value)pb");
```
Reviewers: djasper, sammccall
Reviewed By: sammccall
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44141
llvm-svn: 326996
James Henderson [Thu, 8 Mar 2018 10:53:34 +0000 (10:53 +0000)]
[DWARF] Don't attempt to parse line tables at invalid offsets
Whilst working on improvements to the error handling of the debug line
parsing code, I noticed that if an invalid offset were to be specified
in a call to getOrParseLineTable(), an entry in the LineTableMap would
still be created, even if the offset was not within the section range.
The immediate parsing attempt afterwards would fail (it would end up
getting a version of 0), and thereafter, any subsequent calls to
getOrParseLineTable or getLineTable would return the default-
constructed, invalid line table. In reality, we shouldn't even attempt
to parse this table, and we should always return a nullptr from these
two functions for this situation.
I have tested this via a unit test, which required some new framework
for unit testing debug line. My plan is to add quite a few more unit
tests for the new error reporting mechanism that will follow shortly,
hence the reason why the supporting code for the tests are written the
way they are - I intend to extend the DwarfGenerator class to support
generating debug line. At that point, I'll make sure that there are a
few positive test cases for this and the parsing code too.
Differential Revision: https://reviews.llvm.org/D44200
Reviewers: JDevlieghere, aprantl
llvm-svn: 326995
Jonas Devlieghere [Thu, 8 Mar 2018 10:39:12 +0000 (10:39 +0000)]
[dsymutil] Embed toolchain in dSYM bundle
Allow us to embed the (Xcode) toolchain in the dSYM bundle's property
list.
Differential revision: https://reviews.llvm.org/D44151
llvm-svn: 326994
Andrea Di Biagio [Thu, 8 Mar 2018 10:38:45 +0000 (10:38 +0000)]
[MCSchedule] Always generate processor resource names.
With this patch, the tablegen 'SubtargetEmitter' always generates processor
resource names.
The impact of this patch on the code size of other llvm tools is small. I have
observed an average increase of 0.03% in code size when doing a release build of
LLVM (on windows, using MSVC) with all the default backends.
This change is done in preparation for the upcoming llvm-mca patch.
llvm-svn: 326993
Craig Topper [Thu, 8 Mar 2018 08:02:52 +0000 (08:02 +0000)]
[X86] Change X86::PMULDQ/PMULUDQ opcodes to take vXi64 type as input instead of vXi32.
This instruction can be thought of as reading either the even elements of a vXi32 input or the lower half of each element of a vXi64 input. We currently use the vXi32 interpretation, but vXi64 matches better with its broadcast behavior in EVEX.
I'm looking at moving MULDQ/MULUDQ creation to a DAG combine so we can do it when AVX512DQ is enabled without having to go through Custom lowering. But in some of the test cases we failed to use a broadcast load due to the size difference. This should help with that.
I'm also wondering if we can model these instructions in native IR and remove the intrinsics and I think using a vXi64 type will work better with that.
llvm-svn: 326991
Stephan Bergmann [Thu, 8 Mar 2018 07:34:40 +0000 (07:34 +0000)]
Propagate DLLAttr to friend re-declarations of member functions
...that have already been constructed (e.g., in inner classes) while parsing the
class definition. They would otherwise lack any DLLAttr inherited from the
class, which are only set here (called from Sema::CheckCompletedClass) after the
class definition has been parsed completely.
Differential revision: https://reviews.llvm.org/D16632
llvm-svn: 326990
Tony Tye [Thu, 8 Mar 2018 05:46:01 +0000 (05:46 +0000)]
[AMDGPU] Update AMDGOUUsage.rst descriptions
- Improve description of XNACK ELF flag.
- Rename all uses of wave to wavefront to be consistent.
Differential Revision: https://reviews.llvm.org/D43983
llvm-svn: 326989
George Burgess IV [Thu, 8 Mar 2018 05:32:30 +0000 (05:32 +0000)]
[CodeGen] Emit lifetime.ends in both EH and non-EH blocks
Before this, we'd only emit lifetime.ends for these temps in
non-exceptional paths. This potentially made our stack larger than it
needed to be for any code that follows an EH cleanup. e.g. in
```
struct Foo { char cs[32]; };
void escape(void *);
struct Bar { ~Bar() { char cs[64]; escape(cs); } };
Foo getFoo();
void baz() {
Bar b;
getFoo();
}
```
baz() would require 96 bytes of stack, since the temporary from getFoo()
only had a lifetime.end on the non-exceptional path.
This also makes us keep hold of the Value* returned by
EmitLifetimeStart, so we don't have to remake it later.
llvm-svn: 326988
Eugene Zemtsov [Thu, 8 Mar 2018 04:34:22 +0000 (04:34 +0000)]
Build LLVMDemangle from build_symbolizer.sh
Symbolizer now depends on internal implementation of itaniumDemangle.
llvm-svn: 326987
Heejin Ahn [Thu, 8 Mar 2018 04:06:57 +0000 (04:06 +0000)]
[WebAssembly] Add except_ref as a first-class type
Summary:
Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].
Companion to D43706.
Reviewers: sbc100
Subscribers: jfb, dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D43707
llvm-svn: 326986
Heejin Ahn [Thu, 8 Mar 2018 04:05:37 +0000 (04:05 +0000)]
[WebAssembly] Add except_ref as a first-class type
Summary: Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].
Reviewers: dschuff
Subscribers: jfb, sbc100, llvm-commits
Differential Revision: https://reviews.llvm.org/D43706
llvm-svn: 326985
Heejin Ahn [Thu, 8 Mar 2018 03:47:52 +0000 (03:47 +0000)]
[WebAssembly] Add IntrNoReturn property to throw/rethrow intrinsics
Reviewers: dschuff
Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D43740
llvm-svn: 326984
Eugene Zemtsov [Thu, 8 Mar 2018 02:57:54 +0000 (02:57 +0000)]
Add Demangle lib into internalization list
Symbolizer now depends on internal implementation of itaniumDemangle.
llvm-svn: 326983
George Karpenkov [Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)]
[analyzer] Correctly model iteration through "nil" objects
Previously, iteration through nil objects which resulted from
objc-messages being set to nil were modeled incorrectly.
There are a couple of notes about this patch:
In principle, ExprEngineObjC might be left untouched IFF osx.loops
checker is enabled.
I however think that we should not do something
completely incorrect depending on what checkers are left on.
We should evaluate and potentially remove altogether the isConsumedExpr
performance heuristic, as it seems very fragile.
rdar://
22205149
Differential Revision: https://reviews.llvm.org/D44178
llvm-svn: 326982
Daniel Sanders [Thu, 8 Mar 2018 02:36:25 +0000 (02:36 +0000)]
Support resetting STATISTIC() values using llvm::ResetStatistics()
Summary:
Most of the time, compiler statistics can be obtained using a process that
performs a single compilation and terminates such as llc. However, this isn't
always the case. JITs for example, perform multiple compilations over their
lifetime and STATISTIC() will record cumulative values across all of them.
Provide tools like this with the facilities needed to measure individual
compilations by allowing them to reset the STATISTIC() values back to zero using
llvm::ResetStatistics(). It's still the tools responsibility to ensure that they
perform compilations in such a way that the results are meaningful to their
intended use.
Reviewers: qcolombet, rtereshin, bogner, aditya_nandakumar
Reviewed By: bogner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44181
llvm-svn: 326981
George Burgess IV [Thu, 8 Mar 2018 02:15:12 +0000 (02:15 +0000)]
Fix an unused variable warning; NFC
llvm-svn: 326980
Eugene Zelenko [Thu, 8 Mar 2018 01:37:39 +0000 (01:37 +0000)]
[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.
llvm-svn: 326979
Fangrui Song [Thu, 8 Mar 2018 01:28:45 +0000 (01:28 +0000)]
Add attributes and fix some keywords in llvm-mode.el
Reviewers: rafael, echristo
Reviewed By: echristo
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44135
llvm-svn: 326978
Rui Ueyama [Thu, 8 Mar 2018 01:22:30 +0000 (01:22 +0000)]
Return early. NFC.
We don't need to handle an object file having more than one symbol table,
so as soon as we find the first one, we can process it and then return
from the function.
llvm-svn: 326977
Sam Clegg [Thu, 8 Mar 2018 01:16:05 +0000 (01:16 +0000)]
[WebAssembly] Honor --allow-undefined even for explicit exports
When a symbol is exported via --export=foo but --allow-undefined
is also specified, the symbol is now allowed to be undefined.
Previously we were special casing such symbols.
This combinations of behavior is exactly what emescripten
requires. Although we are trying hard not to allow emscripten
specific features in lld, this one makes sense.
Enforce this behavior by added this case to test/wasm/undefined.ll.
Differential Revision: https://reviews.llvm.org/D44237
llvm-svn: 326976
Bob Haarman [Thu, 8 Mar 2018 01:13:10 +0000 (01:13 +0000)]
Revert "[LTO] Support filtering by hotness threshold"
This reverts commit
1f3bd185c53beb6aa68446974b7e80837abd6ef0 (r326107)
because it fails
ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll.
llvm-svn: 326975
Reid Kleckner [Thu, 8 Mar 2018 01:12:22 +0000 (01:12 +0000)]
Revert "[Sema] Make getCurFunction() return null outside function parsing"
This reverts r326965. It seems to have caused repeating test failures in
clang/test/Sema/diagnose_if.c on some buildbots.
I cannot reproduce the problem, and it's not immediately obvious what
the problem is, so let's revert to green.
llvm-svn: 326974
Richard Smith [Thu, 8 Mar 2018 01:07:33 +0000 (01:07 +0000)]
When substituting previously-checked template arguments into a template
template parameter that is an expanded parameter pack, only substitute into the
current slice, not the entire pack.
This reduces the checking of N template template arguments for an expanded
parameter pack containing N parameters from quadratic time to linear time in
the length of the pack. This is important because one (and possibly the only?)
general technique for splitting a template parameter pack in linear time
depends on doing this.
llvm-svn: 326973
Rui Ueyama [Thu, 8 Mar 2018 01:05:58 +0000 (01:05 +0000)]
Simplify LazyobjFile and readElfSymbols.
addElfSymbols and readJustSymbolsFile still has duplicate code, but
I didn't come up with a good idea to eliminate them. Since this patch
is an improvement, I'm sending this for review.
Differential Revision: https://reviews.llvm.org/D44187
llvm-svn: 326972
Reid Kleckner [Thu, 8 Mar 2018 00:55:09 +0000 (00:55 +0000)]
[MS] Pass CVRU qualifiers properly in Itanium mangler
We already have a mangling for the __unaligned qualifier, we just have
to call Qualifiers::getFromCVRUMask instead of getFromCVRMask.
PR36638
llvm-svn: 326971
Rafael Auler [Thu, 8 Mar 2018 00:46:53 +0000 (00:46 +0000)]
Reland "[DebugInfo] Support DWARF expressions in eh_frame"
Summary:
Original change was D43313 (r326932) and reverted by r326953 because it
broke an LLD test and a windows build. The LLD test was already fixed in
lld commit r326944 (thanks maskray). This is the original change with
the windows build fixed.
llvm-svn: 326970
Weiming Zhao [Thu, 8 Mar 2018 00:28:25 +0000 (00:28 +0000)]
[AArch64] Fix UB about shift amount exceeds data bit-width
Summary:
Fixes an UB caught by sanitizer. The shift amount might be larger than 32 so the operand should be 1ULL.
In this patch, we replace the original expression with existing API with uint64_t type.
Reviewers: eli.friedman, rengolin
Reviewed By: rengolin
Subscribers: rengolin, javed.absar, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D44234
llvm-svn: 326969
George Burgess IV [Thu, 8 Mar 2018 00:22:04 +0000 (00:22 +0000)]
Fix a doc typo; NFC
llvm-svn: 326968
Craig Topper [Thu, 8 Mar 2018 00:21:17 +0000 (00:21 +0000)]
[X86] Fix some isel patterns that used aligned vector load instructions with unaligned predicates.
These patterns weren't checking the alignment of the load, but were using the aligned instructions. This will cause a GP fault if the data isn't aligned.
I believe these were introduced in r312450.
llvm-svn: 326967
Rafael Espindola [Thu, 8 Mar 2018 00:17:13 +0000 (00:17 +0000)]
Delete code that is probably dead since r249303.
With r249303 the expression evaluation should expand variables that
are not in sections (and so don't have an atom).
llvm-svn: 326966
Reid Kleckner [Thu, 8 Mar 2018 00:14:34 +0000 (00:14 +0000)]
[Sema] Make getCurFunction() return null outside function parsing
Summary:
Before this patch, Sema pre-allocated a FunctionScopeInfo and kept it in
the first, always present element of the FunctionScopes stack. This
meant that Sema::getCurFunction would return a pointer to this
pre-allocated object when parsing code outside a function body. This is
pretty much always a bug, so this patch moves the pre-allocated object
into a separate unique_ptr. This should make bugs like PR36536 a lot
more obvious.
As you can see from this patch, there were a number of places that
unconditionally assumed they were always called inside a function.
However, there are also many places that null checked the result of
getCurFunction(), so I think this is a reasonable direction.
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44039
llvm-svn: 326965
Eugene Zemtsov [Thu, 8 Mar 2018 00:07:26 +0000 (00:07 +0000)]
Fix build broken by r326959
Adding Demangle to link time dependencies of Symbolize
llvm-svn: 326964
Simon Pilgrim [Wed, 7 Mar 2018 23:56:42 +0000 (23:56 +0000)]
[X86][SSE] LowerBUILD_VECTORAsVariablePermute - reorder permute types. NFCI.
Reorder into 128/256/512 bit vector size groupings.
NFCI commit before some new features.
llvm-svn: 326963
Reid Kleckner [Wed, 7 Mar 2018 23:26:02 +0000 (23:26 +0000)]
[MS] Accept __unaligned as a qualifier on member function pointers
We need to treat __unaligned like the other 'cvr' qualifiers when it
appears at the end of a function prototype. We weren't doing that in
some tentative parsing.
Fixes PR36638.
llvm-svn: 326962
Rafael Espindola [Wed, 7 Mar 2018 23:18:06 +0000 (23:18 +0000)]
Set dso_local on tls init functions.
We copy the visibility, so copying the dso_local flag seems the
natural thing to do.
llvm-svn: 326961
Nico Weber [Wed, 7 Mar 2018 23:15:20 +0000 (23:15 +0000)]
[ms] Emit vtordisp initializers in a deterministic order.
No effective behavior change, just for cleanliness.
Analysis and typing by me, actual patch mostly by Reid.
Fixes PR36159.
https://reviews.llvm.org/D44223
llvm-svn: 326960
Eugene Zemtsov [Wed, 7 Mar 2018 23:07:34 +0000 (23:07 +0000)]
Use itaniumDemangle in llvm-symbolizer
Currently on Windows (_MSC_VER) LLVMSymbolizer supports only Microsoft mangling.
This fix just explicitly uses itaniumDemangle when mangled name starts with _Z.
Differential Revision: https://reviews.llvm.org/D44192
llvm-svn: 326959
Marshall Clow [Wed, 7 Mar 2018 22:51:16 +0000 (22:51 +0000)]
Include <system_error> since we use it. Thanks to Andrey Maksimov for the catch.
llvm-svn: 326958
Reid Kleckner [Wed, 7 Mar 2018 22:48:35 +0000 (22:48 +0000)]
Avoid including ScopeInfo.h from Sema.h
Summary:
This provides no measurable build speedup, but it reinstates an
optimization from r112038 that was lost in r179618. It requires moving
CapturedScopeInfo::Capture out to clang::sema, which might be too
general since we have plenty of other Capture records in BlockDecl and
other AST nodes.
Reviewers: rjmccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44221
llvm-svn: 326957
Sanjay Patel [Wed, 7 Mar 2018 22:43:08 +0000 (22:43 +0000)]
[TTI] add explanatory comments for getArithmeticInstrCost; NFC
llvm-svn: 326956
Evandro Menezes [Wed, 7 Mar 2018 22:35:32 +0000 (22:35 +0000)]
[AArch64] Adjust the cost of integer vector division
Since there is no instruction for integer vector division, factor in the
cost of singling out each element to be used with the scalar division
instruction.
Differential revision: https://reviews.llvm.org/D43974
llvm-svn: 326955
Eugene Zelenko [Wed, 7 Mar 2018 22:30:50 +0000 (22:30 +0000)]
[Documentation] Fix Clang-tidy checks list broken in r326909.
llvm-svn: 326954
Rui Ueyama [Wed, 7 Mar 2018 22:29:48 +0000 (22:29 +0000)]
Revert r326932: [DebugInfo] Support DWARF expressions in eh_frame
This reverts commit rr326932 because it broke lld/test/ELF/eh-frame-hdr-augmentation.s.
llvm-svn: 326953
George Karpenkov [Wed, 7 Mar 2018 22:20:39 +0000 (22:20 +0000)]
[analyzer] [PointerArithChecker] do not warn on indexes into vector types
rdar://
35041502
Differential Revision: https://reviews.llvm.org/D44172
llvm-svn: 326952
George Karpenkov [Wed, 7 Mar 2018 22:20:35 +0000 (22:20 +0000)]
[analyzer] Don't crash with assertion failure on structured bindings
Proper modeling still remains to be done.
Note that BindingDecl#getHoldingVar() is almost always null, and this
should probably be handled by dealing with DecompositionDecl beforehand.
rdar://
36852163
Differential Revision: https://reviews.llvm.org/D44183
llvm-svn: 326951
Gheorghe-Teodor Bercea [Wed, 7 Mar 2018 22:10:10 +0000 (22:10 +0000)]
[OpenMP] Remove implicit data sharing using device shared memory from libomptarget
Summary:
This patch reverts the changes to libomptarget that were coupled with the changes to Clang code gen for data sharing using shared memory. A similar patch exists for Clang: D43625
Shared memory is meant to be used as an optimization on top of a more general scheme. So far we didn't have a global memory implementation ready so shared memory was a solution which applied to the current level of OpenMP complexity supported by trunk on GPU devices (due to the missing NVPTX backend patch this functionality has never been exercised). Now that we have a global memory solution this patch is "in the way" and needs to be removed (for now). This patch (or an equivalent version of it) will be put out for review once the global memory scheme is in place.
Reviewers: ABataev, grokos, carlo.bertolli, caomhin
Reviewed By: grokos
Subscribers: Hahnfeld, guansong, openmp-commits
Differential Revision: https://reviews.llvm.org/D43626
llvm-svn: 326950
Sebastian Pop [Wed, 7 Mar 2018 22:07:13 +0000 (22:07 +0000)]
[AArch64] add missing pattern for insert_subvector undef
The attached testcase started failing after the patch to define
isExtractSubvectorCheap with the following pattern mismatch:
ISEL: Starting pattern match
Initial Opcode index to 85068
Match failed at index 85076
LLVM ERROR: Cannot select: t47: v8i16 = insert_subvector undef:v8i16, t43, Constant:i64<0>
The code generated from llvm/lib/Target/AArch64/AArch64InstrInfo.td
def : Pat<(insert_subvector undef, (v4i16 FPR64:$src), (i32 0)),
(INSERT_SUBREG (v8i16 (IMPLICIT_DEF)), FPR64:$src, dsub)>;
is in ninja/lib/Target/AArch64/AArch64GenDAGISel.inc
At the location of the error it is:
/* 85076*/ OPC_CheckChild2Type, MVT::i32,
And it failed to match the type of operand 2.
Adding another def-pat for i64 fixes the failed def-pat error:
def : Pat<(insert_subvector undef, (v4i16 FPR64:$src), (i64 0)),
(INSERT_SUBREG (v8i16 (IMPLICIT_DEF)), FPR64:$src, dsub)>;
llvm-svn: 326949
Gheorghe-Teodor Bercea [Wed, 7 Mar 2018 21:59:50 +0000 (21:59 +0000)]
[OpenMP] Remove implicit data sharing code gen that aims to use device shared memory
Summary: Remove this scheme for now since it will be covered by another more generic scheme using global memory. This code will be worked into an optimization for the generic data sharing scheme. Removing this completely and then adding it via future patches will make all future data sharing patches cleaner.
Reviewers: ABataev, carlo.bertolli, caomhin
Reviewed By: ABataev
Subscribers: jholewinski, guansong, cfe-commits
Differential Revision: https://reviews.llvm.org/D43625
llvm-svn: 326948
Simon Marchi [Wed, 7 Mar 2018 21:47:25 +0000 (21:47 +0000)]
[clangd] Remove unused field in HandlerRegisterer
Summary: Tested by rebuilding.
Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D44213
llvm-svn: 326947
Yaxun Liu [Wed, 7 Mar 2018 21:45:40 +0000 (21:45 +0000)]
CodeGen: Fix address space of indirect function argument
The indirect function argument is in alloca address space in LLVM IR. However,
during Clang codegen for C++, the address space of indirect function argument
should match its address space in the source code, i.e., default addr space, even
for indirect argument. This is because destructor of the indirect argument may
be called in the caller function, and address of the indirect argument may be
taken, in either case the indirect function argument is expected to be in default
addr space, not the alloca address space.
Therefore, the indirect function argument should be mapped to the temp var
casted to default address space. The caller will cast it to alloca addr space
when passing it to the callee. In the callee, the argument is also casted to the
default address space and used.
CallArg is refactored to facilitate this fix.
Differential Revision: https://reviews.llvm.org/D34367
llvm-svn: 326946
Krasimir Georgiev [Wed, 7 Mar 2018 21:30:38 +0000 (21:30 +0000)]
[clang-format] Break consecutive string literals in text protos
Summary:
This patch fixes a bug where consecutive string literals in text protos were
put on the same line.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44204
llvm-svn: 326945
Fangrui Song [Wed, 7 Mar 2018 21:25:58 +0000 (21:25 +0000)]
[ELF] Update test/ELF/eh-frame-hdr-augmentation.s
llvm-svn: 326944
Zachary Turner [Wed, 7 Mar 2018 21:22:10 +0000 (21:22 +0000)]
Revert "Write a hash of the executable into the PE timestamp fields."
This is breaking a couple of tests, so I'm reverting temporarily
until I can get everything resolved properly.
llvm-svn: 326943
Matthew Voss [Wed, 7 Mar 2018 20:48:16 +0000 (20:48 +0000)]
Correct the alignment for the PS4 target
https://reviews.llvm.org/D44218
llvm-svn: 326942
Jake Ehrlich [Wed, 7 Mar 2018 20:33:02 +0000 (20:33 +0000)]
Revert "[llvm-objcopy] Add support for large indexes"
Not all build bots have unzip which I used in a test.
This reverts commit
0b1f26d39ea42dd3716b525fbc8c78d8c7bb4479.
llvm-svn: 326941
Jake Ehrlich [Wed, 7 Mar 2018 19:59:15 +0000 (19:59 +0000)]
[llvm-objcopy] Add support for large indexes
Because of -ffunction-sections (and maybe other use cases I'm not aware of?) it
can occur that we need more than 0xfeff sections but ELF dosn't support that
many sections. To solve this problem SHN_XINDEX exists and with it come a whole
host of changes for section indexes everywhere. This change adds support for
those cases which should allow llvm-objcopy to copy binaries that have an
arbitrary number of sections.
Differential Revision: https://reviews.llvm.org/D42516
llvm-svn: 326940
Craig Topper [Wed, 7 Mar 2018 19:45:45 +0000 (19:45 +0000)]
[X86] Remove unused function argument. NFC
llvm-svn: 326939
Vitaly Buka [Wed, 7 Mar 2018 19:43:50 +0000 (19:43 +0000)]
[sanitizer] Fix SANITIZER_INTERCEPT_MMAP and SANITIZER_INTERCEPT_MMAP64 values
llvm-svn: 326938
Yaxun Liu [Wed, 7 Mar 2018 19:32:58 +0000 (19:32 +0000)]
[OpenCL] Remove block invoke function from emitted block literal struct
OpenCL runtime tracks the invoke function emitted for
any block expression. Due to restrictions on blocks in
OpenCL (v2.0 s6.12.5), it is always possible to know the
block invoke function when emitting call of block expression
or __enqueue_kernel builtin functions. Since __enqueu_kernel
already has an argument for the invoke function, it is redundant
to have invoke function member in the llvm block literal structure.
This patch removes invoke function from the llvm block literal
structure. It also removes the bitcast of block invoke function
to the generic block literal type which is useless for OpenCL.
This will save some space for the kernel argument, and also
eliminate some store instructions.
Differential Revision: https://reviews.llvm.org/D43783
llvm-svn: 326937
Daniel Sanders [Wed, 7 Mar 2018 19:32:36 +0000 (19:32 +0000)]
Fix cmake's multi-config generators after r326738
LLVM_ENABLE_STATS isn't known at configure-time in these generators so we must
defer it to build-time.
llvm-svn: 326936
George Karpenkov [Wed, 7 Mar 2018 19:27:32 +0000 (19:27 +0000)]
[analyzer] [NFC] Minor refactoring of NonNullParamChecker
Differential Revision: https://reviews.llvm.org/D43917
llvm-svn: 326935
Rui Ueyama [Wed, 7 Mar 2018 19:25:36 +0000 (19:25 +0000)]
Use exact uint32_t for uint32_t ELF field. NFC.
llvm-svn: 326934
Rui Ueyama [Wed, 7 Mar 2018 19:25:27 +0000 (19:25 +0000)]
Initialize a member in C++11 style. NFC.
llvm-svn: 326933
Rafael Auler [Wed, 7 Mar 2018 19:19:51 +0000 (19:19 +0000)]
[DebugInfo] Support DWARF expressions in eh_frame
This patch enhances DWARFDebugFrame with the capability of parsing and
printing DWARF expressions in CFI instructions. It also makes FDEs and
CIEs accessible to lib users, so they can process them in client tools
that rely on LLVM. To make it self-contained with a test case, it
teaches llvm-readobj to be able to dump EH frames and checks they are
correct in a unit test. The llvm-readobj code is Maksim Panchenko's work
(maksfb).
Reviewers: JDevlieghere, espindola
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D43313
llvm-svn: 326932
Matt Morehouse [Wed, 7 Mar 2018 19:18:14 +0000 (19:18 +0000)]
[lld] Attempt to appease buildbot.
r326903 broke the conflict-debug-variable.s test.
llvm-svn: 326931
Simon Pilgrim [Wed, 7 Mar 2018 19:14:05 +0000 (19:14 +0000)]
[X86][SSE] Regenerate float maxnum/minnum tests
llvm-svn: 326930
Zachary Turner [Wed, 7 Mar 2018 19:12:36 +0000 (19:12 +0000)]
Fix a bug regarding a mis-identified file type in pdbutil.
llvm-svn: 326929
Yan Zhang [Wed, 7 Mar 2018 18:59:25 +0000 (18:59 +0000)]
do not register matcher for objc-only checks when analyzing non-objc sources to save resources
Summary: I did not put lang opt check in AvoidSpinlockCheck since OSSpinLock is not objc specific. We won't want to skip it when analyzing some C++ target used by other ObjC sources.
Reviewers: hokein, benhamilton
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44174
llvm-svn: 326928
Zachary Turner [Wed, 7 Mar 2018 18:58:33 +0000 (18:58 +0000)]
Update a few switch statements to handle file_magic::pdb.
This fixes a couple of warnings.
llvm-svn: 326927
Reid Kleckner [Wed, 7 Mar 2018 18:55:10 +0000 (18:55 +0000)]
Push a function scope when parsing function bodies without a declaration
Summary:
This is PR36536.
There are a few ways to reach Sema::ActOnStartOfFunctionDef with a null
Decl. Currently, the parser continues on to attempt to parse the
statements in the function body without pushing a function scope or
declaration context. However, lots of statement parsing logic relies on
getCurFunction() returning something reasonable. It turns out that
getCurFunction() will never return null today because of an optimization
where Sema pre-allocates one FunctionScopeInfo and reuses it when
possible. This goes wrong when something inside the function body causes
us to push another function scope, such as requiring an implicit
definition of a special member function. Reusing the state clears it
out, which will lead to bugs. In PR36536, we found that the SwitchStack
gets unbalanced, because we push a switch, clear out the stack, and then
try to pop a switch that isn't there.
As a follow-up, I plan to move the pre-allocated FunctionScopeInfo out
of the FunctionScopes stack. This means the FunctionScopes stack will
often be empty, and callers of getCurFunction() will need to check for
null.
Reviewers: thakis
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43980
llvm-svn: 326926
Roorda, Jan-Willem [Wed, 7 Mar 2018 18:53:36 +0000 (18:53 +0000)]
[Pipeliner] Fixed node order issue related to zero latency edges
Summary:
A desired property of the node order in Swing Modulo Scheduling is
that for nodes outside circuits the following holds: none of them is
scheduled after both a successor and a predecessor. We call
node orders that meet this property valid.
Although invalid node orders do not lead to the generation of incorrect
code, they can cause the pipeliner not being able to find a pipelined schedule
for arbitrary II. The reason is that after scheduling the successor and the
predecessor of a node, no room may be left to schedule the node itself.
For data flow graphs with 0-latency edges, the node ordering algorithm
of Swing Modulo Scheduling can generate such undesired invalid node orders.
This patch fixes that.
In the remainder of this commit message, I will give an example
demonstrating the issue, explain the fix, and explain how the the fix is tested.
Consider, as an example, the following data flow graph with all
edge latencies 0 and all edges pointing downward.
```
n0
/ \
n1 n3
\ /
n2
|
n4
```
Consider the implemented node order algorithm in top-down mode. In that mode,
the algorithm orders the nodes based on greatest Height and in case of equal
Height on lowest Movability. Finally, in case of equal Height and
Movability, given two nodes with an edge between them, the algorithm prefers
the source-node.
In the graph, for every node, the Height and Movability are equal to 0.
As will be explained below, the algorithm can generate the order n0, n1, n2, n3, n4.
So, node n3 is scheduled after its predecessor n0 and after its successor n2.
The reason that the algorithm can put node n2 in the order before node n3,
even though they have an edge between them in which node n3 is the source,
is the following: Suppose the algorithm has constructed the partial node
order n0, n1. Then, the nodes left to be ordered are nodes n2, n3, and n4. Suppose
that the while-loop in the implemented algorithm considers the nodes in
the order n4, n3, n2. The algorithm will start with node n4, and look for
more preferable nodes. First, node n4 will be compared with node n3. As the nodes
have equal Height and Movability and have no edge between them, the algorithm
will stick with node n4. Then node n4 is compared with node n2. Again the
Height and Movability are equal. But, this time, there is an edge between
the two nodes, and the algorithm will prefer the source node n2.
As there are no nodes left to compare, the algorithm will add node n2 to
the node order, yielding the partial node order n0, n1, n2. In this way node n2
arrives in the node-order before node n3.
To solve this, this patch introduces the ZeroLatencyHeight (ZLH) property
for nodes. It is defined as the maximum unweighted length of a path from the
given node to an arbitrary node in which each edge has latency 0.
So, ZLH(n0)=3, ZLH(n1)=ZLH(n3)=2, ZLH(n2)=1, and ZLH(n4)=0
In this patch, the preference for a greater ZeroLatencyHeight
is added in the top-down mode of the node ordering algorithm, after the
preference for a greater Height, and before the preference for a
lower Movability.
Therefore, the two allowed node-orders are n0, n1, n3, n2, n4 and n0, n3, n1, n2, n4.
Both of them are valid node orders.
In the same way, the bottom-up mode of the node ordering algorithm is adapted
by introducing the ZeroLatencyDepth property for nodes.
The patch is tested by adding extra checks to the following existing
lit-tests:
test/CodeGen/Hexagon/SUnit-boundary-prob.ll
test/CodeGen/Hexagon/frame-offset-overflow.ll
test/CodeGen/Hexagon/vect/vect-shuffle.ll
Before this patch, the pipeliner failed to pipeline the loops in these tests
due to invalid node-orders. After the patch, the pipeliner successfully
pipelines all these loops.
Reviewers: bcahoon
Reviewed By: bcahoon
Subscribers: Ayal, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D43620
llvm-svn: 326925
Zachary Turner [Wed, 7 Mar 2018 18:40:41 +0000 (18:40 +0000)]
Teach identify_file_magic to identify PDB files.
llvm-svn: 326924
Stefan Pintilie [Wed, 7 Mar 2018 18:27:10 +0000 (18:27 +0000)]
[PowerPC] Move test to correct location.
Test was added in r326906 to an incorrect location.
Moving the test to PPC CodeGen directory as the test is PPC specific.
llvm-svn: 326923
Alexey Bataev [Wed, 7 Mar 2018 18:17:06 +0000 (18:17 +0000)]
[OPENMP] Fix lifetime of the loop counters.
We may emit incorrect lifetime info during codegen for loop counters in
OpenMP constructs because of automatic scope cleanup when we needed
temporarily locations for private loop counters.
llvm-svn: 326922
Petr Hosek [Wed, 7 Mar 2018 18:14:09 +0000 (18:14 +0000)]
[Fuzzer] Avoid the unnecessary rebuild of the custom libc++
This changes the add_custom_libcxx macro to resemble the
llvm_ExternalProject_Add. The primary motivation is to avoid
unnecessary libFuzzer rebuilds that are being done on every
Ninja/Make invocation. The libc++ should be only rebuilt whenever
the libc++ source itself changes.
Differential Revision: https://reviews.llvm.org/D43213
llvm-svn: 326921
Zachary Turner [Wed, 7 Mar 2018 18:13:41 +0000 (18:13 +0000)]
Write a hash of the executable into the PE timestamp fields.
Windows tools treats the timestamp fields as sort of a build id,
using it to archive executables on a symbol server, as well as
for matching executables to PDBs. We were writing 0 for these
fields, which would cause symbol servers to break as they are
indexed in the symbol server based on this value.
Although the field is called timestamp, it can really be any
value that is unique per build, so to support reproducible builds
we use a hash of the executable here.
Differential Revision: https://reviews.llvm.org/D43978
llvm-svn: 326920
Davide Italiano [Wed, 7 Mar 2018 18:06:12 +0000 (18:06 +0000)]
[lldbtestsuite] llvm-objcopy is now required to run the lit tests.
There's now a test using llvm-objcopy in lit/.
This doesn't fail on the bot(s) because `llvm-objcopy` is probably
already available there, but if you get a fresh checkout and run
`ninja check-lldb` you'll observe the failure as it's not tracking
the dependency correctly. This fixes the problem on my machine,
and probably everywhere else.
llvm-svn: 326919
George Rimar [Wed, 7 Mar 2018 17:54:25 +0000 (17:54 +0000)]
[ELF] - Adjust rangeToString to report ranges in a different format.
It was raised during the review of D43819.
LLD usually use [X, Y] for reporting ranges, like below:
"relocation R_386_16 out of range: 65536 is not in [0, 65535]"
Patch changes rangeToString() to do the same.
Differential revision: https://reviews.llvm.org/D44207
llvm-svn: 326918
Craig Topper [Wed, 7 Mar 2018 17:53:18 +0000 (17:53 +0000)]
[X86] Make the MUL->VPMADDWD work before op legalization on AVX1 targets. Simplify feature checks by using isTypeLegal.
The v8i32 conversion on AVX1 targets was only working after LowerMUL splits 256-bit vectors.
While I was there I've also made it so we don't have to check for AVX2 and BWI directly and instead just ask if the type is legal.
Differential Revision: https://reviews.llvm.org/D44190
llvm-svn: 326917
Craig Topper [Wed, 7 Mar 2018 17:53:16 +0000 (17:53 +0000)]
[Support] Stop passing StringRefs by const reference in some of the getHostCPUname implementations. NFC
llvm-svn: 326916
Krzysztof Parzyszek [Wed, 7 Mar 2018 17:27:18 +0000 (17:27 +0000)]
[Hexagon] Rewrite non-HVX unaligned loads as pairs of aligned ones
This is a follow-up to r325169, this time for all types, not just HVX
vector types.
Disable this by default, since it's not always safe.
llvm-svn: 326915
Rui Ueyama [Wed, 7 Mar 2018 17:24:46 +0000 (17:24 +0000)]
Revert r326911: Improve --warn-symbol-ordering.
This reverts commit r326911 because it was committed by accident.
llvm-svn: 326914
Sanjay Patel [Wed, 7 Mar 2018 17:18:22 +0000 (17:18 +0000)]
[LangRef] fix formatting in FP descriptions; NFC
This is a clean-up step to reduce diffs ahead of real
changes to the FP semantics as discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2018-February/121444.html
llvm-svn: 326913