Alina Sbirlea [Thu, 21 Dec 2017 21:41:53 +0000 (21:41 +0000)]
[ModRefInfo] Add must alias info to ModRefInfo.
Summary:
Add an additional bit to ModRefInfo, ModRefInfo::Must, to be cleared for known must aliases.
Shift existing Mod/Ref/ModRef values to include an additional most
significant bit. Update wrappers that modify ModRefInfo values to
reflect the change.
Notes:
* ModRefInfo::Must is almost entirely cleared in the AAResults methods, the remaining changes are trying to preserve it.
* Only some small changes to make custom AA passes set ModRefInfo::Must (BasicAA).
* GlobalsModRef already declares a bit, who's meaning overlaps with the most significant bit in ModRefInfo (MayReadAnyGlobal). No changes to shift the value of MayReadAnyGlobal (see AlignedMap). FunctionInfo.getModRef() ajusts most significant bit so correctness is preserved, but the Must info is lost.
* There are cases where the ModRefInfo::Must is not set, e.g. 2 calls that only read will return ModRefInfo::NoModRef, though they may read from exactly the same location.
Reviewers: dberlin, hfinkel, george.burgess.iv
Subscribers: llvm-commits, sanjoy
Differential Revision: https://reviews.llvm.org/D38862
llvm-svn: 321309
Sam Clegg [Thu, 21 Dec 2017 21:15:00 +0000 (21:15 +0000)]
[WebAssembly] Add extra test for weak global symbols
Summary:
Currently the test only checks behaviour for weak function symbols.
Should be good to merge straight away?
Reviewers: sbc100
Reviewed By: sbc100
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D41449
llvm-svn: 321308
Volodymyr Sapsai [Thu, 21 Dec 2017 20:52:59 +0000 (20:52 +0000)]
Revert "[CodeGen] Fix crash when a function taking transparent union is redeclared."
This reverts commit r321296. It caused performance regressions
FAIL: imp.execution_time
FAIL: 2007-01-04-KNR-Args.execution_time
FAIL: sse_expandfft.execution_time
FAIL: sse_stepfft.execution_time
llvm-svn: 321306
Petr Hosek [Thu, 21 Dec 2017 20:51:16 +0000 (20:51 +0000)]
[sanitizer] Make function declarations C-compatible
The public sanitizer headers are intended to be usable from either
C++ or C, but they declare no-argument functions with the syntax that
is not a proper prototype declaration in C. This goes unnoticed until
someone uses -Wsystem-headers.
Patch By: mcgrathr
Reviewers: phosek, vitalybuka
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D41475
llvm-svn: 321305
Richard Smith [Thu, 21 Dec 2017 20:50:39 +0000 (20:50 +0000)]
Don't produce redundant parentheses warning for "A (::B);" and the like.
The parentheses here are not redundant as they affect the binding of the
'::' token.
llvm-svn: 321304
Craig Topper [Thu, 21 Dec 2017 20:45:13 +0000 (20:45 +0000)]
[X86] When lowering truncates to vXi1, don't sign extend i16/i8 types to 512-bit if we have VLX.
This should only affect what we do for v8i16. Previously we went to v8i64, but if we have VLX we only need v8i32. This prevents an unnecessary zmm usage.
llvm-svn: 321303
Sam McCall [Thu, 21 Dec 2017 20:11:46 +0000 (20:11 +0000)]
[clangd] Don't re-hash SymbolID in maps, just use the SHA1 data
llvm-svn: 321302
Abderrazek Zaafrani [Thu, 21 Dec 2017 20:10:03 +0000 (20:10 +0000)]
[AArch64] Enable fp16 data type for the Builtin for AArch64 only.
Differential Revision: https:://reviews.llvm.org/D41360
llvm-svn: 321301
Petr Hosek [Thu, 21 Dec 2017 20:04:10 +0000 (20:04 +0000)]
[CMake] Allow passing extra CMake arguments to custom libc++
This can be used to customize the libc++ build.
Differential Revision: https://reviews.llvm.org/D41103
llvm-svn: 321299
Reid Kleckner [Thu, 21 Dec 2017 19:44:23 +0000 (19:44 +0000)]
Revert "Fix for PR32990"
This reverts commit r321239. It broke the Chromium DLL build:
[8834/50217] LINK(DLL) icui18n.dll icui18n.dll.lib icui18n.dll.pdb
FAILED: icui18n.dll icui18n.dll.lib icui18n.dll.pdb
zrule.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: void __cdecl icu_60::UnicodeString::`vbase destructor'(void)"
(__imp_??_DUnicodeString@icu_60@@QEAAXXZ)
llvm-svn: 321298
Richard Smith [Thu, 21 Dec 2017 19:43:39 +0000 (19:43 +0000)]
When instantiating a deduction guide, transform its name.
Otherwise it will serve as a deduction guide for the wrong class template.
llvm-svn: 321297
Volodymyr Sapsai [Thu, 21 Dec 2017 19:42:37 +0000 (19:42 +0000)]
[CodeGen] Fix crash when a function taking transparent union is redeclared.
When a function taking transparent union is declared as taking one of
union members earlier in the translation unit, clang would hit an
"Invalid cast" assertion during EmitFunctionProlog. This case
corresponds to function f1 in test/CodeGen/transparent-union-redecl.c.
We decided to cast i32 to union because after merging function
declarations function parameter type becomes int,
CGFunctionInfo::ArgInfo type matches with ABIArgInfo type, so we decide
it is a trivial case. But these types should also be castable to
parameter declaration type which is not the case here.
The fix is in checking for the trivial case if ABIArgInfo type matches with
parameter declaration type. It exposed inconsistency that we check
hasScalarEvaluationKind for different types in EmitParmDecl and
EmitFunctionProlog, and comment says they should match.
Additional tests in Sema/transparent-union.c capture current behavior and make
sure there are no regressions.
rdar://problem/
34949329
Reviewers: rjmccall, rafael
Reviewed By: rjmccall
Subscribers: aemerson, cfe-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D41311
llvm-svn: 321296
Wolfgang Pieb [Thu, 21 Dec 2017 19:38:13 +0000 (19:38 +0000)]
[DWARF v5] Rework of string offsets table reader
Reorganizes the DWARF consumer to derive the string offsets table
contribution's format from the contribution header instead of
(incorrectly) from the unit's format.
Reviewers: JDevliegehere, aprantl
Differential Revision: https://reviews.llvm.org/D41146
llvm-svn: 321295
Abderrazek Zaafrani [Thu, 21 Dec 2017 19:20:01 +0000 (19:20 +0000)]
[AARch64] Add ARMv8.2-A FP16 vector intrinsics
Putting back the code that was reverted few weeks ago.
Differential Revision: https://reviews.llvm.org/D34161
llvm-svn: 321294
Simon Dardis [Thu, 21 Dec 2017 19:01:32 +0000 (19:01 +0000)]
Revert "[mips][compiler-rt] Provide 64bit atomic add and sub"
This reverts commit r321260. It appears to have broken the sanitizer
bot sanitizer-ppc64be-linux.
http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/5029
Reverting to see if the buildbot turns green.
llvm-svn: 321292
Craig Topper [Thu, 21 Dec 2017 18:44:06 +0000 (18:44 +0000)]
[X86] Promote v8i1 shuffles to v8i32 instead of v8i64 if we have VLX.
We should have equally good shuffle options for v8i32 with VLX. This was spotted during my attempts to remove 512-bit vectors from SKX.
We still use 512-bits for v16i1, v32i1, and v64i1. I'm less sure we can handle those well with narrower vectors. i32 and i64 element sizes get the best shuffle support.
llvm-svn: 321291
Artem Dergachev [Thu, 21 Dec 2017 18:43:02 +0000 (18:43 +0000)]
[analyzer] Fix zero-initialization of stack VLAs under ObjC ARC.
Using ARC, strong, weak, and autoreleasing stack variables are implicitly
initialized with nil. This includes variable-length arrays of Objective-C object
pointers. However, in the analyzer we don't zero-initialize them. We used to,
but it accidentally regressed after r289618.
Under ARC, the array variable's initializer within DeclStmt is an
ImplicitValueInitExpr. Environment doesn't maintain any bindings for this
expression kind - instead it always knows that it's a known constant
(0 in our case), so it just returns the known value by calling
SValBuilder::makeZeroVal() (see EnvironmentManager::getSVal().
Commit r289618 had introduced reasonable behavior of SValBuilder::makeZeroVal()
for the arrays, which produces a zero-length compoundVal{}. When such value
is bound to arrays, in RegionStoreManager::bindArray() "remaining" items in the
array are default-initialized with zero, as in
RegionStoreManager::setImplicitDefaultValue(). The similar mechanism works when
an array is initialized by an initializer list that is too short, eg.
int a[3] = { 1, 2 };
would result in a[2] initialized with 0. However, in case of variable-length
arrays it didn't know if any more items need to be added,
because, well, the length is variable.
Add the default binding anyway, regardless of how many actually need
to be added. We don't really care how many, because the default binding covers
the whole array anyway.
Differential Revision: https://reviews.llvm.org/D41478
rdar://problem/
35477763
llvm-svn: 321290
Simon Pilgrim [Thu, 21 Dec 2017 18:12:31 +0000 (18:12 +0000)]
[X86][SSE] Split large PAVGB/PAVGW vectors to legal widths
Patch to allow detectAVGPattern handle vectors larger than the legal size (128 SSE2, 256 AVX2, 512 AVX512BW), splitting the vectors accordingly.
Differential Revision: https://reviews.llvm.org/D41440
llvm-svn: 321288
Benjamin Kramer [Thu, 21 Dec 2017 17:51:35 +0000 (17:51 +0000)]
[clangd] Fix use after free.
Found by asan.
llvm-svn: 321286
Aleksei Sidorin [Thu, 21 Dec 2017 17:41:06 +0000 (17:41 +0000)]
[ASTImporterTest] Add mandatory testing with '-fdelayed-template-parsing'
* While running ASTImporterTests, we often forget about Windows MSVC
buildbots which enable '-fdelayed-template-parsing' by default.
This leads to AST import errors because templates are not parsed
and corresponding parts of AST are not built so importer cannot import them.
It takes both reviewing time to find such issues and post-commit time
to fix unexpected buildbot failures. To solve this issue, we enable testing
with '-fdelayed-template-parsing' option enabled by default in addition
to testing with default compiler options. This allows us to catch
the problem during development.
Differential Revision: https://reviews.llvm.org/D41444
llvm-svn: 321285
Francis Visoiu Mistrih [Thu, 21 Dec 2017 17:14:13 +0000 (17:14 +0000)]
[YAML] Refactor escaping unittests
llvm-svn: 321284
Francis Visoiu Mistrih [Thu, 21 Dec 2017 17:14:09 +0000 (17:14 +0000)]
[YAML] Fix UTF-8 handling
Previous YAML quoting patches broke UTF-8 printing in YAML: see https://reviews.llvm.org/D41290#961801.
Differential Revision: https://reviews.llvm.org/D41490
llvm-svn: 321283
Krzysztof Parzyszek [Thu, 21 Dec 2017 17:12:43 +0000 (17:12 +0000)]
[TableGen] Print more helpful information in case of type contradiction
Dump the failing TreePattern.
llvm-svn: 321282
Simon Pilgrim [Thu, 21 Dec 2017 16:54:03 +0000 (16:54 +0000)]
[DAGCombiner] Remove (xor (xor x, c1), c2) -> (xor x, (xor c1, c2)) fold. NFCI.
More general cases are already handled by constant canonicalization and then the ReassociateOps call at line 5327
llvm-svn: 321280
Simon Pilgrim [Thu, 21 Dec 2017 16:34:46 +0000 (16:34 +0000)]
[DAGCombiner] Generalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2) combine to work on non-splat vectors
The knownbits_mask_or_shuffle_uitofp change is interesting - shuffle combines manage to kick in, removing the AND constant mask load. For targets with fast-variable-shuffle this should reduce further to VPOR+VPSHUFB+VCVTDQ2PS.
llvm-svn: 321279
Simon Pilgrim [Thu, 21 Dec 2017 16:08:41 +0000 (16:08 +0000)]
[X86] Add (or (and X, c1), c2) -> (and (or X, c2), c1|c2) non-splat vector test
llvm-svn: 321278
Pavel Labath [Thu, 21 Dec 2017 15:52:59 +0000 (15:52 +0000)]
Make one more test redhat-compatible
This test was also using "a" in an expression.
llvm-svn: 321277
Tony Jiang [Thu, 21 Dec 2017 15:42:50 +0000 (15:42 +0000)]
[PowerPC] Fix parest build failure in SPEC2017.
The build failure was caused by an assertion in pre-legalization DAGCombine:
Combining: t6: ppcf128 = uint_to_fp t5
... into: t20: f32 = PPCISD::FCFIDUS t19
which is clearly wrong since ppcf128 are definitely different type with f32 and
we cannot change the node value type when do DAGCombine. The fix is don't
handle ppc_fp128 or i1 conversions in PPCTargetLowering::combineFPToIntToFP and
leave it to downstream to legalize it and expand it to small legal types.
Differential Revision: https://reviews.llvm.org/D41411
llvm-svn: 321276
Simon Pilgrim [Thu, 21 Dec 2017 15:17:29 +0000 (15:17 +0000)]
[DAGCombiner] Generalize (and (or x, C), D) -> D iff (C & D) == D combine to work on non-splat vectors
llvm-svn: 321275
Simon Dardis [Thu, 21 Dec 2017 15:14:07 +0000 (15:14 +0000)]
[mips] Fix the invalid EVA test
During the review of D40362 I spotted that this test wasn't actually
testing the eva instructions due to '-mattr==eva', rather than '-mattr=+eva',
which resulted in test having no effect.
llvm-svn: 321273
Sam McCall [Thu, 21 Dec 2017 14:58:44 +0000 (14:58 +0000)]
[clangd] Index symbols share storage within a slab.
Summary:
Symbols are not self-contained - it's only safe to hand them out if you
guarantee the lifetime of the underlying data.
Before this lands, I'm going to measure the before/after memory usage of the
LLVM index loaded into memory in a single slab.
Reviewers: hokein
Subscribers: klimek, ilya-biryukov, cfe-commits
Differential Revision: https://reviews.llvm.org/D41483
llvm-svn: 321272
Pavel Labath [Thu, 21 Dec 2017 14:40:03 +0000 (14:40 +0000)]
Work around test failures on red-hat linux
Two tests were failing because the debugger was picking up multiply
defined internal symbols from the system libraries. This is a bug, as
there should be no ambiguity because the tests are defining variables
with should shadow these symbols, but lldb is not smart enough to figure
that out.
I work around the issue by renaming the variables in these tests, and in
exchange I create a self-contained test which reproduces the issue
without depending on the system libraries.
This increases the predictability of our test suite.
llvm-svn: 321271
Joachim Protze [Thu, 21 Dec 2017 14:36:36 +0000 (14:36 +0000)]
Add missing test case from D41171 commit
llvm-svn: 321270
Joachim Protze [Thu, 21 Dec 2017 14:36:30 +0000 (14:36 +0000)]
[OMPT] Add missing ompt_get_num_procs function
This function is defined in OpenMP-TR6 section 4.1.5.1.6
The functions was not implemented yet.
Since ompt-functions can only be called after the runtime was initialized and
has loaded a tool, it can assume the runtime to be initialized. In contrast
to omp_get_num_procs which needs to check whether the runtime is initialized.
Differential Revision: https://reviews.llvm.org/D40949
llvm-svn: 321269
Simon Pilgrim [Thu, 21 Dec 2017 14:33:40 +0000 (14:33 +0000)]
[X86] Add (and (or x, C), D) -> D iff (C & D) == D non-splat vector test
llvm-svn: 321268
Ilya Biryukov [Thu, 21 Dec 2017 14:05:28 +0000 (14:05 +0000)]
[clangd] Log more info about preambles
llvm-svn: 321267
Ilya Biryukov [Thu, 21 Dec 2017 14:04:39 +0000 (14:04 +0000)]
Added helper to get size of PrecompiledPreamble
llvm-svn: 321266
Joachim Protze [Thu, 21 Dec 2017 13:55:39 +0000 (13:55 +0000)]
[OMPT] Fix return address handling in a few GOMP interface methods
This revision fixes failing testcases with parallel for loops and the gomp
interface. The return address needs to be stored at entry to runtime.
The storage is cleared on usage, so we need to update the storage before
calling again internal functions, that will trigger event callbacks.
Differential Revision: https://reviews.llvm.org/D41181
llvm-svn: 321265
Joachim Protze [Thu, 21 Dec 2017 13:55:34 +0000 (13:55 +0000)]
[OMPT] Handle null pointer in set_callback to improve performance
We use the bitmap ompt_enabled thoughout the runtime, to avoid loading the
vector of callback functions when testing if specific code should be executed.
Before invoking an event callback function, the pointer is tested for NULL.
This revision resets the corresponding bit in ompt_enabled to 0 if
NULL is passed in set_callback.
Differential Revision: https://reviews.llvm.org/D41171
llvm-svn: 321264
Joachim Protze [Thu, 21 Dec 2017 13:55:29 +0000 (13:55 +0000)]
[OMPT] Use frames at different level when using clang version 5 or higher with debug flag
Clang 5 or higher adds an intermediate function call in certain cases when
compiling with debug flag. This revision updates the testcases to work
correctly.
Differential Revision: https://reviews.llvm.org/D40595
llvm-svn: 321263
Joachim Protze [Thu, 21 Dec 2017 13:55:16 +0000 (13:55 +0000)]
[OMPT] Add annotations to testcases that are expected to fail when using certain compilers
Reasons for expected failures are mainly bugs when using lables in OpenMP regions
or missing support of some OpenMP features.
For some worksharing clauses, support to distinguish the kind of workshare was
added just recently.
If an issue was fixed in a minor release version of a compiler, we flag the
test as unsupported for this compiler version to avoid false positives.
Same for fixes that where backported to older compiler versions.
Differential Revision: https://reviews.llvm.org/D40384
llvm-svn: 321262
Simon Pilgrim [Thu, 21 Dec 2017 13:18:19 +0000 (13:18 +0000)]
[X86] Add v48i8 AVG test case, based on discussion on D41440
llvm-svn: 321261
Simon Dardis [Thu, 21 Dec 2017 13:05:41 +0000 (13:05 +0000)]
[mips][compiler-rt] Provide 64bit atomic add and sub
r318733 introduced a build failure for native MIPS32 systems for xray due
to the lack of __sync_fetch_and_add / __syn_fetch_and_sub support. This patch
extends the existing support providing atomics so that xray can be
successfully built.
Reviewers: atanasyan, dberris
Differential Revision: https://reviews.llvm.org/D40385
llvm-svn: 321260
Sam Parker [Thu, 21 Dec 2017 12:55:04 +0000 (12:55 +0000)]
[DAGCombine] Improve ReduceLoadWidth for SRL
If the SRL node is only used by an AND, we may be able to set the
ExtVT to the width of the mask, making the AND redundant. To support
this, another check has been added in isLegalNarrowLoad which queries
whether the load is valid.
Differential Revision: https://reviews.llvm.org/D41350
llvm-svn: 321259
Paul Osmialowski [Thu, 21 Dec 2017 12:33:31 +0000 (12:33 +0000)]
[AArch64] add required arch specific code for running OMPT test cases
Differential Revision: https://reviews.llvm.org/D41482
llvm-svn: 321258
Pavel Labath [Thu, 21 Dec 2017 11:27:21 +0000 (11:27 +0000)]
[Support] Remove MemoryBuffer::getNewUninitMemBuffer
There is nothing useful that can be done with a read-only uninitialized
buffer without const_casting its contents to initialize it. A better
solution is to obtain a writable buffer
(WritableMemoryBuffer::getNewUninitMemBuffer), and then convert it to a
read-only buffer after initialization. All callers of this function have
already been updated to do this, so this function is now unused.
llvm-svn: 321257
Sam Parker [Thu, 21 Dec 2017 11:17:49 +0000 (11:17 +0000)]
[ARM] Armv8-R DFB instruction
Implement MC support for the Armv8-R 'Data Full Barrier' instruction.
Differential Revision: https://reviews.llvm.org/D41430
llvm-svn: 321256
Pavel Labath [Thu, 21 Dec 2017 10:54:30 +0000 (10:54 +0000)]
Make sure DataBufferLLVM contents are writable
Summary:
We sometimes need to write to the object file we've mapped into memory,
generally to apply relocations to debug info sections. We've had that
ability before, but with the introduction of DataBufferLLVM, we have
lost it, as the underlying llvm class (MemoryBuffer) only supports
read-only mappings.
This switches DataBufferLLVM to use the new llvm::WritableMemoryBuffer
class as a back-end, as this one guarantees to return a writable buffer.
This removes the need for the "Private" flag to the DataBufferLLVM
creation functions, as it was really used to mean "writable". The LLVM
function also does not have the NullTerminate flag, so I've modified our
clients to not require this feature and removed that flag as well.
Reviewers: zturner, clayborg, jingham
Subscribers: emaste, aprantl, arichardson, krytarowski, lldb-commits
Differential Revision: https://reviews.llvm.org/D40079
llvm-svn: 321255
Simon Atanasyan [Thu, 21 Dec 2017 10:46:20 +0000 (10:46 +0000)]
[llvm-readobj] Fix ambiguous call to the `printNumber`
llvm-svn: 321254
Simon Atanasyan [Thu, 21 Dec 2017 10:26:02 +0000 (10:26 +0000)]
[llvm-readobj] Support 'GNU' style for MIPS GOT/PLT dumping
This change adds `printMipsGOT` and `printMipsPLT` methods to the
`DumpStyle` class and overrides them in the `GNUStyle` and `LLVMStyle`
descendants. To pass information about GOT/PLT layout into these
methods, the `MipsGOTParser` class has been extended to hold all
necessary data.
llvm-svn: 321253
Haojian Wu [Thu, 21 Dec 2017 08:45:18 +0000 (08:45 +0000)]
[clangd] Use the clang-tools-extra as the official repo for `vscode-clangd` extension.
Summary:
Previously, we use a separate GitHub repository (https://github.com/llvm-vs-code-extensions/vscode-clangd)
for publishing `vscode-clangd` extension to marketplace.
To reduce the maintain burden, we will use the vscode extension in the
clang-tools-extra, and deprecate the one on GitHub.
Test in https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.clangd-vscode-test
Reviewers: sammccall, krasimir
Reviewed By: sammccall
Subscribers: klimek, ilya-biryukov, cfe-commits
Differential Revision: https://reviews.llvm.org/D41391
llvm-svn: 321252
Craig Topper [Thu, 21 Dec 2017 08:22:51 +0000 (08:22 +0000)]
[X86] Use PSHUFB for v32i16 shuffles before falling back to VPERMW/VPERMI2W.
PSHUFB has the ability to implicitly 0 elements which VPERMI2W can't do. So give a chance to use it first.
llvm-svn: 321251
Ivan A. Kosarev [Thu, 21 Dec 2017 08:14:16 +0000 (08:14 +0000)]
[CodeGen] Fix access sizes in new-format TBAA tags
The new format requires to specify both the type of the access
and its size. This patch fixes setting access sizes for TBAA tags
that denote accesses to structure members. This fix affects all
future TBAA metadata tests for the new format, so I guess we
don't need any special tests for this fix.
Differential Revision: https://reviews.llvm.org/D41452
llvm-svn: 321250
Craig Topper [Thu, 21 Dec 2017 07:31:30 +0000 (07:31 +0000)]
[X86] Use VPERMI2B for v16i8 shuffles if we have VBMI+VLX and would have otherwise used two PSHUFBs ORed together.
llvm-svn: 321249
Craig Topper [Thu, 21 Dec 2017 05:58:31 +0000 (05:58 +0000)]
[X86] Use VPERMB/VPERMI2B for v32i8 shuffle lowering if VBMI and VLX are supported.
llvm-svn: 321248
Craig Topper [Thu, 21 Dec 2017 03:58:31 +0000 (03:58 +0000)]
[X86] Add avx512vbmi command lines to vector-shuffle-256-v32.ll
llvm-svn: 321247
Sam Clegg [Thu, 21 Dec 2017 03:16:34 +0000 (03:16 +0000)]
[WebAssembly] Remove unneeded sub-directory
This is the only wasm def (and likely likely will be
for the foreseeable) file so no need for a sub-directory
Differential Revision: https://reviews.llvm.org/D41476
llvm-svn: 321246
Sam Clegg [Thu, 21 Dec 2017 02:43:39 +0000 (02:43 +0000)]
[WebAssmebly] Fix references to weak aliases
Corresponding LLVM change: https://reviews.llvm.org/D41472
Differential Revision: https://reviews.llvm.org/D41473
llvm-svn: 321244
Sanjoy Das [Thu, 21 Dec 2017 02:34:39 +0000 (02:34 +0000)]
Revert "Expose a TargetMachine::getTargetTransformInfo function"
This reverts commit r321234. It breaks the -DBUILD_SHARED_LIBS=ON build.
llvm-svn: 321243
Sam Clegg [Thu, 21 Dec 2017 02:30:38 +0000 (02:30 +0000)]
[WebAssembly] Fix local references to weak aliases
When weak aliases are used with in same translation
unit we need to be able to directly reference to alias
and not just the thing it is aliases. We do this by
defining both a wasm import and a wasm export in this
case that result in a single Symbol. This change is
a partial revert of rL314245. A corresponding lld
change address the previous issues we had with this.
See: https://github.com/WebAssembly/tool-conventions/issues/34
Differential Revision: https://reviews.llvm.org/D41472
llvm-svn: 321242
Sam Clegg [Thu, 21 Dec 2017 02:30:09 +0000 (02:30 +0000)]
[WebAssembly] Improve weak alias tests cases
Based on: https://github.com/WebAssembly/tool-conventions/issues/34
Currently weak-alias-overide.ll exhibits incorrect
behaviour in that call_direct() calls the wrong function.
Differential Revision: https://reviews.llvm.org/D41460
llvm-svn: 321241
Rafael Espindola [Thu, 21 Dec 2017 02:11:51 +0000 (02:11 +0000)]
Pass an InputFile to the InputSection constructor.
This simplifies toRegularSection and reduces the noise in a followup
patch.
llvm-svn: 321240
Erich Keane [Thu, 21 Dec 2017 02:07:46 +0000 (02:07 +0000)]
Fix for PR32990
This fixes the bug in https://bugs.llvm.org/show_bug.cgi?id=32990.
Patch By: zahiraam
Differential Revision: https://reviews.llvm.org/D39063
llvm-svn: 321239
Rafael Espindola [Thu, 21 Dec 2017 02:03:39 +0000 (02:03 +0000)]
Convert a few more InputFiles to references.
We use null files in sections to represent linker created sections,
so ObjFile<ELFT> is never null.
llvm-svn: 321238
Aaron Ballman [Thu, 21 Dec 2017 01:34:46 +0000 (01:34 +0000)]
Reverting a file that snuck in with r321229 by accident.
llvm-svn: 321237
Michael Zolotukhin [Thu, 21 Dec 2017 01:22:13 +0000 (01:22 +0000)]
[SimplifyCFG] Avoid quadratic on a predecessors number behavior in instruction sinking.
If a block has N predecessors, then the current algorithm will try to
sink common code to this block N times (whenever we visit a
predecessor). Every attempt to sink the common code includes going
through all predecessors, so the complexity of the algorithm becomes
O(N^2).
With this patch we try to sink common code only when we visit the block
itself. With this, the complexity goes down to O(N).
As a side effect, the moment the code is sunk is slightly different than
before (the order of simplifications has been changed), that's why I had
to adjust two tests (note that neither of the tests is supposed to test
SimplifyCFG):
* test/CodeGen/AArch64/arm64-jumptable.ll - changes in this test mimic
the changes that previous implementation of SimplifyCFG would do.
* test/CodeGen/ARM/avoid-cpsr-rmw.ll - in this test I disabled common
code sinking by a command line flag.
llvm-svn: 321236
Rafael Espindola [Thu, 21 Dec 2017 01:21:59 +0000 (01:21 +0000)]
Detemplate createCommentSection.
It was only templated so it could create a dummy section header that
was immediately parsed back.
llvm-svn: 321235
Sanjoy Das [Thu, 21 Dec 2017 01:06:58 +0000 (01:06 +0000)]
Expose a TargetMachine::getTargetTransformInfo function
Summary:
This makes the TargetMachine interface a bit simpler. We still need
the std::function in TargetIRAnalysis to avoid having to add a
dependency from Analysis to Target.
See discussion:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html
I avoided adding all of the backend owners to this review since the
change is simple, but let me know if you feel differently about this.
Reviewers: echristo, MatzeB, hfinkel
Reviewed By: hfinkel
Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits
Differential Revision: https://reviews.llvm.org/D41464
llvm-svn: 321234
Reid Kleckner [Thu, 21 Dec 2017 00:28:34 +0000 (00:28 +0000)]
Attempt to pacify 4.8.5 with makeArrayRef
llvm-svn: 321233
Vedant Kumar [Thu, 21 Dec 2017 00:10:36 +0000 (00:10 +0000)]
[ubsan] Diagnose noreturn functions which return (compiler-rt)
This is paired with the clang change: https://reviews.llvm.org/D40698
Differential Revision: https://reviews.llvm.org/D40700
llvm-svn: 321232
Vedant Kumar [Thu, 21 Dec 2017 00:10:25 +0000 (00:10 +0000)]
[ubsan] Diagnose noreturn functions which return
Diagnose 'unreachable' UB when a noreturn function returns.
1. Insert a check at the end of functions marked noreturn.
2. A decl may be marked noreturn in the caller TU, but not marked in
the TU where it's defined. To diagnose this scenario, strip away the
noreturn attribute on the callee and insert check after calls to it.
Testing: check-clang, check-ubsan, check-ubsan-minimal, D40700
rdar://
33660464
Differential Revision: https://reviews.llvm.org/D40698
llvm-svn: 321231
Vedant Kumar [Thu, 21 Dec 2017 00:10:24 +0000 (00:10 +0000)]
[Driver] Ensure no overlap between trapping & recoverable sanitizers. NFC.
This is NFC because in EmitCheck(), -fsanitize-trap=X overrides
-fsanitize-recover=X.
llvm-svn: 321230
Aaron Ballman [Wed, 20 Dec 2017 23:17:29 +0000 (23:17 +0000)]
Reverting r321223 and its follow-up commit because of failing bots due to Misc/ast-dump-color.cpp.
llvm-svn: 321229
Aaron Ballman [Wed, 20 Dec 2017 23:11:05 +0000 (23:11 +0000)]
Silence a -Wreorder warning from r321223.
llvm-svn: 321228
Matt Morehouse [Wed, 20 Dec 2017 22:29:23 +0000 (22:29 +0000)]
[clangd-fuzzer] Update ClangdLSPServer constructor call.
Build was broken by r321092.
llvm-svn: 321226
Simon Dardis [Wed, 20 Dec 2017 22:26:41 +0000 (22:26 +0000)]
[orc][cmake] Check if 8 byte atomics require libatomic for unittest
rL319838 introduced SymbolStringPool which uses 8 byte atomics for
reference counters. On systems which do not support such atomics
natively such as MIPS32, explicitly add libatomic as one of the
libraries for SymbolStringPool's unittest.
Reviewers: lhames, beanz
Differential Revision: https://reviews.llvm.org/D41010
llvm-svn: 321225
Joel Galenson [Wed, 20 Dec 2017 22:25:39 +0000 (22:25 +0000)]
[ARM] Optimize {s,u}{add,sub}.with.overflow.
The AArch64 backend contains code to optimize {s,u}{add,sub}.with.overflow during SelectionDAG. This commit ports that code to the ARM backend.
Differential revision: https://reviews.llvm.org/D35635
llvm-svn: 321224
Aaron Ballman [Wed, 20 Dec 2017 22:04:54 +0000 (22:04 +0000)]
Add a printing policy to the ASTDumper.
This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms.
llvm-svn: 321223
Alex Lorenz [Wed, 20 Dec 2017 21:03:38 +0000 (21:03 +0000)]
Fix an assertion failure regression in isDesignatorAtObjectEnd for
__builtin_object_size with incomplete array type in struct
The commit r316245 introduced a regression that causes an assertion failure when
Clang tries to cast an IncompleteArrayType to a PointerType when evaluating
__builtin_object_size.
rdar://
36094951
Differential Revision: https://reviews.llvm.org/D41405
llvm-svn: 321222
Krzysztof Parzyszek [Wed, 20 Dec 2017 20:54:13 +0000 (20:54 +0000)]
[Hexagon] Use ArrayRef member functions instead of custom ones
llvm-svn: 321221
Krzysztof Parzyszek [Wed, 20 Dec 2017 20:49:43 +0000 (20:49 +0000)]
[Hexagon] Allow construction of HVX vector predicates
Handle BUILD_VECTOR of boolean values.
llvm-svn: 321220
Rafael Espindola [Wed, 20 Dec 2017 20:46:08 +0000 (20:46 +0000)]
Use dyn_cast instead of dyn_cast_or_null.
There should be no null sections in InputSections.
llvm-svn: 321219
Krzysztof Parzyszek [Wed, 20 Dec 2017 20:33:49 +0000 (20:33 +0000)]
[Hexagon] Legalize vector elements to i32 in buildVector32/64
llvm-svn: 321218
Aaron Ballman [Wed, 20 Dec 2017 20:09:30 +0000 (20:09 +0000)]
Do not generate an empty switch statement as it causes MSVC to issue diagnostics about switch statements without case or default labels.
llvm-svn: 321217
Rafael Espindola [Wed, 20 Dec 2017 19:59:47 +0000 (19:59 +0000)]
clang-format. NFC.
llvm-svn: 321216
Yonghong Song [Wed, 20 Dec 2017 19:39:58 +0000 (19:39 +0000)]
bpf: add support for objdump -print-imm-hex
Add support for 'objdump -print-imm-hex' for imm64, operand imm
and branch target. If user programs encode immediate values
as hex numbers, such an option will make it easy to correlate
asm insns with source code. This option also makes it easy
to correlate imm values with insn encoding.
There is one changed behavior in this patch. In old way, we
print the 64bit imm as u64:
O << (uint64_t)Op.getImm();
and the new way is:
O << formatImm(Op.getImm());
The formatImm is defined in llvm/MC/MCInstPrinter.h as
format_object<int64_t> formatImm(int64_t Value)
So the new way to print 64bit imm is i64 type.
If a 64bit value has the highest bit set, the old way
will print the value as a positive value and the
new way will print as a negative value. The new way
is consistent with x86_64.
For the code (see the test program):
...
if (a == 0xABCDABCDabcdabcdULL)
...
x86_64 objdump, with and without -print-imm-hex, looks like:
48 b8 cd ab cd ab cd ab cd ab movabsq $-
6067004223159161907, %rax
48 b8 cd ab cd ab cd ab cd ab movabsq $-0x5432543254325433, %rax
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 321215
David Blaikie [Wed, 20 Dec 2017 19:36:54 +0000 (19:36 +0000)]
PR35705: Fix Chapter 9 example code for API changes to DIBuilder
llvm-svn: 321214
Craig Topper [Wed, 20 Dec 2017 19:36:43 +0000 (19:36 +0000)]
[X86] Refactor DomainReassignment pass to make the Closure class not stores references to the main data structures of the pass itself
Multiple Closure objects can be created and stored for a single function. It's not a good idea to devote so many fields of it to storing pointers and references to global data structures of the pass. The closure class should only store the things needed to represent the closure itself.
This patch refactors many of the methods of Closure to belong to the pass object and to pass around a reference to the current Closure. The Closure class gains a few simple methods to add instructions and edges, and to return iterators to edges and instructions
Differential Revision: https://reviews.llvm.org/D41327
llvm-svn: 321213
Matt Arsenault [Wed, 20 Dec 2017 19:36:28 +0000 (19:36 +0000)]
TableGen: Allow setting SDNodeProperties on intrinsics
Allows preserving MachineMemOperands on intrinsics
through selection. For reasons I don't understand, this
is a static property of the pattern and the selector
deliberately goes out of its way to drop if not present.
Intrinsics already inherit from SDPatternOperator allowing
them to be used directly in instruction patterns. SDPatternOperator
has a list of SDNodeProperty, but you currently can't set them on
the intrinsic. Without SDNPMemOperand, when the node is selected
any memory operands are always dropped. Allowing setting this
on the intrinsics avoids needing to introduce another equivalent
target node just to have SDNPMemOperand set.
llvm-svn: 321212
Max Moroz [Wed, 20 Dec 2017 19:31:51 +0000 (19:31 +0000)]
[libfuzzer] Fix UB when calculating Log(0) in StackDepthStepFunction().
Summary:
__builtin_clz used for Log calculation returns an undefined result
when argument is 0. I noticed that issue when was testing some fuzzers:
```
/src/libfuzzer/FuzzerTracePC.h:282:33: runtime error: shift exponent 450349 is too large for 32-bit type 'uint32_t' (aka 'unsigned int')
#0 0x43d83f in operator() /src/libfuzzer/FuzzerTracePC.h:283:33
#1 0x43d83f in void fuzzer::TracePC::CollectFeatures<fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1>(fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1) const /src/libfuzzer/FuzzerTracePC.h:290
#2 0x43cbd4 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:445:7
#3 0x43e5f1 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:706:5
#4 0x43e9e1 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:739:3
#5 0x432f8c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:754:6
#6 0x42ee18 in main /src/libfuzzer/FuzzerMain.cpp:20:10
#7 0x7f17ffeb182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#8 0x407838 in _start (/out/rotate_fuzzer+0x407838)
Reviewers: kcc
Reviewed By: kcc
Subscribers: llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D41457
llvm-svn: 321211
Matthew Simpson [Wed, 20 Dec 2017 19:26:37 +0000 (19:26 +0000)]
[ICP] Expose unconditional call promotion interface
This patch modifies the indirect call promotion utilities by exposing and using
an unconditional call promotion interface. The unconditional promotion
interface (i.e., call promotion without creating an if-then-else) can be used
if it's known that an indirect call has only one possible callee. The existing
conditional promotion interface uses this unconditional interface to promote an
indirect call after it has been versioned and placed within the "then" block.
A consequence of unconditional promotion is that the fix-up operations for phi
nodes in the normal destination of invoke instructions are changed. This is
necessary because the existing implementation assumed that an invoke had been
versioned, creating a "merge" block where a return value bitcast could be
placed. In the new implementation, the edge between a promoted invoke's parent
block and its normal destination is split if needed to add a bitcast for the
return value. If the invoke is also versioned, the phi node merging the return
value of the promoted and original invoke instructions is placed in the "merge"
block.
Differential Revision: https://reviews.llvm.org/D40751
llvm-svn: 321210
Craig Topper [Wed, 20 Dec 2017 19:25:33 +0000 (19:25 +0000)]
[X86] Remove zext from vXi32 to vXi64 on indices of gather/scatter instructions if we can prove the pre-extended value is positive.
Gather/scatter can implicitly sign extend from i32->i64 on indices. So if we know the sign bit of the input to a zext is 0 we can use the implicit extension.
llvm-svn: 321209
Matt Arsenault [Wed, 20 Dec 2017 19:11:59 +0000 (19:11 +0000)]
DAG: Tolerate non-MemSDNodes for OPC_RecordMemRef
When intrinsics are allowed to have mem operands, there
are two ways this can happen. First is an intrinsic
that is marked has having a mem operand, but is not handled
by getTgtMemIntrinsic.
The second way can occur even for intrinsics which do not
have a mem operand. It seems the selector table does
some kind of sorting based on the opcode, and the
mem ref recording can happen in the same scope for
intrinsics that both do and do not have mem refs.
I haven't been able to figure out exactly why this happens
(although it happens even with the matcher optimizations disabled).
I'm not sure if it's worth trying to avoid hitting this for
these nodes since I think it's still reasonable to handle
this in case getTgtMemIntrinic is not implemented.
llvm-svn: 321208
Warren Ristow [Wed, 20 Dec 2017 19:11:31 +0000 (19:11 +0000)]
Improve the test for r320216. NFC.
Patch by Matthew Voss!
llvm-svn: 321207
Adam Nemet [Wed, 20 Dec 2017 19:08:12 +0000 (19:08 +0000)]
[opt-viewer] Also demangle indirect-call promotion targets
llvm-svn: 321206
Stefan Pintilie [Wed, 20 Dec 2017 19:07:44 +0000 (19:07 +0000)]
[PowerPC] Added an assert to make sure that the MBBI iterator is valid.
The function createTailCallBranchInstr assumes that the iterator MBBI is valid.
However, only one use of MBBI is guarded in the function.
Fix this by adding an assert.
Differential Revision: https://reviews.llvm.org/D41358
llvm-svn: 321205
Nirav Dave [Wed, 20 Dec 2017 19:06:47 +0000 (19:06 +0000)]
[DAG] Fix condition on overlapping store check.
Prevent overlapping store elision when overlapping store is
pre-inc/dec as analysis is wrong in these cases.
llvm-svn: 321204
Evgeniy Stepanov [Wed, 20 Dec 2017 19:05:44 +0000 (19:05 +0000)]
[hwasan] Implement -fsanitize-recover=hwaddress.
Summary: Very similar to AddressSanitizer, with the exception of the error type encoding.
Reviewers: kcc, alekseyshl
Subscribers: cfe-commits, kubamracek, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D41417
llvm-svn: 321203
Matt Arsenault [Wed, 20 Dec 2017 18:52:57 +0000 (18:52 +0000)]
[AMDGPU, AsmParser] Enable the mnemonic spell corrector.
Patch by Dmitry Venikov
llvm-svn: 321202
Erich Keane [Wed, 20 Dec 2017 18:51:08 +0000 (18:51 +0000)]
Add support for ObjectFormat to TargetSpecificAttr
Looking through the code, I saw a FIXME on IFunc to switch it
to a target specific attribute. In looking through it, i saw that
the no-longer-appropriately-named TargetArch didn't support ObjectFormat
checking.
This patch changes the name of TargetArch to TargetSpecific
(since it checks much more than just Arch), makes "Arch" optional, adds
support for ObjectFormat, better documents the TargetSpecific type, and
changes IFunc over to a TargetSpecificAttr.
Differential Revision: https://reviews.llvm.org/D41303
llvm-svn: 321201