Craig Topper [Fri, 16 Feb 2018 00:39:05 +0000 (00:39 +0000)]
[X86] Add the test cases that were supposed to go with r325287.
llvm-svn: 325306
Bruno Cardoso Lopes [Fri, 16 Feb 2018 00:12:57 +0000 (00:12 +0000)]
[Modules] Extend -fmodule-name semantic for frameworks with private modules
Assume Foo.framework with two module maps and two modules Foo and
Foo_Private.
Framework authors need to skip building both Foo and Foo_Private when
using -fmodule-name=Foo, since both are part of the framework and used
interchangeably during compilation.
rdar://problem/
37500098
llvm-svn: 325305
Alexey Bataev [Thu, 15 Feb 2018 23:39:43 +0000 (23:39 +0000)]
[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.
Codegen for ordered with doacross construct might produce incorrect code
because of missing cleanup scope for the construct. Without this scope
the final runtime function call could be emitted in the wrong order that
leads to incorrect codegen.
llvm-svn: 325304
Ekaterina Romanova [Thu, 15 Feb 2018 23:29:21 +0000 (23:29 +0000)]
Allow 0 to be a valid value pruning interval in C LTO API. Value 0 will cause garbage collector to run. This matches the behavior in C++ LTO API.
llvm-svn: 325303
Alexey Bataev [Thu, 15 Feb 2018 22:42:57 +0000 (22:42 +0000)]
[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink|source clause.
Patch fixes compiler crash on standalone #pragmas ordered with
depend(sink|source) clauses.
llvm-svn: 325302
Vedant Kumar [Thu, 15 Feb 2018 22:26:18 +0000 (22:26 +0000)]
[DCE] Salvage debug info from dead insts
This results in small increases in the size of the .debug_loc section
and the number of unique source variables in a stage2 build of opt.
llvm-svn: 325301
Kuba Mracek [Thu, 15 Feb 2018 22:14:36 +0000 (22:14 +0000)]
[asan] Add "arm64" into the list of 64-bit architectures
It looks like get_bits_for_arch doesn't recognize "arm64" as a 64-bit architecture, and it actually matches the "arm" regexp, which marks it as 32-bit. Let's fix that by matching the 64-bit list first and addin "arm64" into the list.
Differential Revision: https://reviews.llvm.org/D43155
llvm-svn: 325300
Stanislav Mekhanoshin [Thu, 15 Feb 2018 22:03:55 +0000 (22:03 +0000)]
[AMDGPU] Combine adjacent waitcounts in a single strongest wait
Differential Revision: https://reviews.llvm.org/D43350
llvm-svn: 325299
Benjamin Kramer [Thu, 15 Feb 2018 21:37:29 +0000 (21:37 +0000)]
[include-fixer] Add more debug headers to the STL header list
These are used for std::map/std::set in STL debug mode.
llvm-svn: 325298
Vedant Kumar [Thu, 15 Feb 2018 21:28:38 +0000 (21:28 +0000)]
[Debugify] Don't check functions which were skipped
If no debug info was applied to a function, its debug info shouldn't be
checked (it doesn't have any :).
llvm-svn: 325297
Reid Kleckner [Thu, 15 Feb 2018 21:25:23 +0000 (21:25 +0000)]
Don't make PDBs by default in Release mode
Introduce the LLVM_ENABLE_PDB option so that users can request them
explicitly instead.
Add /OPT:REF and /OPT:ICF back, which /DEBUG disables by default.
Differential Revision: https://reviews.llvm.org/D43156
llvm-svn: 325296
Rafael Auler [Thu, 15 Feb 2018 21:20:31 +0000 (21:20 +0000)]
[X86][3DNOW] Teach decoder about AMD 3DNow! instrs
Summary:
This patch makes the decoder understand old AMD 3DNow!
instructions that have never been properly supported in the X86
disassembler, despite being supported in other subsystems. Hopefully
this should make the X86 decoder more complete with respect to binaries
containing legacy code.
Reviewers: craig.topper
Reviewed By: craig.topper
Subscribers: llvm-commits, maksfb, bruno
Differential Revision: https://reviews.llvm.org/D43311
llvm-svn: 325295
Vedant Kumar [Thu, 15 Feb 2018 21:14:36 +0000 (21:14 +0000)]
[opt] Port the debugify passes to the new pass manager
llvm-svn: 325294
Aaron Ballman [Thu, 15 Feb 2018 21:03:39 +0000 (21:03 +0000)]
Silence a -Wparentheses warning; NFC.
llvm-svn: 325293
Aaron Ballman [Thu, 15 Feb 2018 20:56:19 +0000 (20:56 +0000)]
Silence some -Wunused-variable warnings; NFC.
llvm-svn: 325292
Brian Gesiak [Thu, 15 Feb 2018 20:37:22 +0000 (20:37 +0000)]
[Coroutines] Use allocator overload when available
Summary:
Depends on https://reviews.llvm.org/D42605.
An implementation of the behavior described in `[dcl.fct.def.coroutine]/7`:
when a promise type overloads `operator new` using a "placement new"
that takes the same argument types as the coroutine function, that
overload is used when allocating the coroutine frame.
Simply passing references to the coroutine function parameters directly
to `operator new` results in invariant violations in LLVM's coroutine
splitting pass, so this implementation modifies Clang codegen to
produce allocator-specific alloc/store/loads for each parameter being
forwarded to the allocator.
Test Plan: `check-clang`
Reviewers: rsmith, GorNishanov, eric_niebler
Reviewed By: GorNishanov
Subscribers: lewissbaker, EricWF, cfe-commits
Differential Revision: https://reviews.llvm.org/D42606
llvm-svn: 325291
Craig Topper [Thu, 15 Feb 2018 20:27:30 +0000 (20:27 +0000)]
[X86] Enable BT to be used in place of TEST for single bit checks under optsize
We already do this for 64-bit when it won't fit into a 64-bit AND/TEST's immediate field. This adds an additional qualifier to do it for any single bit constant larger than 8-bits under optsize
Differential Revision: https://reviews.llvm.org/D43346
llvm-svn: 325290
Craig Topper [Thu, 15 Feb 2018 20:20:32 +0000 (20:20 +0000)]
[DAGCombiner] Call ExtendUsesToFormExtLoad in (zext (and (load)))->(and (zextload)) even when the and does not have multiple uses
Same for the sign extend case.
Currently we check for multiple uses on the binop. Then we call ExtendUsesToFormExtLoad to capture SetCCs that use the load. So we only end up finding any setccs when the and has additional uses and the load is used by a setcc. I don't think the and having multiple uses is relevant here. I think we should only be checking for the load having multiple uses.
This changes an NVPTX test because we now find that the load has a second use by a truncate, but ExtendUsesToFormExtLoad only looks at setccs it can extend. All other operations just check isTruncateFree. Maybe we should allow widening of an existing truncate even if its not free?
Differential Revision: https://reviews.llvm.org/D43063
llvm-svn: 325289
Brian Gesiak [Thu, 15 Feb 2018 20:09:25 +0000 (20:09 +0000)]
[Sema] Toggle diags when finding allocators (NFCI)
Summary:
Many methods in Sema take a `bool Diagnose` parameter. Examples of such
methods include `Sema::FindDeallocationFunction` and
`Sema::SpecialMemberIsTrivial`. Calling these methods with
`Diagnose = false` allows callers to, for instance, check for the
existence of a deallocation function, without that check resulting in
error diagnostics being emitted if no matching deallocation function exists.
Add a similar `bool Diagnose` to the `Sema::FindAllocationFunctions`
method, so that checks for the existence of allocation functions can be
made without triggering error diagnostics.
This allows `SemaCoroutine.cpp`, in its implementation of the
Coroutines TS, to check for the existence of a particular `operator new`
overload, but then without error fall back to a default `operator new`
if no matching overload exists.
Test Plan: `check-clang`
Reviewers: rsmith, GorNishanov, eric_niebler
Reviewed By: GorNishanov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42605
llvm-svn: 325288
Craig Topper [Thu, 15 Feb 2018 19:57:35 +0000 (19:57 +0000)]
[X86] Use btc/btr/bts to implement xor/and/or that affects a single bit in the upper 32-bits of a 64-bit operation.
We can't fold a large immediate into a 64-bit operation. But if we know we're only operating on a single bit we can use the bit instructions.
For now only do this for optsize.
Differential Revision: https://reviews.llvm.org/D37418
llvm-svn: 325287
Artem Dergachev [Thu, 15 Feb 2018 19:34:19 +0000 (19:34 +0000)]
[analyzer] Suppress temporary destructors for temporary arrays.
Array destructors, like constructors, need to be called for each element of the
array separately. We do not have any mechanisms to do this in the analyzer,
so for now all we do is evaluate a single constructor or destructor
conservatively and give up. It automatically causes the necessary invalidation
and pointer escape for the whole array, because this is how RegionStore works.
Implement this conservative behavior for temporary destructors. This fixes the
crash on the provided test.
Differential Revision: https://reviews.llvm.org/D43149
llvm-svn: 325286
Brian Gesiak [Thu, 15 Feb 2018 19:31:45 +0000 (19:31 +0000)]
[Coroutines] Don't move stores for allocator args
Summary:
The behavior described in Coroutines TS `[dcl.fct.def.coroutine]/7`
allows coroutine parameters to be passed into allocator functions.
The instructions to store values into the alloca'd parameters must not
be moved past the frame allocation, otherwise uninitialized values are
passed to the allocator.
Test Plan: `check-llvm`
Reviewers: rsmith, GorNishanov, eric_niebler
Reviewed By: GorNishanov
Subscribers: compnerd, EricWF, llvm-commits
Differential Revision: https://reviews.llvm.org/D43000
llvm-svn: 325285
Artem Dergachev [Thu, 15 Feb 2018 19:28:21 +0000 (19:28 +0000)]
[analyzer] Implement path notes for temporary destructors.
Temporary destructors fire at the end of the full-expression. It is reasonable
to attach the path note for entering/leaving the temporary destructor to its
CXXBindTemporaryExpr. This would not affect lifetime-extended temporaries with
their automatic destructors which aren't temporary destructors.
The path note may be confusing in the case of destructors after elidable copy
constructors.
Differential Revision: https://reviews.llvm.org/D43144
llvm-svn: 325284
Pablo Barrio [Thu, 15 Feb 2018 19:17:55 +0000 (19:17 +0000)]
[ARM] Fix redirect in inline assembly test
Summary: Fix silly mistake in a test
Reviewers: gkistanova, apilipenko
Subscribers: javed.absar, eraman, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D43342
llvm-svn: 325283
Artem Dergachev [Thu, 15 Feb 2018 19:17:44 +0000 (19:17 +0000)]
[analyzer] Compute the correct this-region for temporary destructors.
Inline them if possible - a separate flag is added to control this.
The whole thing is under the cfg-temporary-dtors flag, off by default so far.
Temporary destructors are called at the end of full-expression. If the
temporary is lifetime-extended, automatic destructors kick in instead,
which are not addressed in this patch, and normally already work well
modulo the overally broken support for lifetime extension.
The patch operates by attaching the this-region to the CXXBindTemporaryExpr in
the program state, and then recalling it during destruction that was triggered
by that CXXBindTemporaryExpr. It has become possible because
CXXBindTemporaryExpr is part of the construction context since r325210.
Differential revision: https://reviews.llvm.org/D43104
llvm-svn: 325282
Vedant Kumar [Thu, 15 Feb 2018 19:13:04 +0000 (19:13 +0000)]
[SCCP] Test that constant propagation updates debug info, NFC
This extends an existing test to check that SCCP updates the operands of
relevant dbg.value instructions as it does its work.
llvm-svn: 325281
Vedant Kumar [Thu, 15 Feb 2018 19:13:03 +0000 (19:13 +0000)]
[Utils] salvageDI: Add a comment and move a call earlier, NFC
llvm-svn: 325280
Yaxun Liu [Thu, 15 Feb 2018 19:12:41 +0000 (19:12 +0000)]
Clean up AMDGCN tests
Differential Revision: https://reviews.llvm.org/D43340
llvm-svn: 325279
Artem Dergachev [Thu, 15 Feb 2018 19:01:55 +0000 (19:01 +0000)]
[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().
Don't look at the parent statement to figure out if the cxx-allocator-inlining
flag should kick in and prevent us from inlining the constructor within
a new-expression. We now have construction contexts for that purpose.
llvm-svn: 325278
Craig Topper [Thu, 15 Feb 2018 19:00:11 +0000 (19:00 +0000)]
[X86] Add test cases for opportunities for using BT instead of TEST under optsize.
llvm-svn: 325277
Alex Shlyapnikov [Thu, 15 Feb 2018 18:58:31 +0000 (18:58 +0000)]
[TSan] Fix static TLS boundaries calculations in __tls_get_addr interceptor.
Summary:
DTLS_on_tls_get_addr expects (tls_addr + tls_size) as the last
parameter, static_tls_end.
Reviewers: dvyukov
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D43325
llvm-svn: 325276
Zachary Turner [Thu, 15 Feb 2018 18:46:59 +0000 (18:46 +0000)]
Silence warning about unused private variable.
llvm-svn: 325275
Zachary Turner [Thu, 15 Feb 2018 18:36:10 +0000 (18:36 +0000)]
Call FlushFileBuffers on output files.
There is a latent Windows kernel bug, the exact trigger
conditions are not well understood, which can cause a file
to be correctly written, but unable to be correctly read.
The workaround appears to be simply calling FlushFileBuffers.
Differential Revision: https://reviews.llvm.org/D42925
llvm-svn: 325274
Dan Gohman [Thu, 15 Feb 2018 18:05:16 +0000 (18:05 +0000)]
[WebAssembly] Restore "*-wasm" tests.
Even though "...-wasm" is now the default for wasm, it's still
desirable to test this form.
llvm-svn: 325273
Fangrui Song [Thu, 15 Feb 2018 17:56:43 +0000 (17:56 +0000)]
[clang-tidy] Add `readability-simd-intrinsics` check.
Summary:
Many architectures provide SIMD operations (e.g. x86 SSE/AVX, Power AltiVec/VSX,
ARM NEON). It is common that SIMD code implementing the same algorithm, is
written in multiple target-dispatching pieces to optimize for different
architectures or micro-architectures.
The C++ standard proposal P0214 and its extensions cover many common SIMD
operations. By migrating from target-dependent intrinsics to P0214 operations,
the SIMD code can be simplified and pieces for different targets can be unified.
Refer to http://wg21.link/p0214 for introduction and motivation for the
data-parallel standard library.
Subscribers: klimek, aemerson, mgorny, xazax.hun, kristof.beyls, hintonda, cfe-commits
Differential Revision: https://reviews.llvm.org/D42983
llvm-svn: 325272
Matt Davis [Thu, 15 Feb 2018 17:55:52 +0000 (17:55 +0000)]
[Test] Remove mangled name from test.
This line is not needed in the test, and breaks Windows testing.
Fixes the test added in r325175.
llvm-svn: 325271
Simon Pilgrim [Thu, 15 Feb 2018 17:48:34 +0000 (17:48 +0000)]
[X86][SSE] Add saturated truncation tests for storing illegal v8i8 types
Tests showing missing opportunities to use PACK instructions in cases where we need to truncate to illegal types for stores
llvm-svn: 325270
Krzysztof Parzyszek [Thu, 15 Feb 2018 17:20:07 +0000 (17:20 +0000)]
Recommit [Hexagon] Make the vararg handling a bit more robust
Use the FunctionType of the callee when it's available. It may not be
available for synthetic calls to functions specified by external symbols.
llvm-svn: 325269
Alexey Bataev [Thu, 15 Feb 2018 17:11:50 +0000 (17:11 +0000)]
[SLP] Fix the test for the reversed stores, NFC.
llvm-svn: 325268
Yonghong Song [Thu, 15 Feb 2018 17:06:45 +0000 (17:06 +0000)]
bpf: fix a bug in dag2dag optimization for loads from readonly section
The reference '&' is missing in the function parameter. If there are
back-to-back optimizations in terms of dag node list like below:
t29: i64,ch = load<LD4[bitcast (%struct.test_t* @test.t to i8*)+12](dereferenceable), zext from i32> t3, t43, undef:i64
t34: i64,ch = load<LD4[bitcast (%struct.test_t* @test.t to i8*)](dereferenceable), zext from i32> t3, t41, undef:i64
The bug will trigger a segfault for the added test case remove_truncate_5.ll:
LLVMSymbolizer: error reading file: No such file or directory
#0 0x000000000241c4d9 (llc+0x241c4d9)
#1 0x000000000241c56a (llc+0x241c56a)
#2 0x000000000241aa50 (llc+0x241aa50)
...
#22 0x0000000000fd5edf (llc+0xfd5edf)
#23 0x00007f0fe03bec05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#24 0x0000000000fd3e69 (llc+0xfd3e69)
...
Segmentation fault
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 325267
Krzysztof Parzyszek [Thu, 15 Feb 2018 16:57:44 +0000 (16:57 +0000)]
Revert "[Hexagon] Make the vararg handling a bit more robust"
This is breaking lit tests.
llvm-svn: 325266
Alexey Bataev [Thu, 15 Feb 2018 16:56:49 +0000 (16:56 +0000)]
[SLP] Added test for reversed stores, NFC.
llvm-svn: 325265
Yaxun Liu [Thu, 15 Feb 2018 16:39:19 +0000 (16:39 +0000)]
[OpenCL] Fix __enqueue_block for block with captures
The following test case causes issue with codegen of __enqueue_block
void (^block)(void) = ^{ callee(id, out); };
enqueue_kernel(queue, 0, ndrange, block);
Clang first does codegen for block expression in the first line and deletes its block info.
Clang then tries to do codegen for the same block expression again for the second line,
and fails because the block info is gone.
The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to
record llvm block invoke function and llvm block literal emitted for each AST block
expression, and use the recorded information for generating the wrapper kernel.
The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen
of blocks.
Another minor issue is that some clean up AST expression is generated for block
with captures, which can be stripped by IgnoreImplicit.
Differential Revision: https://reviews.llvm.org/D43240
llvm-svn: 325264
Sanjay Patel [Thu, 15 Feb 2018 16:30:10 +0000 (16:30 +0000)]
[InstCombine] use m_OneUse to reduce code; NFC
llvm-svn: 325263
Sanjay Patel [Thu, 15 Feb 2018 16:28:15 +0000 (16:28 +0000)]
[InstCombine] test fdiv folds better; NFC
We had redundant tests, but no tests for extra uses or vectors.
'fast' is an overly conservative requirement for these folds.
llvm-svn: 325262
Aaron Ballman [Thu, 15 Feb 2018 16:28:10 +0000 (16:28 +0000)]
Amend r325256. This change was not properly merged locally before the commit happened.
llvm-svn: 325261
Ilya Biryukov [Thu, 15 Feb 2018 16:24:34 +0000 (16:24 +0000)]
[clangd] Create trace::Span when running ASTCallback
llvm-svn: 325260
Krzysztof Parzyszek [Thu, 15 Feb 2018 16:24:30 +0000 (16:24 +0000)]
[Hexagon] Make the vararg handling a bit more robust
The FunctionType of the callee is always available, even if the Function
of the callee is not. Use that to get the number of fixed parameters.
llvm-svn: 325259
Francis Visoiu Mistrih [Thu, 15 Feb 2018 16:23:59 +0000 (16:23 +0000)]
[CodeGen] Separate MBB metadata from instructions in -debug printing
Add an empty line after 'liveins:', 'successors:', or '; predecessors:',
the one that ends up to be the last one.
llvm-svn: 325258
Sam McCall [Thu, 15 Feb 2018 16:20:33 +0000 (16:20 +0000)]
[clangd] Use explicit env in test to make lit+windows happy. NFC
llvm-svn: 325257
Aaron Ballman [Thu, 15 Feb 2018 16:20:20 +0000 (16:20 +0000)]
NFC; clean up this file based on our coding standards. The impetus was considerable use of a type name as an identifier for an object.
Changed identifier names (especially function parameters) to not clash with type names and to follow the proper naming conventions. Use of explicit type names changed to use auto where appropriate. Removed unused parameters that should have never been added in the first place. Minor formatting cleanups.
The changes were mostly mechanical and should have no functional impact.
llvm-svn: 325256
Krzysztof Parzyszek [Thu, 15 Feb 2018 15:47:53 +0000 (15:47 +0000)]
[Hexagon] Fix lowering of formal arguments after r324737
Lowering of formal arguments needs to be aware of vararg functions.
llvm-svn: 325255
Ilya Biryukov [Thu, 15 Feb 2018 15:41:49 +0000 (15:41 +0000)]
[clangd] Fixed compilation with MVSC.
llvm-svn: 325254
Simon Pilgrim [Thu, 15 Feb 2018 15:31:00 +0000 (15:31 +0000)]
[SelectionDAG] Pull out repeated Op.getOpcode(). NFCI.
llvm-svn: 325253
Krasimir Georgiev [Thu, 15 Feb 2018 15:30:22 +0000 (15:30 +0000)]
[clang-format] Support repeated field lists in protos
Summary:
This patch adds support for list initialization of proto repeated fields:
```
keys: [1, 2, 3]
```
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43298
llvm-svn: 325252
Francis Visoiu Mistrih [Thu, 15 Feb 2018 15:27:34 +0000 (15:27 +0000)]
[CodeGen] Print irreducible loop header weight as a MIR comment
Prefix it with '; ' to make it more MIR-compatible.
llvm-svn: 325251
Pavel Labath [Thu, 15 Feb 2018 15:24:32 +0000 (15:24 +0000)]
@skipIfRemote TestTargetXMLArch
The test does not actually connect to any remote targets.
llvm-svn: 325250
Kamil Rytarowski [Thu, 15 Feb 2018 15:24:01 +0000 (15:24 +0000)]
Try to unbreak Darwin after XRay/FreeBSD commit
Add a fallback definition of getTSCFrequency().
llvm-svn: 325249
Kamil Rytarowski [Thu, 15 Feb 2018 15:15:45 +0000 (15:15 +0000)]
Implement a large part of NetBSD syscalls of netbsd_syscall_hooks.h
This is a follow up of:
r325206 - Add NetBSD syscall hooks skeleton in sanitizers
Sponsored by <The NetBSD Foundation>
llvm-svn: 325248
Sanjay Patel [Thu, 15 Feb 2018 15:07:12 +0000 (15:07 +0000)]
[InstCombine] allow sin/cos transforms with 'reassoc'
The variable name 'AllowReassociate' is a lie at this point because
it's set to 'isFast()' which is more than the 'reassoc' FMF after
rL317488.
In D41286, we showed that this transform may be valid even with strict
math by brute force checking every 32-bit float result.
There's a potential problem here because we're replacing with a tan()
libcall rather than a hypothetical LLVM tan intrinsic. So we might
set errno when we should be guaranteed not to do that. But that's
independent of this change.
llvm-svn: 325247
Kamil Rytarowski [Thu, 15 Feb 2018 14:59:59 +0000 (14:59 +0000)]
Enable test/asan for NetBSD
Sponsored by <The NetBSD Foundation>
llvm-svn: 325246
Kamil Rytarowski [Thu, 15 Feb 2018 14:58:15 +0000 (14:58 +0000)]
Enable syscall-specific functions in TSan/NetBSD
NetBSD ships now with netbsd_syscall_hooks.h and requires support
for TSan specific features to be enabled.
This is follow up of:
D42048: Add NetBSD syscall hooks skeleton in sanitizers
Sponsored by <The NetBSD Foundation>
llvm-svn: 325245
Pablo Barrio [Thu, 15 Feb 2018 14:44:22 +0000 (14:44 +0000)]
[ARM] Allow 64- and 128-bit types with 't' inline asm constraint
Summary:
In LLVM, 't' selects a floating-point/SIMD register and only supports
32-bit values. This is appropriately documented in the LLVM Language
Reference Manual. However, this behaviour diverges from that of GCC, where
't' selects the s0-s31 registers and its qX and dX variants depending on
additional operand modifiers (q/P).
For example, the following C code:
#include <arm_neon.h>
float32x4_t a, b, x;
asm("vadd.f32 %0, %1, %2" : "=t" (x) : "t" (a), "t" (b))
results in the following assembly if compiled with GCC:
vadd.f32 s0, s0, s1
whereas LLVM will show "error: couldn't allocate output register for
constraint 't'", since a, b, x are 128-bit variables, not 32-bit.
This patch extends the use of 't' to mean that of GCC, thus allowing
selection of the lower Q vector regs and their D/S variants. For example,
the earlier code will now compile as:
vadd.f32 q0, q0, q1
This behaviour still differs from that of GCC but I think it is actually
more correct, since LLVM picks up the right register type based on the
datatype of x, while GCC would need an extra operand modifier to achieve
the same result, as follows:
asm("vadd.f32 %q0, %q1, %q2" : "=t" (x) : "t" (a), "t" (b))
Since this is only an extension of functionality, existing code should not
be affected by this change. Note that operand modifiers q/P are already
supported by LLVM, so this patch should suffice to support inline
assembly with constraint 't' originally built for GCC.
Reviewers: grosbach, rengolin
Reviewed By: rengolin
Subscribers: rogfer01, efriedma, olista01, aemerson, javed.absar, eraman, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D42962
llvm-svn: 325244
Simon Pilgrim [Thu, 15 Feb 2018 14:37:59 +0000 (14:37 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS vXi32-vXi8 saturated truncation
We can use PACKSS/PACKUS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKUSWB to [0,255].
llvm-svn: 325243
Ilya Biryukov [Thu, 15 Feb 2018 14:32:57 +0000 (14:32 +0000)]
[clangd] Enable snippet completion based on client capabilities.
Summary: And remove -enable-snippets flag.
Reviewers: hokein, ioeric, sammccall
Reviewed By: ioeric
Subscribers: klimek, jkorous-apple, cfe-commits
Differential Revision: https://reviews.llvm.org/D43229
llvm-svn: 325242
Kamil Rytarowski [Thu, 15 Feb 2018 14:19:23 +0000 (14:19 +0000)]
Adding msan support for FreeBSD
Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart.
Patch by: David CARLIER
Reviewers: krytarowski
Reviewed By: krytarowski
Subscribers: dim, emaste, cfe-commits
Differential Revision: https://reviews.llvm.org/D43148
llvm-svn: 325241
Kamil Rytarowski [Thu, 15 Feb 2018 14:17:15 +0000 (14:17 +0000)]
Add Xray instrumentation support to FreeBSD
Summary:
- Enabling the build.
- Using assembly for the cpuid parts.
- Using thr_self FreeBSD call to get the thread id
Patch by: David CARLIER
Reviewers: dberris, rnk, krytarowski
Reviewed By: dberris, krytarowski
Subscribers: emaste, stevecheckoway, nglevin, srhines, kubamracek, dberris, mgorny, krytarowski, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43278
llvm-svn: 325240
Sam McCall [Thu, 15 Feb 2018 14:16:17 +0000 (14:16 +0000)]
[clangd] Fix make_unique ambiguity, NFC
llvm-svn: 325239
Kamil Rytarowski [Thu, 15 Feb 2018 14:12:21 +0000 (14:12 +0000)]
Add Xray instrumentation compile-time/link-time support to FreeBSD
Summary: Similarly to the GNU driver version, adding proper compile and linker flags.
Patch by: David CARLIER
Reviewers: vitalybuka, krytarowski, dberris
Reviewed By: krytarowski, dberris
Subscribers: emaste, dberris, cfe-commits
Differential Revision: https://reviews.llvm.org/D43279
llvm-svn: 325238
Sanjay Patel [Thu, 15 Feb 2018 13:55:52 +0000 (13:55 +0000)]
[InstCombine] allow X / C -> X * (1.0/C) for vector splat FP constants
llvm-svn: 325237
Martin Bohme [Thu, 15 Feb 2018 13:50:07 +0000 (13:50 +0000)]
Add -no-canonical-prefixes to allow different build modes.
llvm-svn: 325236
Simon Pilgrim [Thu, 15 Feb 2018 13:33:15 +0000 (13:33 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS vXi32-vXi8 saturated truncation
We can use PACKSS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKSSWB to [-128,127].
PACKUS is a little trickier and will be handled in a separate patch.
llvm-svn: 325235
Momchil Velikov [Thu, 15 Feb 2018 13:29:33 +0000 (13:29 +0000)]
[DebugInfo] Accept enumeration types without underlying integer type present in
debug info metadata
... when generating DWARF.
Differential Revision: https://reviews.llvm.org/D43304
llvm-svn: 325234
Ilya Biryukov [Thu, 15 Feb 2018 13:15:47 +0000 (13:15 +0000)]
[clangd] Make functions of ClangdServer callback-based
Summary:
As a consequence, all LSP operations are now handled asynchronously,
i.e. they never block the main processing thread. However, if
-run-synchronously flag is specified, clangd still runs everything on
the main thread.
Reviewers: sammccall, ioeric, hokein
Reviewed By: sammccall, ioeric
Subscribers: klimek, jkorous-apple, cfe-commits
Differential Revision: https://reviews.llvm.org/D43227
llvm-svn: 325233
Simon Pilgrim [Thu, 15 Feb 2018 12:14:15 +0000 (12:14 +0000)]
[SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts
This is mainly a move of simplifyShuffleOperands from DAGCombiner::visitVECTOR_SHUFFLE to create a more general purpose TargetLowering::SimplifyDemandedVectorElts implementation.
Further features can be moved/added in future patches.
Differential Revision: https://reviews.llvm.org/D42896
llvm-svn: 325232
Sjoerd Meijer [Thu, 15 Feb 2018 10:33:07 +0000 (10:33 +0000)]
[ARM] f16 vcmp fixes
This adds f16 VCMP match rules and fixes the test cases.
Differential Revision: https://reviews.llvm.org/D43291
llvm-svn: 325228
Serge Pavlov [Thu, 15 Feb 2018 09:45:59 +0000 (09:45 +0000)]
Revert r325224 "Report fatal error in the case of out of memory"
It caused fails on some buildbots.
llvm-svn: 325227
Serge Pavlov [Thu, 15 Feb 2018 09:35:36 +0000 (09:35 +0000)]
Specify namespace for realloc
llvm-svn: 325226
Gabor Horvath [Thu, 15 Feb 2018 09:24:55 +0000 (09:24 +0000)]
[clang-tidy] Make a test pass on platforms where exceptions disabled by default.
llvm-svn: 325225
Serge Pavlov [Thu, 15 Feb 2018 09:20:26 +0000 (09:20 +0000)]
Report fatal error in the case of out of memory
Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.
Usual programming practice does not require checking result of 'operator
new' because it throws 'std::bad_alloc' in the case of allocation error.
However, LLVM is usually built with exceptions turned off, so 'new' can
return null pointer. This change installs custom new handler, which causes
fatal error in the case of out of memory. The handler is installed
automatically prior to call to 'main' during construction of a static
object defined in 'lib/Support/ErrorHandling.cpp'. If the application does
not use this file, the handler may be installed manually by a call to
'llvm::install_out_of_memory_new_handler', declared in
'include/llvm/Support/ErrorHandling.h".
There are calls to C allocation functions, malloc, calloc and realloc.
They are used for interoperability with C code, when allocated object has
variable size and when it is necessary to avoid call of constructors. In
many calls the result is not checked against null pointer. To simplify
checks, new functions are defined in the namespace 'llvm' with the
same names as these C function. These functions produce fatal error if
allocation fails. User should use 'llvm::malloc' instead of 'std::malloc'
in order to use the safe variant. This change replaces 'std::malloc'
in the cases when the result of allocation function is not checked against
null pointer.
Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statements are added.
Differential Revision: https://reviews.llvm.org/D43010
llvm-svn: 325224
Gabor Horvath [Thu, 15 Feb 2018 09:19:23 +0000 (09:19 +0000)]
[clang-tidy] Minor documentation fix
llvm-svn: 325223
Gabor Horvath [Thu, 15 Feb 2018 09:08:51 +0000 (09:08 +0000)]
[clang-tidy] New checker for exceptions that are created but not thrown
Patch by: Kristof Umann
Differential Revision: https://reviews.llvm.org/D43120
llvm-svn: 325222
Jacek Olesiak [Thu, 15 Feb 2018 08:47:56 +0000 (08:47 +0000)]
[clang-format] Improve ObjC headers detection
Summary: Detect ObjC characteristic types when they start a line and add additional keywords.
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43124
llvm-svn: 325221
Sam McCall [Thu, 15 Feb 2018 08:40:54 +0000 (08:40 +0000)]
[clangd] Fix tracing now that spans lifetimes can overlap on a thread.
Summary:
The chrome trace viewer requires events within a thread to strictly nest.
So we need to record the lifetime of the Span objects, not the contexts.
But we still want to show the relationship between spans where a context crosses
threads, so do this with flow events (i.e. arrows).
Before: https://photos.app.goo.gl/q4Dd9u9xtelaXk1v1
After: https://photos.app.goo.gl/5RNLmAMLZR3unvY83
(This could stand some further improvement, in particular I think we want a
container span whenever we schedule work on a thread. But that's another patch)
Reviewers: ioeric
Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits
Differential Revision: https://reviews.llvm.org/D43272
llvm-svn: 325220
Jonas Hahnfeld [Thu, 15 Feb 2018 08:10:22 +0000 (08:10 +0000)]
[CMake] Add -fno-experimental-isel for testing
GlobalISel doesn't yet implement blockaddress and falls back to
SelectionDAG. This results in additional branch instruction to
the next basic block which breaks the OMPT tests.
Disable GlobalISel for now when compiling the tests because fixing
them is not easily possible. See http://llvm.org/PR36313 for full
discussion history.
Differential Revision: https://reviews.llvm.org/D43195
llvm-svn: 325218
Andrew V. Tischenko [Thu, 15 Feb 2018 07:55:02 +0000 (07:55 +0000)]
(NFC)[MachineCombiner] Improve debug output.
llvm-svn: 325217
Max Kazantsev [Thu, 15 Feb 2018 07:47:17 +0000 (07:47 +0000)]
[NFC] Rename isKnownViaSimpleReasoning to isKnownViaNonRecursiveReasoning
llvm-svn: 325216
Max Kazantsev [Thu, 15 Feb 2018 07:13:18 +0000 (07:13 +0000)]
[NFC] Fix metadata placement in test
llvm-svn: 325215
Max Kazantsev [Thu, 15 Feb 2018 07:09:00 +0000 (07:09 +0000)]
[SCEV] Favor isKnownViaSimpleReasoning over constant ranges check
There is a more powerful but still simple function `isKnownViaSimpleReasoning ` that
does constant range check and few more additional checks. We use it some places (e.g.
when proving implications) and in some other places we only check constant ranges.
Currently, indvar simplifier fails to remove the check in following loop:
int inc = ...;
for (int i = inc, j = inc - 1; i < 200; ++i, ++j)
if (i > j) { ... }
This patch replaces all usages of `isKnownPredicateViaConstantRanges` with
`isKnownViaSimpleReasoning` to have smarter proofs. In particular, it fixes the
case above.
Reviewed-By: sanjoy
Differential Revision: https://reviews.llvm.org/D43175
llvm-svn: 325214
Igor Kudrin [Thu, 15 Feb 2018 06:13:52 +0000 (06:13 +0000)]
[ELF] Simplify handling of AT section attribute.
This also makes the behavior close to GNU ld's.
Differential Revision: https://reviews.llvm.org/D43284
llvm-svn: 325213
Kamil Rytarowski [Thu, 15 Feb 2018 03:36:16 +0000 (03:36 +0000)]
Teach sanitizer about NetBSD specific ioctl(2) calls
Summary:
Introduce handling of 1200 NetBSD specific ioctl(2) calls.
Over 100 operations are disabled as unavailable or conflicting
with the existing ones (the same operation number).
Add a script that generates the rules to detect ioctls on NetBSD.
The generate_netbsd_ioctls.awk script has been written
in NetBSD awk(1) (patched nawk) and is compatible with gawk.
Generate lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
with the awk(1) script.
Update sanitizer_platform_limits_netbsd accordingly to add the needed
definitions.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka, eugenis, dvyukov
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, mgorny, fedor.sergeev, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D41636
llvm-svn: 325212
Artem Dergachev [Thu, 15 Feb 2018 03:26:43 +0000 (03:26 +0000)]
[analyzer] Inline constructors for destroyable temporaries.
Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us
that we're indeed constructing a temporary, so we can trivially construct a
temporary region and inline the constructor.
Much like r325202, this is only done under the off-by-default
cfg-temporary-dtors flag because the temporary destructor, even if available,
will not be inlined and won't have the correct object value (target region).
Unless this is fixed, it is quite unsafe to inline the constructor.
If the temporary is lifetime-extended, the destructor would be an automatic
destructor, which would be evaluated with a "correct" target region - modulo
the series of incorrect relocations performed during the lifetime extension.
It means that at least, values within the object are guaranteed to be properly
escaped or invalidated.
Differential Revision: https://reviews.llvm.org/D43062
llvm-svn: 325211
Artem Dergachev [Thu, 15 Feb 2018 03:13:36 +0000 (03:13 +0000)]
[CFG] Provide construction contexts for temproary objects.
Constructors of C++ temporary objects that have destructors now can be queried
to discover that they're indeed constructing temporary objects.
The respective CXXBindTemporaryExpr, which is also repsonsible for destroying
the temporary at the end of full-expression, is now available at the
construction site in the CFG. This is all the context we need to provide for
temporary objects that are not lifetime extended. For lifetime-extended
temporaries, more context is necessary.
Differential Revision: https://reviews.llvm.org/D43056
llvm-svn: 325210
Artem Dergachev [Thu, 15 Feb 2018 02:51:58 +0000 (02:51 +0000)]
[analyzer] Decide on inlining destructors via EvalCallOptions.
EvalCallOptions were introduced in r324018 for allowing various parts of
ExprEngine to notify the inlining mechanism, while preparing for evaluating a
function call, of possible difficulties with evaluating the call that they
foresee. Then mayInlineCall() would still be a single place for making the
decision.
Use that mechanism for destructors as well - pass the necessary flags from the
CFG-element-specific destructor handlers.
Part of this patch accidentally leaked into r324018, which led into a change in
tests; this change is reverted now, because even though the change looked
correct, the underlying behavior wasn't. Both of these commits were not intended
to introduce any function changes otherwise.
Differential Revision: https://reviews.llvm.org/D42991
llvm-svn: 325209
Kamil Rytarowski [Thu, 15 Feb 2018 02:48:20 +0000 (02:48 +0000)]
Prevent recursive MSan interceptors in strftime(3) like functions
Summary:
This corrects intercepting this call on NetBSD without false positives.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, eugenis, vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42883
llvm-svn: 325208
Kamil Rytarowski [Thu, 15 Feb 2018 02:47:35 +0000 (02:47 +0000)]
Prevent recursive MSan interceptors in fgets(3)
Summary:
This corrects intercepting this call on NetBSD without false positives.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, eugenis, vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42884
llvm-svn: 325207
Kamil Rytarowski [Thu, 15 Feb 2018 02:43:02 +0000 (02:43 +0000)]
Add NetBSD syscall hooks skeleton in sanitizers
Summary:
Implement the skeleton of NetBSD syscall hooks for use with sanitizers.
Add a script that generates the rules to handle syscalls
on NetBSD: generate_netbsd_syscalls.awk. It has been written
in NetBSD awk(1) (patched nawk) and is compatible with gawk.
Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
that is a public header for applications, and included as:
<sanitizer_common/sanitizer_platform_limits_netbsd.h>.
Generate sanitizer_syscalls_netbsd.inc that defines all the
syscall rules for NetBSD. This file is modeled after the Linux
specific file: sanitizer_common_syscalls.inc.
Start recognizing NetBSD syscalls with existing sanitizers:
ASan, ESan, HWASan, TSan, MSan.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka, kcc, dvyukov, eugenis
Reviewed By: vitalybuka
Subscribers: hintonda, kubamracek, mgorny, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42048
llvm-svn: 325206
Eric Fiselier [Thu, 15 Feb 2018 02:41:19 +0000 (02:41 +0000)]
Fix test failure on compilers w/o deduction guides
llvm-svn: 325205
Rui Ueyama [Thu, 15 Feb 2018 02:40:58 +0000 (02:40 +0000)]
Fix an issue that lld drops symbol versions for -r.
When we are emitting a relocatable output, we should keep the original
symbol name including "@" part. Previously, we drop that part unconditionally
which resulted in dropping versions from symbols.
Differential Revision: https://reviews.llvm.org/D43307
llvm-svn: 325204
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:37:04 +0000 (02:37 +0000)]
Reapply r325193
llvm-svn: 325203