Jonas Toth [Thu, 31 Jan 2019 10:46:37 +0000 (10:46 +0000)]
[clang-tidy] refactor bugprone-exception-escape analysis into class
Summary:
The check `bugprone-exception-escape` does an AST-based analysis to determine
if a function might throw an exception and warns based on that information.
The analysis part is refactored into a standalone class similiar to
`ExprMutAnalyzer` that is generally useful.
I intent to use that class in a new check to automatically introduce `noexcept`
if possible.
Reviewers: aaron.ballman, alexfh, hokein, baloghadamsoftware, lebedev.ri
Reviewed By: baloghadamsoftware, lebedev.ri
Subscribers: lebedev.ri, mgorny, xazax.hun, rnkovacs, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D57100
llvm-svn: 352741
Rafael Auler [Thu, 31 Jan 2019 09:38:31 +0000 (09:38 +0000)]
Support attribute used in member funcs of class templates
Summary:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.
Test Plan: Added a testcase
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D56928
llvm-svn: 352740
Max Kazantsev [Thu, 31 Jan 2019 09:10:17 +0000 (09:10 +0000)]
Default lowering for experimental.widenable.condition
Introduces a pass that provides default lowering strategy for the
`experimental.widenable.condition` intrinsic, replacing all its uses with
`i1 true`.
Differential Revision: https://reviews.llvm.org/D56096
Reviewed By: reames
llvm-svn: 352739
Yevgeny Rouban [Thu, 31 Jan 2019 08:49:20 +0000 (08:49 +0000)]
Test commit. NFCI.
llvm-svn: 352738
Sjoerd Meijer [Thu, 31 Jan 2019 08:38:06 +0000 (08:38 +0000)]
[ARM] Thumb2: ConstantMaterializationCost
Constants can also be materialised using the negated value and a MVN, and this
case seem to have been missed for Thumb2. To check the constant materialisation
costs, we now call getT2SOImmVal twice, once for the original constant and then
also for its negated value, and this function checks if the constant can both
be splatted or rotated.
This was revealed by a test that optimises for minsize: instead of a LDR
literal pool load and having a literal pool entry, just a MVN with an immediate
is smaller (and also faster).
Differential Revision: https://reviews.llvm.org/D57327
llvm-svn: 352737
Sjoerd Meijer [Thu, 31 Jan 2019 08:07:30 +0000 (08:07 +0000)]
[SelectionDAG] Codesize: don't expand SHIFT to SHIFT_PARTS
And instead just generate a libcall. My motivating example on ARM was a simple:
shl i64 %A, %B
for which the code bloat is quite significant. For other targets that also
accept __int128/i128 such as AArch64 and X86, it is also beneficial for these
cases to generate a libcall when optimising for minsize. On these 64-bit targets,
the 64-bits shifts are of course unaffected because the SHIFT/SHIFT_PARTS
lowering operation action is not set to custom/expand.
Differential Revision: https://reviews.llvm.org/D57386
llvm-svn: 352736
Douglas Yung [Thu, 31 Jan 2019 07:58:34 +0000 (07:58 +0000)]
Fixup test after r352704 since it changes how paths may be emitted.
On Unix/Mac OS X, normpath() returns the path unchanged (FileCheck), but
on case-insensitive filesystems (like NTFS on Windows), it converts the
path to lowercase (filecheck) which was causing the test to fail.
llvm-svn: 352735
Dmitry Venikov [Thu, 31 Jan 2019 07:38:19 +0000 (07:38 +0000)]
Commit tests for changes in revision D41940
llvm-svn: 352734
Petr Hosek [Thu, 31 Jan 2019 07:12:43 +0000 (07:12 +0000)]
Revert "[CMake] Unify scripts for generating VCS headers"
This reverts commits r352729 and r352731: this broke Sanitizer Windows bots
llvm-svn: 352733
Kostya Serebryany [Thu, 31 Jan 2019 06:52:55 +0000 (06:52 +0000)]
[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand
llvm-svn: 352732
Petr Hosek [Thu, 31 Jan 2019 06:47:10 +0000 (06:47 +0000)]
[CMake] Migrate lldb to the new VCS script
This was accidentaly omitted from r352729 and broke lldb bots.
llvm-svn: 352731
Dmitry Venikov [Thu, 31 Jan 2019 06:28:10 +0000 (06:28 +0000)]
[InstCombine] Missed optimization in math expression: simplify calls exp functions
Summary: This patch enables folding following expressions under -ffast-math flag: exp(X) * exp(Y) -> exp(X + Y), exp2(X) * exp2(Y) -> exp2(X + Y). Motivation: https://bugs.llvm.org/show_bug.cgi?id=35594
Reviewers: hfinkel, spatel, efriedma, lebedev.ri
Reviewed By: spatel, lebedev.ri
Subscribers: lebedev.ri, llvm-commits
Differential Revision: https://reviews.llvm.org/D41342
llvm-svn: 352730
Petr Hosek [Thu, 31 Jan 2019 06:21:01 +0000 (06:21 +0000)]
[CMake] Unify scripts for generating VCS headers
Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang. They were both similar, but
different. They were both broken in their own ways, for example the one
used by Clang didn't properly handle monorepo resulting in an incorrect
version information reported by Clang.
This change unifies two the scripts by introducing a new script that's
used from both LLVM and Clang, ensures that the new script supports both
monorepo and standalone SVN and Git setups, and removes the old scripts.
Differential Revision: https://reviews.llvm.org/D57063
llvm-svn: 352729
Max Kazantsev [Thu, 31 Jan 2019 06:19:25 +0000 (06:19 +0000)]
[SCEV] Prohibit SCEV transformations for huge SCEVs
Currently SCEV attempts to limit transformations so that they do not work with
big SCEVs (that may take almost infinite compile time). But for this, it uses heuristics
such as recursion depth and number of operands, which do not give us a guarantee
that we don't actually have big SCEVs. This situation is still possible, though it is not
likely to happen. However, the bug PR33494 showed a bunch of simple corner case
tests where we still produce huge SCEVs, even not reaching big recursion depth etc.
This patch introduces a concept of 'huge' SCEVs. A SCEV is huge if its expression
size (intoduced in D35989) exceeds some threshold value. We prohibit optimizing
transformations if any of SCEVs we are dealing with is huge. This gives us a reliable
check that we don't spend too much time working with them.
As the next step, we can possibly get rid of old limiting mechanisms, such as recursion
depth thresholds.
Differential Revision: https://reviews.llvm.org/D35990
Reviewed By: reames
llvm-svn: 352728
Richard Trieu [Thu, 31 Jan 2019 04:33:11 +0000 (04:33 +0000)]
Add namespace to some types.
llvm-svn: 352725
Matt Arsenault [Thu, 31 Jan 2019 04:27:17 +0000 (04:27 +0000)]
Fix missing C++ mode comment in header
llvm-svn: 352724
Petr Hosek [Thu, 31 Jan 2019 03:38:43 +0000 (03:38 +0000)]
[CMake][compiler-rt] Enable statically linking unwinder and c++abi
Rather than guessing whether to use static or shared version of
unwinder and c++abi when using linking against the in-tree versions,
provide a CMake option to control this.
Differential Revision: https://reviews.llvm.org/D57492
llvm-svn: 352723
David L. Jones [Thu, 31 Jan 2019 03:28:46 +0000 (03:28 +0000)]
Revert "Reapply "[CGP] Check for existing inttotpr before creating new one""
This change reverts r351626.
The changes in r351626 cause quadratic work in several cases. (See r351626 thread on llvm-commits for details.)
llvm-svn: 352722
Julian Lettner [Thu, 31 Jan 2019 03:03:06 +0000 (03:03 +0000)]
[libFuzzer] Update Darwin test
Support for -fsanitize-coverage=trace-pc[-guard] was removed from
libFuzzer, which makes this currently fail.
This commit aligns this Darwin-specific test with its Linux counterpart
which changed in this commit:
https://github.com/llvm/llvm-project/commit/
3a94519a777b9ac407a1d5ff5c31ec48b3768eec
llvm-svn: 352721
Matt Arsenault [Thu, 31 Jan 2019 02:46:05 +0000 (02:46 +0000)]
GlobalISel: Handle odd splits in fewerElementsVector for load/store
llvm-svn: 352720
Matt Arsenault [Thu, 31 Jan 2019 02:34:03 +0000 (02:34 +0000)]
GlobalISel: Implement narrowScalar for bswap
llvm-svn: 352719
Matt Arsenault [Thu, 31 Jan 2019 02:22:39 +0000 (02:22 +0000)]
GlobalISel: Don't call changingInstruction before giving up
llvm-svn: 352718
Matt Arsenault [Thu, 31 Jan 2019 02:09:57 +0000 (02:09 +0000)]
GlobalISel: Allow bitcount ops to have different result type
For AMDGPU the result is always 32-bit for 64-bit inputs.
llvm-svn: 352717
Matt Arsenault [Thu, 31 Jan 2019 01:49:58 +0000 (01:49 +0000)]
GlobalISel: Use helper function for MMO splitting
Also fix an alignment bug getMachineMemOperand. If the
tracked value is null, the offset isn't tracked so the
base alignment needs to be reduced.
llvm-svn: 352716
Kostya Serebryany [Thu, 31 Jan 2019 01:47:29 +0000 (01:47 +0000)]
[libFuzzer] update docs
llvm-svn: 352715
Evandro Menezes [Thu, 31 Jan 2019 01:41:39 +0000 (01:41 +0000)]
[InstCombine] Expand testing for Windows (NFC)
Added the checks to the existing cases when the target is Win64.
llvm-svn: 352714
Kostya Serebryany [Thu, 31 Jan 2019 01:40:14 +0000 (01:40 +0000)]
[libFuzzer] set libFuzzer's own SEGV handler even one is already present, but call that handler from ours (unless we are unprotecting lazy counters). Call ProtectLazyCounters later, so that it runs after the initialization code in the target.
llvm-svn: 352713
Matt Arsenault [Thu, 31 Jan 2019 01:38:47 +0000 (01:38 +0000)]
GlobalISel: Fix creating MMOs with align 0
llvm-svn: 352712
Julian Lettner [Thu, 31 Jan 2019 01:24:01 +0000 (01:24 +0000)]
[libFuzzer] Set default sanitizer options in fuzzer tests
Summary:
Set default `ASAN_OPTIONS` when running libFuzzer tests. This allows us
to remove special casing in code for Darwin where we usually pass
`abort_on_error=0` to override platform defaults for tests.
A previous commit changed the code to make the tests pass:
https://github.com/llvm/llvm-project/commit/
7764a04af007eca68eafcf5caaea560ed05e35a9
Adapted a few tests to use `%env_asan_opts=` instead of directly setting
the environment variable.
rdar://problem/
47515276
Reviewers: kcc, george.karpenkov
Differential Revision: https://reviews.llvm.org/D57465
llvm-svn: 352711
Davide Italiano [Thu, 31 Jan 2019 01:17:47 +0000 (01:17 +0000)]
[testsuite] Fix TestAppleSimulator so that it works with Python 3.
llvm-svn: 352710
Davide Italiano [Thu, 31 Jan 2019 01:01:53 +0000 (01:01 +0000)]
[Python] Fix gdb-remote and lldb-server utilities to work with Py3.
llvm-svn: 352709
Craig Topper [Thu, 31 Jan 2019 00:49:40 +0000 (00:49 +0000)]
[X86] Add a 32-bit command line to avx512-intrinsics.ll. Move all 64-bit mode only intrinsics to avx512-intrinsics-x86_64.ll.
Most of the other intrinsic tests have a 32-bit command lines.
llvm-svn: 352708
Evandro Menezes [Thu, 31 Jan 2019 00:49:27 +0000 (00:49 +0000)]
[InstCombine] Simplify check clauses in test (NFC)
llvm-svn: 352707
Davide Italiano [Thu, 31 Jan 2019 00:43:36 +0000 (00:43 +0000)]
[Python] Python 2 and Python 3 disagree on `/`.
One considers it integer division, the other doesn't.
Move to `//` (floor division) so that this test passes
independently from the version.
llvm-svn: 352706
Peter Collingbourne [Thu, 31 Jan 2019 00:42:02 +0000 (00:42 +0000)]
Reland "gn build: Add BPF target."
Differential Revision: https://reviews.llvm.org/D57436
llvm-svn: 352705
Nico Weber [Thu, 31 Jan 2019 00:40:43 +0000 (00:40 +0000)]
lit: Let lit.util.which() return a normcase()ed path
LLVMConfig.with_environment() uses os.path.normcase(os.path.normpath(x)) to
normalize temporary env vars. LLVMConfig.use_clang() uses with_environment() to
temporarily set PATH and then look for clang there. This means that on Windows,
clang will be run with a path like c:\foo\bin\clang.EXE (with a lower-case
"C:").
lit.util.which() used to not do this, which means the executables added in
clang/test/lit.cfg.py (e.g. c-index-test) were run with a path like
C:\foo\bin\c-index-test.EXE (because both CMake and GN happen to write
clang_tools_dir with an upper-case C to lit.site.cfg.py).
clang/test/Index/pch-from-libclang.c requires that both c-index-test and clang
use _exactly_ the same resource dir path (same case and everything), because a
hash of the resource directory is used as module cache path.
This patch is necessary but not sufficient to make pch-from-libclang.c pass on
Windows.
Differential Revision: https://reviews.llvm.org/D57343
llvm-svn: 352704
Jonas Devlieghere [Thu, 31 Jan 2019 00:40:38 +0000 (00:40 +0000)]
Add Sphinx generated html files as output to the build phase.
This will ensure we don't rerun Sphinx when the files exist.
llvm-svn: 352703
Thomas Lively [Thu, 31 Jan 2019 00:35:37 +0000 (00:35 +0000)]
[LegalizeVectorTypes] Allow illegal indices when splitting extract_vector_elt
Summary:
Fixes PR40267, in which the removed assertion was triggering on
perfectly valid IR. As far as I can tell, constant out of bounds
indices should be allowed when splitting extract_vector_elt, since
they will simply be propagated as out of bounds indices in the
resulting split vector and handled appropriately elsewhere.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya
Differential Revision: https://reviews.llvm.org/D57471
llvm-svn: 352702
Davide Italiano [Thu, 31 Jan 2019 00:11:33 +0000 (00:11 +0000)]
[Python] String(s) and bytes are two different entities in 3.7.
So, we need an explicit call to decode() here to let it work with
both interpreters. Fixes TestXMMRegisters on 3.7.
llvm-svn: 352701
Kostya Serebryany [Thu, 31 Jan 2019 00:09:43 +0000 (00:09 +0000)]
[libFuzzer] experimental performance optimization -lazy_counters, off by default. Posix-only for now, tested on Linux
llvm-svn: 352700
Craig Topper [Thu, 31 Jan 2019 00:04:48 +0000 (00:04 +0000)]
[LegalizeTypes] Use report_fatal_error instead of llvm_unreachable in the default case of some type legalization handlers that can be reached with intrinsics with result or operands that aren't legal types.
These can be triggered by mistakenly using a 64-bit mode only intrinsics with a -mtriple=i686. Using report_fatal_error gives a better experience for this mistake in release builds instead of probably crashing.
We already do this for some of the vector type legalization handles.
llvm-svn: 352699
Craig Topper [Thu, 31 Jan 2019 00:04:46 +0000 (00:04 +0000)]
[X86] Remove handling of ISD::INTRINSIC_WO_CHAIN in ReplaceNodeResults.
I believe this was there to handle avx512bw intrinsics that returned i64 type in 32-bit mode. But all those intrinsics have since been changed to v64i1 results or replaced with generic IR.
llvm-svn: 352698
Craig Topper [Thu, 31 Jan 2019 00:04:42 +0000 (00:04 +0000)]
[X86] Add test case for pr40539. NFC
llvm-svn: 352697
Jonas Devlieghere [Wed, 30 Jan 2019 23:56:55 +0000 (23:56 +0000)]
Add lldb-docs target to Xcode project
This patch adds the lldb-docs target which generates the Sphinx html
documentation.
llvm-svn: 352696
Heejin Ahn [Wed, 30 Jan 2019 23:53:36 +0000 (23:53 +0000)]
[WebAssembly] Remove TODO on wasm.extract.exception intrinsic (NFC)
Summary:
We planned to delete this intrinsic and do custom lowering from
`wasm.get.exception`, which has a token argument, to
`EXTRACT_EXCEPTION`, a wasm pseudo instruction that simulates popping a
value from the wasm stack.
To do that, we need to introduce a new `WebAssemblyISD` node for this,
which itself is not a problem, but also have to introduce the
`WebAssemblyISD` namespace in SelectionDAGBuilder.cpp. I don't think any
other targets are doing that in the file. And also putting a
target-specific intrinsic in the common file is a little weird too. (All
other intrinsic functions in this `visitIntrinsicCall` functions are not
target-specific ones. Other target-specific intrinsics are usually
handled in `lib/Target/[TargetName]/[TargetName]ISelLowering.cpp`. The
reason we can't do this is it has a token argument.
Anyway, so I think I prefer the current code with one redundant
intrinsic more than adding one more `WebAssemblyISD` node and
also introducing the `WebAssemblyISD` namespace into
SelectionDAGBuilder.cpp. What do you think?
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57480
llvm-svn: 352695
Zachary Turner [Wed, 30 Jan 2019 23:52:32 +0000 (23:52 +0000)]
[RuntimeDyld] Don't try to allocate sections with align 0.
ELF sections allow 0 for the alignment, which is specified to
be the same as 1. However many clients do not expect this and
will behave poorly in the presence of a 0-aligned section (for
example by trying to modulo something by the section alignment).
We can be more polite by making sure that we always pass a
non-zero value to clients.
Differential Revision: https://reviews.llvm.org/D57482
llvm-svn: 352694
Kristof Umann [Wed, 30 Jan 2019 23:48:37 +0000 (23:48 +0000)]
[analyzer] Make NullReturnedFromNonnullChecker depend on NullabilityBase
Accidentally left this dependency out after D54438.
llvm-svn: 352693
Jessica Paquette [Wed, 30 Jan 2019 23:46:15 +0000 (23:46 +0000)]
[GlobalISel][AArch64] Select G_FEXP
This teaches the legalizer to handle G_FEXP in AArch64. As a result, it also
allows us to select G_FEXP.
It...
- Updates the legalizer-info tests
- Adds a test for legalizing exp
- Updates the existing fp tests to show that we can now select G_FEXP
https://reviews.llvm.org/D57483
llvm-svn: 352692
Amara Emerson [Wed, 30 Jan 2019 23:42:46 +0000 (23:42 +0000)]
[GlobalISel][LegalizerHelper] Add some missing MI change observer calls.
No test as it's a preventative fix.
llvm-svn: 352691
Julian Lettner [Wed, 30 Jan 2019 23:42:13 +0000 (23:42 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls
Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every unreachable instruction. However, the
optimizer will remove code after calls to functions marked with
noreturn. To avoid this UBSan removes noreturn from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
_asan_handle_no_return before noreturn functions. This is important for
functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* longjmp (longjmp itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the noreturn attributes are missing and ASan cannot
unpoison the stack, so it has false positives when stack unwinding is
used.
Changes:
Clang-CodeGen now directly insert calls to `__asan_handle_no_return`
when a call to a noreturn function is encountered and both
UBsan-unreachable and ASan are enabled. This allows UBSan to continue
removing the noreturn attribute from functions without any changes to
the ASan pass.
Previously generated code:
```
call void @longjmp
call void @__asan_handle_no_return
call void @__ubsan_handle_builtin_unreachable
```
Generated code (for now):
```
call void @__asan_handle_no_return
call void @longjmp
call void @__asan_handle_no_return
call void @__ubsan_handle_builtin_unreachable
```
rdar://problem/
40723397
Reviewers: delcypher, eugenis, vsk
Differential Revision: https://reviews.llvm.org/D57278
llvm-svn: 352690
Chen Zheng [Wed, 30 Jan 2019 23:18:38 +0000 (23:18 +0000)]
[PowerPC] delete no more needed workaround for readsRegister() in PowerPC
Differential Revision: https://reviews.llvm.org/D57439
llvm-svn: 352689
Petr Hosek [Wed, 30 Jan 2019 23:18:05 +0000 (23:18 +0000)]
[CMake] Use correct visibility for linked libraries in CMake
When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.
Differential Revision: https://reviews.llvm.org/D57456
llvm-svn: 352688
Erik Pilkington [Wed, 30 Jan 2019 23:17:38 +0000 (23:17 +0000)]
[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone
objc_alloc and objc_allocWithZone may throw exceptions if the
underlying method does. If we're in a @try block, then make sure we
emit an invoke instead of a call.
rdar://
47610407
Differential revision: https://reviews.llvm.org/D57476
llvm-svn: 352687
Matt Arsenault [Wed, 30 Jan 2019 23:09:28 +0000 (23:09 +0000)]
MIR: Reject non-power-of-4 alignments in MMO parsing
llvm-svn: 352686
Jessica Paquette [Wed, 30 Jan 2019 22:54:21 +0000 (22:54 +0000)]
[GlobalISel][AArch64] Select G_FABS
This adds instruction selection support for G_FABS in AArch64. It also updates
the existing basic FP tests, adds a selection test for G_FABS.
https://reviews.llvm.org/D57418
llvm-svn: 352684
Sam Clegg [Wed, 30 Jan 2019 22:47:35 +0000 (22:47 +0000)]
[WebAssembly] MC: Use WritePatchableLEB helper function. NFC.
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57477
llvm-svn: 352683
Heejin Ahn [Wed, 30 Jan 2019 22:44:45 +0000 (22:44 +0000)]
[WebAssembly] Restore stack pointer right after catch instruction
Summary:
After the staack is unwound due to a thrown exxception,
`__stack_pointer` global can point to an invalid address. So
a `global.set` to restore `__stack_pointer` should be inserted right
after `catch` instruction.
But after r352598 the `global.set` instruction is inserted not right
after `catch` but after `block` - `br-on-exn` - `end_block` -
`extract_exception` sequence. This CL fixes it.
While doing that, we can actually move ReplacePhysRegs pass after
LateEHPrepare and merge EHRestoreStackPointer pass into LateEHPrepare,
and now placing `global.set` to `__stack_pointer` right after `catch` is
much easier. Otherwise it is hard to guarantee that `global.set` is
still right after `catch` and not touched with other transformations, in
which case we have to do something to hoist it.
Reviewers: dschuff
Subscribers: mgorny, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57421
llvm-svn: 352681
Sanjay Patel [Wed, 30 Jan 2019 22:41:35 +0000 (22:41 +0000)]
[DAGCombiner] sub X, 0/1 --> add X, 0/-1
This extends the existing transform for:
add X, 0/1 --> sub X, 0/-1
...to allow the sibling subtraction fold.
This pattern could regress with the proposed change in D57401.
llvm-svn: 352680
Sanjay Patel [Wed, 30 Jan 2019 21:58:20 +0000 (21:58 +0000)]
[AArch64][x86] add tests for add/sub signbits fold; NFC
As discussed/shown in D57401, we are missing a fold for
subtract of 0/1 --> add 0/-1.
llvm-svn: 352678
Shafik Yaghmour [Wed, 30 Jan 2019 21:48:56 +0000 (21:48 +0000)]
Fix handling of CreateTemplateParameterList when there is an empty pack
Summary:
When we are creating a ClassTemplateSpecializationDecl in ParseTypeFromDWARF(...) we are not handling the case where variadic pack is empty in the specialization. This patch handles that case and adds a test to prevent future regressions.
Differential Revision: https://reviews.llvm.org/D57363
llvm-svn: 352677
Stephen Kelly [Wed, 30 Jan 2019 21:48:32 +0000 (21:48 +0000)]
[ASTDump] Inline traverse methods into class
This API will be extracted into a new template class. This change will
make the follow-up commit easier to review.
llvm-svn: 352676
Jessica Paquette [Wed, 30 Jan 2019 21:16:04 +0000 (21:16 +0000)]
[GlobalISel][AArch64] Add instruction selection support for @llvm.log2
This teaches GlobalISel to emit a RTLib call for @llvm.log2 when it encounters
it.
It updates the existing floating point tests to show that we don't fall back on
the intrinsic, and select the correct instructions. It also adds a legalizer
test for G_FLOG2.
https://reviews.llvm.org/D57357
llvm-svn: 352673
Erik Pilkington [Wed, 30 Jan 2019 21:14:08 +0000 (21:14 +0000)]
Don't define __has_feature(objc_fixed_enum) in non-objc mode
This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.
llvm-svn: 352672
Jessica Paquette [Wed, 30 Jan 2019 21:03:52 +0000 (21:03 +0000)]
[GlobalISel][AArch64] Add instruction selection support for @llvm.sqrt
This teaches the legalizer about G_FSQRT in AArch64. Also adds a legalizer
test for G_FSQRT, a selection test for it, and updates existing floating point
tests.
https://reviews.llvm.org/D57361
llvm-svn: 352671
Jessica Paquette [Wed, 30 Jan 2019 20:58:14 +0000 (20:58 +0000)]
[GlobalISel] Add IRTranslator support for @llvm.sqrt -> G_FSQRT
Follow-up commit to https://reviews.llvm.org/D57359. (r352668)
This adds IRTranslator support for recognising a @llvm.sqrt intrinsic and
translating it into a G_FSQRT.
https://reviews.llvm.org/D57360
llvm-svn: 352670
Alexey Bataev [Wed, 30 Jan 2019 20:49:52 +0000 (20:49 +0000)]
[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
required.
Function __kmpc_push_target_tripcount should be emitted only if the
offloading entry is going to be emitted (for use in tgt_target...
functions). Otherwise, it should not be emitted.
llvm-svn: 352669
Jessica Paquette [Wed, 30 Jan 2019 20:49:50 +0000 (20:49 +0000)]
[GlobalISel] Introduce a G_FSQRT generic instruction
This introduces a generic instruction for computing the floating point
square root of a value.
Right now, we can't select @llvm.sqrt, so this is working towards fixing that.
llvm-svn: 352668
Sam Clegg [Wed, 30 Jan 2019 20:46:18 +0000 (20:46 +0000)]
[LTO] Set CGOptLevel in LTO config.
Previously we were never setting this which means it was always being
set to Default (-O2/-Os).
Differential Revision: https://reviews.llvm.org/D57422
llvm-svn: 352667
Wolfgang Pieb [Wed, 30 Jan 2019 20:37:14 +0000 (20:37 +0000)]
Reverting r352642 - Handle restore instructions in LiveDebugValues - as it's causing
assertions on some buildbots.
llvm-svn: 352666
Erik Pilkington [Wed, 30 Jan 2019 20:34:53 +0000 (20:34 +0000)]
Add a new builtin: __builtin_dynamic_object_size
This builtin has the same UI as __builtin_object_size, but has the
potential to be evaluated dynamically. It is meant to be used as a
drop-in replacement for libraries that use __builtin_object_size when
a dynamic checking mode is enabled. For instance,
__builtin_object_size fails to provide any extra checking in the
following function:
void f(size_t alloc) {
char* p = malloc(alloc);
strcpy(p, "foobar"); // expands to __builtin___strcpy_chk(p, "foobar", __builtin_object_size(p, 0))
}
This is an overflow if alloc < 7, but because LLVM can't fold the
object size intrinsic statically, it folds __builtin_object_size to
-1. With __builtin_dynamic_object_size, alloc is passed through to
__builtin___strcpy_chk.
rdar://
32212419
Differential revision: https://reviews.llvm.org/D56760
llvm-svn: 352665
Erik Pilkington [Wed, 30 Jan 2019 20:34:35 +0000 (20:34 +0000)]
Add a 'dynamic' parameter to the objectsize intrinsic
This is meant to be used with clang's __builtin_dynamic_object_size.
When 'true' is passed to this parameter, the intrinsic has the
potential to be folded into instructions that will be evaluated
at run time. When 'false', the objectsize intrinsic behaviour is
unchanged.
rdar://
32212419
Differential revision: https://reviews.llvm.org/D56761
llvm-svn: 352664
Stephen Kelly [Wed, 30 Jan 2019 20:06:52 +0000 (20:06 +0000)]
[ASTDump] Make method definition order matches declaration order
This will make follow-up changes easier to review.
llvm-svn: 352663
Philip Reames [Wed, 30 Jan 2019 20:06:24 +0000 (20:06 +0000)]
[Tests] Add tests for propagation of undef elements in vector GEPs
llvm-svn: 352662
Stephen Kelly [Wed, 30 Jan 2019 20:03:47 +0000 (20:03 +0000)]
[ASTDump] Re-arrange method declarations to group Visit together
This will make follow-up commits easier to review.
llvm-svn: 352661
Craig Topper [Wed, 30 Jan 2019 19:57:01 +0000 (19:57 +0000)]
[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7.
This fixes the test case in PR35982 by preventing MMX instructions that read MM0-7 from being moved below EMMS/FEMMS by the post RA scheduler.
Though as discussed in bugzilla, this is not a complete fix. There is still the possibility of reordering in IR or by the pre-RA scheduler.
Differential Revision: https://reviews.llvm.org/D57298
llvm-svn: 352660
Nico Weber [Wed, 30 Jan 2019 19:53:58 +0000 (19:53 +0000)]
gn build: Set executable bit on get.py
llvm-svn: 352659
Petr Hosek [Wed, 30 Jan 2019 19:51:18 +0000 (19:51 +0000)]
Revert "[CMake] Use correct visibility for linked libraries in CMake"
This reverts commit r352654: this broke libcxx and sanitizer bots.
llvm-svn: 352658
Stephen Kelly [Wed, 30 Jan 2019 19:49:49 +0000 (19:49 +0000)]
[ASTDump] Rename methods which are conceptually Visits
This is consistent with the TextNodeDumper, and is the appropriate name
for the traverser class which will be extracted.
llvm-svn: 352657
Stephen Kelly [Wed, 30 Jan 2019 19:41:04 +0000 (19:41 +0000)]
[ASTDump] NFC: Inline vestigial methods
This was a porting aid.
llvm-svn: 352656
Stephen Kelly [Wed, 30 Jan 2019 19:32:48 +0000 (19:32 +0000)]
[ASTDump] Move Decl node dumping to TextNodeDumper
Reviewers: aaron.ballman
Subscribers: jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D57419
llvm-svn: 352655
Petr Hosek [Wed, 30 Jan 2019 19:27:26 +0000 (19:27 +0000)]
[CMake] Use correct visibility for linked libraries in CMake
When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.
Differential Revision: https://reviews.llvm.org/D57456
llvm-svn: 352654
Philip Reames [Wed, 30 Jan 2019 19:21:11 +0000 (19:21 +0000)]
SimplifyDemandedVectorElts for all intrinsics
The point is that this simplifies integration of new intrinsics into SimplifiedDemandedVectorElts, and ensures we don't miss any existing ones.
This is intended to be NFC-ish, but as seen from the diffs, can produce slightly different output. This is due to order of transforms w/in instcombine resulting in two slightly different fixed points. That's something we should fix, but isn't a problem w/this patch per se.
Differential Revision: https://reviews.llvm.org/D57398
llvm-svn: 352653
Wolfgang Pieb [Wed, 30 Jan 2019 19:15:43 +0000 (19:15 +0000)]
The test comitted with r348896 needed -march=x86=64 on the llc command line.
llvm-svn: 352651
Yonghong Song [Wed, 30 Jan 2019 19:13:16 +0000 (19:13 +0000)]
Revert "gn build: Add BPF target."
This reverts commit r352638.
The change in this patch is not trivial and it is merged
without component owner approval.
llvm-svn: 352649
Thomas Anderson [Wed, 30 Jan 2019 19:09:41 +0000 (19:09 +0000)]
[libc++] Explicitly initialize std::nothrow
When building on Windows without libc++abi, this change fixes a build error of the form:
src/new.cpp(38,17): error: chosen constructor is explicit in copy-initialization
const nothrow_t nothrow = {};
include/vcruntime_new.h(53,22): note: explicit constructor declared here
explicit nothrow_t() = default;
Differential Revision: https://reviews.llvm.org/D57351
llvm-svn: 352648
Thomas Anderson [Wed, 30 Jan 2019 19:08:32 +0000 (19:08 +0000)]
[libc++] Don't define operator new/delete when using vcruntime
Fixes build errors on Windows without libc++abi of the form:
new(173,36): error: redeclaration of 'operator delete' cannot add 'dllexport' attribute
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
vcruntime_new.h(87,16): note: previous declaration is here
void __CRTDECL operator delete(
new(205,70): error: redefinition of 'operator new'
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
vcruntime_new.h(184,28): note: previous definition is here
inline void* __CRTDECL operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept
new(206,70): error: redefinition of 'operator new[]'
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
vcruntime_new.h(199,28): note: previous definition is here
inline void* __CRTDECL operator new[](size_t _Size,
new(207,40): error: redefinition of 'operator delete'
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
vcruntime_new.h(190,27): note: previous definition is here
inline void __CRTDECL operator delete(void*, void*) noexcept
new(208,40): error: redefinition of 'operator delete[]'
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
vcruntime_new.h(206,27): note: previous definition is here
inline void __CRTDECL operator delete[](void*, void*) noexcept
Differential Revision: https://reviews.llvm.org/D57362
llvm-svn: 352647
Thomas Anderson [Wed, 30 Jan 2019 19:07:30 +0000 (19:07 +0000)]
[libc++] Don't define exception destructors when using vcruntime
Exception destructors are provided by vcruntime. Fixes link errors like:
lld-link: error: duplicate symbol: "public: virtual __cdecl std::invalid_argument::~invalid_argument(void)" (??1invalid_argument@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
lld-link: error: duplicate symbol: "public: virtual __cdecl std::length_error::~length_error(void)" (??1length_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
lld-link: error: duplicate symbol: "public: virtual __cdecl std::out_of_range::~out_of_range(void)" (??1out_of_range@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
lld-link: error: duplicate symbol: "public: virtual __cdecl std::overflow_error::~overflow_error(void)" (??1overflow_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
Differential Revision: https://reviews.llvm.org/D57425
llvm-svn: 352646
Sam Clegg [Wed, 30 Jan 2019 18:55:15 +0000 (18:55 +0000)]
[WebAssembly] Fix crash with LTO + relocatable + undefined symbols
Change the way we create the symbol table to be closer to how its done
on ELF. Now the output symbol table matches the internal symtab order
and includes local and undefined symbols.
Fixes PR40204
Differential Revision: https://reviews.llvm.org/D56947
llvm-svn: 352645
Jonas Devlieghere [Wed, 30 Jan 2019 18:51:40 +0000 (18:51 +0000)]
Add LLDB website and documentation in reStructuredText for Sphinx
The current LLDB website is written in HTML which is hard to maintain.
We have quite a bit of HTML code checked in which can make it hard to
differentiate between documentation written by us and documentation
generated by a tool.
In line with the other LLVM projects, I propose generating the
documentation with Sphix. I think text/rst files provide a lower barrier
for new or casual contributors to fix or update.
This patch adds a copy of the LLDB website and documentation in
reStructuredText. It also adds a new ninja target `docs-lldb-html` when
-DLLVM_ENABLE_SPHINX:BOOL is enabled.
This is the first step in having the website and documentation being
generated from the repository, rather than having the output checked-in
under the www folder. During the hopefully short transition period,
please also update the reStructuredText files when modifying the
website.
Differential revision: https://reviews.llvm.org/D55376
llvm-svn: 352644
Davide Italiano [Wed, 30 Jan 2019 18:40:05 +0000 (18:40 +0000)]
[Scalar] Remove partially wrong and unused functions.
I originally thought about fixing them, but hey, nobody is
using them anyway.
llvm-svn: 352643
Wolfgang Pieb [Wed, 30 Jan 2019 18:34:07 +0000 (18:34 +0000)]
[DEBUGINFO] Handle restore instructions in LiveDebugValues
The LiveDebugValues pass recognizes spills but not restores, which can
cause large gaps in location information for some variables, depending
on control flow. This patch make LiveDebugValues recognize restores and
generate appropriate DBG_VALUE instructions.
Reviewers: aprantl, NicolaPrica
Differential Revision: https://reviews.llvm.org/D57271
llvm-svn: 352642
Davide Italiano [Wed, 30 Jan 2019 18:24:16 +0000 (18:24 +0000)]
[Scalar] Hoist a duplicated (and sometimes wrong) comment.
Pointed out by Zachary and Adrian.
llvm-svn: 352641
Jordan Rupprecht [Wed, 30 Jan 2019 18:13:30 +0000 (18:13 +0000)]
[llvm-objcopy][NFC] More error propagation (linkToBuildIdDir)
llvm-svn: 352640
Davide Italiano [Wed, 30 Jan 2019 18:05:36 +0000 (18:05 +0000)]
[Scalar] Implement support for 512-bit values.
(useful, e.g. when reading 512-bits registers, a-la AVX-512).
<rdar://problem/
46886288>
llvm-svn: 352639
Peter Collingbourne [Wed, 30 Jan 2019 18:04:08 +0000 (18:04 +0000)]
gn build: Add BPF target.
Differential Revision: https://reviews.llvm.org/D57436
llvm-svn: 352638
Matt Arsenault [Wed, 30 Jan 2019 17:52:25 +0000 (17:52 +0000)]
GlobalISel: Add simpler way of always specifying custom lowering
llvm-svn: 352637
Matt Arsenault [Wed, 30 Jan 2019 17:52:23 +0000 (17:52 +0000)]
GlobalISel: Add assert that legalize mutation makes sense
I've repeatedly encountered bugs resulting from custom legalize
mutations returning nonsense legalize results, such as increasing the
number of elements for FewerElements. Add an assert function to make
sure the type to mutate to is consistent with the legalize action.
llvm-svn: 352636
Matt Arsenault [Wed, 30 Jan 2019 17:25:37 +0000 (17:25 +0000)]
AMDGPU: Stop generating unused intrinsic .inc files
llvm-svn: 352635
Simon Pilgrim [Wed, 30 Jan 2019 16:19:19 +0000 (16:19 +0000)]
[X86][AVX] Prefer to combine shuffle to broadcasts whenever possible
This is the first step towards improving broadcast support on AVX1 targets.
llvm-svn: 352634
Simon Pilgrim [Wed, 30 Jan 2019 16:15:59 +0000 (16:15 +0000)]
[utils] Fix update scripts output when run on python3.
This fixes a "bytes-like object is required, not 'str'" python3 error I hit on update_llc_test_checks.py (but present on the other scripts as well) by matching what update_mca_test_checks.py already does, plus I've added an explicit 'utf-8' encoding.
llvm-svn: 352633