platform/upstream/llvm.git
5 years ago[llvm-objcopy] Use ELFOSABI_NONE instead of 0. NFC.
George Rimar [Thu, 20 Dec 2018 10:59:52 +0000 (10:59 +0000)]
[llvm-objcopy] Use ELFOSABI_NONE instead of 0. NFC.

This was requested during the review of D55886.
(sorry, forgot to address this)

llvm-svn: 349741

5 years ago[asan] Revert still Androind incompatible tests enabled in r349736
Vitaly Buka [Thu, 20 Dec 2018 10:56:34 +0000 (10:56 +0000)]
[asan] Revert still Androind incompatible tests enabled in r349736

llvm-svn: 349740

5 years ago[X86] Change 'simple nonmem' intrinsic test to not use PADDSW
Simon Pilgrim [Thu, 20 Dec 2018 10:54:59 +0000 (10:54 +0000)]
[X86] Change 'simple nonmem' intrinsic test to not use PADDSW

Those intrinsics will be autoupgraded soon to @llvm.sadd.sat generics (D55894), so to keep a x86-specific case I'm replacing it with @llvm.x86.sse2.pmulhu.w

llvm-svn: 349739

5 years ago[llvm-objcopy] - Do not drop the OS/ABI and ABIVersion fields of ELF header
George Rimar [Thu, 20 Dec 2018 10:51:42 +0000 (10:51 +0000)]
[llvm-objcopy] - Do not drop the OS/ABI and ABIVersion fields of ELF header

This is https://bugs.llvm.org/show_bug.cgi?id=40005,

Patch teaches llvm-objcopy to preserve OS/ABI and ABIVersion fields of ELF header.
(Currently, it drops them to zero).

Differential revision: https://reviews.llvm.org/D55886

llvm-svn: 349738

5 years ago[yaml2obj/obj2yaml] - Support dumping/parsing ABI version.
George Rimar [Thu, 20 Dec 2018 10:43:49 +0000 (10:43 +0000)]
[yaml2obj/obj2yaml] - Support dumping/parsing ABI version.

These tools were assuming ABI version is 0,
that is not always true.

Patch teaches them to work with that field.

Differential revision: https://reviews.llvm.org/D55884

llvm-svn: 349737

5 years ago[asan] Fix and re-enable few test on Android
Vitaly Buka [Thu, 20 Dec 2018 10:15:51 +0000 (10:15 +0000)]
[asan] Fix and re-enable few test on Android

llvm-svn: 349736

5 years ago[InstCombine][AMDGPU] Handle more buffer intrinsics
Piotr Sobczak [Thu, 20 Dec 2018 10:08:18 +0000 (10:08 +0000)]
[InstCombine][AMDGPU] Handle more buffer intrinsics

Summary:
Include the following intrinsics in the InsctCombine
simplification:

* amdgcn_raw_buffer_load
* amdgcn_raw_buffer_load_format
* amdgcn_struct_buffer_load
* amdgcn_struct_buffer_load_format

Change-Id: I14deceff74bcb21179baf6aa6e94bf39e7d63d5d

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D55882

llvm-svn: 349735

5 years ago[MSan] Don't emit __msan_instrument_asm_load() calls
Alexander Potapenko [Thu, 20 Dec 2018 10:05:00 +0000 (10:05 +0000)]
[MSan] Don't emit __msan_instrument_asm_load() calls

LLVM treats void* pointers passed to assembly routines as pointers to
sized types.
We used to emit calls to __msan_instrument_asm_load() for every such
void*, which sometimes led to false positives.
A less error-prone (and truly "conservative") approach is to unpoison
only assembly output arguments.

llvm-svn: 349734

5 years agoRevert r349731 "[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads."
Clement Courbet [Thu, 20 Dec 2018 09:58:33 +0000 (09:58 +0000)]
Revert r349731 "[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads."

Forgot to update PowerPC tests for the GEP->bitcast change.

llvm-svn: 349733

5 years ago[NFC] Fix trailing comma after function.
Clement Courbet [Thu, 20 Dec 2018 09:20:07 +0000 (09:20 +0000)]
[NFC] Fix trailing comma after function.

lib/Analysis/VectorUtils.cpp:482:2: warning: extra ‘;’ [-Wpedantic]

llvm-svn: 349732

5 years ago[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads.
Clement Courbet [Thu, 20 Dec 2018 09:13:47 +0000 (09:13 +0000)]
[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads.

Summary:
This allows expanding {7,11,13,14,15,21,22,23,25,26,27,28,29,30,31}-byte memcmp
in just two loads on X86. These were previously calling memcmp.

Reviewers: spatel, gchatelet

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D55263

llvm-svn: 349731

5 years ago[HWASAN] Add support for memory intrinsics
Eugene Leviant [Thu, 20 Dec 2018 09:10:03 +0000 (09:10 +0000)]
[HWASAN] Add support for memory intrinsics

This is patch complements D55117 implementing __hwasan_mem*
functions in runtime

Differential revision: https://reviews.llvm.org/D55554

llvm-svn: 349730

5 years ago[Sema] Better static assert diagnostics for expressions involving temporaries/casts...
Clement Courbet [Thu, 20 Dec 2018 09:05:15 +0000 (09:05 +0000)]
[Sema] Better static assert diagnostics for expressions involving temporaries/casts/....

Summary:
Handles expressions such as:
 - `std::is_const<T>()`
 - `std::is_const<T>()()`;
 - `std::is_same(decltype(U()), V>::value`;

Reviewers: aaron.ballman, Quuxplusone

Subscribers: cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D55552

llvm-svn: 349729

5 years ago[HWASAN] Add support for memory intrinsics
Eugene Leviant [Thu, 20 Dec 2018 09:04:33 +0000 (09:04 +0000)]
[HWASAN] Add support for memory intrinsics

Differential revision: https://reviews.llvm.org/D55117

llvm-svn: 349728

5 years ago[PowerPC] Implement the isSelectSupported() target hook
Kang Zhang [Thu, 20 Dec 2018 06:19:59 +0000 (06:19 +0000)]
[PowerPC] Implement the isSelectSupported() target hook

Summary:
PowerPC has scalar selects (isel) and vector mask selects (xxsel). But PowerPC
does not have vector CR selects, PowerPC does not support scalar condition
selects on vectors.
In addition to implementing this hook, isSelectSupported() should return false
when the SelectSupportKind is ScalarCondVectorVal, so that predictable selects
are converted into branch sequences.

Reviewed By: steven.zhang,  hfinkel

Differential Revision: https://reviews.llvm.org/D55754

llvm-svn: 349727

5 years ago[DAGCombiner] Fix a place that was creating a SIGN_EXTEND with an extra operand.
Craig Topper [Thu, 20 Dec 2018 05:28:06 +0000 (05:28 +0000)]
[DAGCombiner] Fix a place that was creating a SIGN_EXTEND with an extra operand.

llvm-svn: 349726

5 years agoIntroduce llvm.loop.parallel_accesses and llvm.access.group metadata.
Michael Kruse [Thu, 20 Dec 2018 04:58:07 +0000 (04:58 +0000)]
Introduce llvm.loop.parallel_accesses and llvm.access.group metadata.

The current llvm.mem.parallel_loop_access metadata has a problem in that
it uses LoopIDs. LoopID unfortunately is not loop identifier. It is
neither unique (there's even a regression test assigning the some LoopID
to multiple loops; can otherwise happen if passes such as LoopVersioning
make copies of entire loops) nor persistent (every time a property is
removed/added from a LoopID's MDNode, it will also receive a new LoopID;
this happens e.g. when calling Loop::setLoopAlreadyUnrolled()).
Since most loop transformation passes change the loop attributes (even
if it just to mark that a loop should not be processed again as
llvm.loop.isvectorized does, for the versioned and unversioned loop),
the parallel access information is lost for any subsequent pass.

This patch unlinks LoopIDs and parallel accesses.
llvm.mem.parallel_loop_access metadata on instruction is replaced by
llvm.access.group metadata. llvm.access.group points to a distinct
MDNode with no operands (avoiding the problem to ever need to add/remove
operands), called "access group". Alternatively, it can point to a list
of access groups. The LoopID then has an attribute
llvm.loop.parallel_accesses with all the access groups that are parallel
(no dependencies carries by this loop).

This intentionally avoid any kind of "ID". Loops that are clones/have
their attributes modifies retain the llvm.loop.parallel_accesses
attribute. Access instructions that a cloned point to the same access
group. It is not necessary for each access to have it's own "ID" MDNode,
but those memory access instructions with the same behavior can be
grouped together.

The behavior of llvm.mem.parallel_loop_access is not changed by this
patch, but should be considered deprecated.

Differential Revision: https://reviews.llvm.org/D52116

llvm-svn: 349725

5 years ago[WebAssembly] Emit a splat for v128 IMPLICIT_DEF
Thomas Lively [Thu, 20 Dec 2018 04:20:32 +0000 (04:20 +0000)]
[WebAssembly] Emit a splat for v128 IMPLICIT_DEF

Summary:
This is a code size savings and is also important to get runnable code
while engines do not support v128.const.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D55910

llvm-svn: 349724

5 years agoFix build errors introduced by r349712 on aarch64 bots.
Amara Emerson [Thu, 20 Dec 2018 03:27:42 +0000 (03:27 +0000)]
Fix build errors introduced by r349712 on aarch64 bots.

llvm-svn: 349723

5 years ago[lldbsuite] Un-xfail TestRedefinitionsInInlines on Windows
Stella Stamenova [Thu, 20 Dec 2018 03:04:14 +0000 (03:04 +0000)]
[lldbsuite] Un-xfail TestRedefinitionsInInlines on Windows

llvm-svn: 349722

5 years ago[lldbsuite] Un-xfail TestDataFormatterSynthVal on Windows
Stella Stamenova [Thu, 20 Dec 2018 02:22:09 +0000 (02:22 +0000)]
[lldbsuite] Un-xfail TestDataFormatterSynthVal on Windows

llvm-svn: 349721

5 years ago[WebAssembly] Gate unimplemented SIMD ops on flag
Thomas Lively [Thu, 20 Dec 2018 02:10:22 +0000 (02:10 +0000)]
[WebAssembly] Gate unimplemented SIMD ops on flag

Summary:
Gates v128.const, f32x4.sqrt, f32x4.div, i8x16.extract_lane_u, and
i16x8.extract_lane_u on the --wasm-enable-unimplemented-simd flag,
since these ops are not implemented yet in V8.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D55904

llvm-svn: 349720

5 years ago[lldbsuite] Un-xfail tests on Windows that are now passing (pt.5)
Stella Stamenova [Thu, 20 Dec 2018 02:04:01 +0000 (02:04 +0000)]
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.5)

This is a set of tests that were all marked as failing becuse of pr24764. The bug is not fixed (as in more of the tests that were marked this way are failing), but this set is passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green.

llvm-svn: 349719

5 years ago[lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type...
Kuba Mracek [Thu, 20 Dec 2018 02:01:59 +0000 (02:01 +0000)]
[lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

This builds on https://reviews.llvm.org/D43884 and https://reviews.llvm.org/D43886 and extends LLDB support of Obj-C exceptions to also look for a "current exception" for a thread in the C++ exception handling runtime metadata (via call to __cxa_current_exception_type). We also construct an actual historical SBThread/ThreadSP that contains frames from the backtrace in the Obj-C exception object.

The high level goal this achieves is that when we're already crashed (because an unhandled exception occurred), we can still access the exception object and retrieve the backtrace from the throw point. In Obj-C, this is particularly useful because a catch+rethrow is very common and in those cases you currently don't have any access to the throw point backtrace.

Differential Revision: https://reviews.llvm.org/D44072

llvm-svn: 349718

5 years agoRemove pointless casts.
Evgeniy Stepanov [Thu, 20 Dec 2018 01:49:21 +0000 (01:49 +0000)]
Remove pointless casts.

llvm-svn: 349717

5 years agoAMDGPU: Make i1/i64/v2i32 and/or/xor legal
Matt Arsenault [Thu, 20 Dec 2018 01:35:49 +0000 (01:35 +0000)]
AMDGPU: Make i1/i64/v2i32 and/or/xor legal

The 64-bit types do depend on the register bank,
but that's another issue to deal with later.

llvm-svn: 349716

5 years agoAMDGPU/GlobalISel: Fix ValueMapping tables for i1
Matt Arsenault [Thu, 20 Dec 2018 01:33:43 +0000 (01:33 +0000)]
AMDGPU/GlobalISel: Fix ValueMapping tables for i1

This was incorrectly selecting SGPR for any i1 values,
e.g. G_TRUNC to i1 from a VGPR was still an SGPR.

llvm-svn: 349715

5 years ago[X86] Disable custom widening of signed/unsigned add/sub saturation intrinsics under...
Craig Topper [Thu, 20 Dec 2018 01:32:06 +0000 (01:32 +0000)]
[X86] Disable custom widening of signed/unsigned add/sub saturation intrinsics under -x86-experimental-vector-widening-legalization.

Generic legalization should take care of this.

llvm-svn: 349714

5 years ago[lldbsuite] Un-xfail tests on Windows that are now passing (pt.4)
Stella Stamenova [Thu, 20 Dec 2018 01:25:35 +0000 (01:25 +0000)]
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.4)

This is a set of tests that were all marked as failing becuse of several different bugs. A couple of the bugs are now resolved as fixed since all the tests that were failing associated with the bug are now passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green.

llvm-svn: 349713

5 years ago[AArch64][GlobalISel] Implement selection og G_MERGE of two s32s into s64.
Amara Emerson [Thu, 20 Dec 2018 01:11:04 +0000 (01:11 +0000)]
[AArch64][GlobalISel] Implement selection og G_MERGE of two s32s into s64.

This code pattern is an unfortunate side effect of the way some types get split
at call lowering. Ideally we'd either not generate it at all or combine it away
in the legalizer artifact combiner.

Until then, add selection support anyway which is a significant proportion of
our current fallbacks on CTMark.

rdar://46491420

llvm-svn: 349712

5 years ago[lldbsuite] Un-xfail tests on Windows that are now passing (pt.3)
Stella Stamenova [Thu, 20 Dec 2018 00:58:48 +0000 (00:58 +0000)]
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.3)

This is a set of tests that were all marked as failing becuse of several different bugs. A couple of the bugs are now resolved as fixed since all the tests that were failing associated with the bug are now passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green.

llvm-svn: 349711

5 years ago[binutils] NFC: fix clang-tidy warning: use empty() instead of size() == 0
Jordan Rupprecht [Thu, 20 Dec 2018 00:57:06 +0000 (00:57 +0000)]
[binutils] NFC: fix clang-tidy warning: use empty() instead of size() == 0

llvm-svn: 349710

5 years agoAMDGPU/GlobalISel: RegBankSelect for fp conversions
Matt Arsenault [Thu, 20 Dec 2018 00:37:02 +0000 (00:37 +0000)]
AMDGPU/GlobalISel: RegBankSelect for fp conversions

llvm-svn: 349709

5 years agoAMDGPU/GlobalISel: Legality/regbankselect for atomicrmw/atomic_cmpxchg
Matt Arsenault [Thu, 20 Dec 2018 00:33:49 +0000 (00:33 +0000)]
AMDGPU/GlobalISel: Legality/regbankselect for atomicrmw/atomic_cmpxchg

llvm-svn: 349708

5 years ago[asan] Undo special treatment of linkonce_odr and weak_odr
Vitaly Buka [Thu, 20 Dec 2018 00:30:27 +0000 (00:30 +0000)]
[asan] Undo special treatment of linkonce_odr and weak_odr

Summary:
On non-Windows these are already removed by ShouldInstrumentGlobal.
On Window we will wait until we get actual issues with that.

Reviewers: pcc

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D55899

llvm-svn: 349707

5 years ago[asan] Prevent folding of globals with redzones
Vitaly Buka [Thu, 20 Dec 2018 00:30:18 +0000 (00:30 +0000)]
[asan] Prevent folding of globals with redzones

Summary:
ICF prevented by removing unnamed_addr and local_unnamed_addr for all sanitized
globals.
Also in general unnamed_addr is not valid here as address now is important for
ODR violation detector and redzone poisoning.

Before the patch ICF on globals caused:
1. false ODR reports when we register global on the same address more than once
2. globals buffer overflow if we fold variables of smaller type inside of large
type. Then the smaller one will poison redzone which overlaps with the larger one.

Reviewers: eugenis, pcc

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D55857

llvm-svn: 349706

5 years ago[asan] Disable test incompatible with new Android
Vitaly Buka [Thu, 20 Dec 2018 00:24:09 +0000 (00:24 +0000)]
[asan] Disable test incompatible with new Android

llvm-svn: 349705

5 years ago[gn build] Make `ninja check-lld` also run LLD's unit tests
Nico Weber [Thu, 20 Dec 2018 00:04:10 +0000 (00:04 +0000)]
[gn build] Make `ninja check-lld` also run LLD's unit tests

And add build files for gtest.

With this, the build files for //lld are complete.

Differential Revision: https://reviews.llvm.org/D55838

llvm-svn: 349704

5 years ago[DwarfExpression] Fix a typo in a doxygen comment. NFC.
Matt Davis [Thu, 20 Dec 2018 00:01:57 +0000 (00:01 +0000)]
[DwarfExpression] Fix a typo in a doxygen comment. NFC.

llvm-svn: 349703

5 years ago[gn build] Add check-lld target and make it work
Nico Weber [Wed, 19 Dec 2018 23:52:16 +0000 (23:52 +0000)]
[gn build] Add check-lld target and make it work

Also add a build file for llvm-lit, which in turn needs llvm/tools/llvm-config.

With this, check-lld runs and passes all of lld's lit tests. It doesn't run any
of its unit tests yet.

Running just ninja -C out/gn will build all prerequisites needed to run tests,
but it won't run the tests (so that the build becomes clean after one build).
Running ninja -C out/gn check-lld will build prerequisites if needed and run
the tests. The check-lld target never becomes clean and runs tests every time.

llvm-config's build file is a bit gnarly: Everything not needed to run tests is
basically stubbed out. Also, to generate LibraryDependencies.inc we shell out
to llvm-build at build-time. It would be much nicer to get the library
dependencies by using the dependency data the GN build contains
(http://llvm-cs.pcc.me.uk/gen/tools/llvm-config/LibraryDependencies.inc#1).

Differential Revision: https://reviews.llvm.org/D55836

llvm-svn: 349702

5 years ago[analyzer] pr38668: Do not attempt to cast loaded values of non-scalar types.
Artem Dergachev [Wed, 19 Dec 2018 23:48:44 +0000 (23:48 +0000)]
[analyzer] pr38668: Do not attempt to cast loaded values of non-scalar types.

It is expected to have the same object (memory region) treated as if it has
different types in different program points. The correct behavior for
RegionStore when an object is stored as an object of type T1 but loaded as
an object of type T2 is to store the object as if it has type T1 but cast it
to T2 during load.

Note that the cast here is some sort of a "reinterpret_cast" (even in C). For
instance, if you store a float and load an integer, you won't have your float
rounded to an integer; instead, you will have garbage.

Admit that we cannot perform the cast as long as types we're dealing with are
non-trivial (neither integers, nor pointers).

Of course, if the cast is not necessary (eg, T1 == T2), we can still load the
value just fine.

Differential Revision: https://reviews.llvm.org/D55875

rdar://problem/45062567

llvm-svn: 349701

5 years agoSimplify code for readability. (NFC)
Adrian Prantl [Wed, 19 Dec 2018 23:48:40 +0000 (23:48 +0000)]
Simplify code for readability. (NFC)

llvm-svn: 349700

5 years ago[sanitizer] Support running without fd 0,1,2.
Evgeniy Stepanov [Wed, 19 Dec 2018 23:45:17 +0000 (23:45 +0000)]
[sanitizer] Support running without fd 0,1,2.

Summary:
Support running with no open file descriptors (as may happen to
"init" process on linux).
* Remove a check that writing to stderr succeeds.
* When opening a file (ex. for log_path option), dup the new fd out of
[0, 2] range to avoid confusing the program.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D55801

llvm-svn: 349699

5 years ago[analyzer] GenericTaint: Fix formatting to prepare for incoming improvements.
Artem Dergachev [Wed, 19 Dec 2018 23:35:08 +0000 (23:35 +0000)]
[analyzer] GenericTaint: Fix formatting to prepare for incoming improvements.

Patch by Gábor Borsik!

Differential Revision: https://reviews.llvm.org/D54918

llvm-svn: 349698

5 years agoSimplify. NFC.
Rui Ueyama [Wed, 19 Dec 2018 23:25:02 +0000 (23:25 +0000)]
Simplify. NFC.

Differential Revision: https://reviews.llvm.org/D55903

llvm-svn: 349697

5 years ago[analyzer] Improve modeling for returning an object from the top frame with RVO.
Artem Dergachev [Wed, 19 Dec 2018 23:14:06 +0000 (23:14 +0000)]
[analyzer] Improve modeling for returning an object from the top frame with RVO.

Static Analyzer processes the program function-by-function, sometimes diving
into other functions ("inlining" them). When an object is returned from an
inlined function, Return Value Optimization is modeled, and the returned object
is constructed at its return location directly.

When an object is returned from the function from which the analysis has started
(the top stack frame of the analysis), the return location is unknown. Model it
with a SymbolicRegion based on a conjured symbol that is specifically tagged for
that purpose, because this is generally the correct way to symbolicate
unknown locations in Static Analyzer.

Fixes leak false positives when an object is returned from top frame in C++17:
objects that are put into a SymbolicRegion-based memory region automatically
"escape" and no longer get reported as leaks. This only applies to C++17 return
values with destructors, because it produces a redundant CXXBindTemporaryExpr
in the call site, which confuses our liveness analysis. The actual fix
for liveness analysis is still pending, but it is no longer causing problems.

Additionally, re-enable temporary destructor tests in C++17.

Differential Revision: https://reviews.llvm.org/D55804

rdar://problem/46217550

llvm-svn: 349696

5 years ago[X86] Remove TLI variable from ReplaceNodeResults. NFC
Craig Topper [Wed, 19 Dec 2018 23:13:03 +0000 (23:13 +0000)]
[X86] Remove TLI variable from ReplaceNodeResults. NFC

We're already in X86TargetLowering which is a derived class of TargetLowering. We can just call methods directly.

llvm-svn: 349695

5 years agoAMDGPU: Add patterns for v4i16/v4f16 -> v4i16/v4f16 bitcasts
Rhys Perry [Wed, 19 Dec 2018 22:53:33 +0000 (22:53 +0000)]
AMDGPU: Add patterns for v4i16/v4f16 -> v4i16/v4f16 bitcasts

Reviewers: arsenm, tstellar

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D55058

llvm-svn: 349694

5 years ago[CodeGenPrepare] Fix bad IR created by large offset GEP splitting.
Eli Friedman [Wed, 19 Dec 2018 22:52:04 +0000 (22:52 +0000)]
[CodeGenPrepare] Fix bad IR created by large offset GEP splitting.

Creating the IR builder, then modifying the CFG, leads to an IRBuilder
where the BB and insertion point are inconsistent, so new instructions
have the wrong parent.

Modified an existing test because the test wasn't covering anything
useful (the "invoke" was not actually an invoke by the time we hit the
code in question).

Differential Revision: https://reviews.llvm.org/D55729

llvm-svn: 349693

5 years agoFix line endings.
Zachary Turner [Wed, 19 Dec 2018 22:50:22 +0000 (22:50 +0000)]
Fix line endings.

llvm-svn: 349692

5 years agoDisable -faddsig by default for PS4 target.
Douglas Yung [Wed, 19 Dec 2018 22:45:26 +0000 (22:45 +0000)]
Disable -faddsig by default for PS4 target.

llvm-svn: 349691

5 years agoFix test commit
Rhys Perry [Wed, 19 Dec 2018 22:33:42 +0000 (22:33 +0000)]
Fix test commit

Seems that was actually a eight space tab...

llvm-svn: 349690

5 years agoTest commit
Rhys Perry [Wed, 19 Dec 2018 22:26:51 +0000 (22:26 +0000)]
Test commit

Replace tab with 4 spaces.

llvm-svn: 349689

5 years ago[llvm-mca] Rename directory for the Cortex tests (NFC)
Evandro Menezes [Wed, 19 Dec 2018 22:24:42 +0000 (22:24 +0000)]
[llvm-mca] Rename directory for the Cortex tests (NFC)

llvm-svn: 349688

5 years ago[llvm-mca] Update Exynos test cases (NFC)
Evandro Menezes [Wed, 19 Dec 2018 22:24:39 +0000 (22:24 +0000)]
[llvm-mca] Update Exynos test cases (NFC)

llvm-svn: 349687

5 years ago[AArch64] Improve Exynos predicates
Evandro Menezes [Wed, 19 Dec 2018 22:24:36 +0000 (22:24 +0000)]
[AArch64] Improve Exynos predicates

Expand the predicate `ExynosResetPred` to include all forms of immediate
moves.

llvm-svn: 349686

5 years ago[AArch64] Use canonical copy idiom
Evandro Menezes [Wed, 19 Dec 2018 22:24:31 +0000 (22:24 +0000)]
[AArch64] Use canonical copy idiom

Use only the canonical form of the alias for register transfers in the
`IsCopyIdiomPred` predicate.

llvm-svn: 349685

5 years agoRevert "[BDCE][DemandedBits] Detect dead uses of undead instructions"
Nikita Popov [Wed, 19 Dec 2018 22:09:02 +0000 (22:09 +0000)]
Revert "[BDCE][DemandedBits] Detect dead uses of undead instructions"

This reverts commit r349674. It causes a failure in
test-suite enc-3des.execution_time.

llvm-svn: 349684

5 years ago[analyzer] CStringChecker: Add the forgotten test file.
Artem Dergachev [Wed, 19 Dec 2018 21:51:59 +0000 (21:51 +0000)]
[analyzer] CStringChecker: Add the forgotten test file.

Differential Revision: https://reviews.llvm.org/D55873

rdar://problem/45366551

llvm-svn: 349683

5 years ago[analyzer] CStringChecker: Fix a crash on C++ overloads of standard functions.
Artem Dergachev [Wed, 19 Dec 2018 21:50:46 +0000 (21:50 +0000)]
[analyzer] CStringChecker: Fix a crash on C++ overloads of standard functions.

It turns out that it's not all that uncommon to have a C++ override of, say,
memcpy that receives a structure (or two) by reference (or by value, if it's
being copied from) and copies memory from it (or into it, if it's passed
by reference). In this case the argument will be of structure type (recall that
expressions of reference type do not exist: instead, C++ classifies expressions
into prvalues and lvalues and xvalues).

In this scenario we crash because we are trying to assume that, say,
a memory region is equal to an empty CompoundValue (the non-lazy one; this is
what makeZeroVal() return for compound types and it represents prvalue of
an object that is initialized with an empty initializer list).

Add defensive checks.

Differential Revision: https://reviews.llvm.org/D55873

rdar://problem/45366551

llvm-svn: 349682

5 years ago[llvm-ar] Simplify string table get-or-insert pattern with .insert, NFC
Reid Kleckner [Wed, 19 Dec 2018 20:54:06 +0000 (20:54 +0000)]
[llvm-ar] Simplify string table get-or-insert pattern with .insert, NFC

llvm-svn: 349681

5 years ago[x86] add test to show ddup hole; NFC (PR37502)
Sanjay Patel [Wed, 19 Dec 2018 20:35:28 +0000 (20:35 +0000)]
[x86] add test to show ddup hole; NFC (PR37502)

llvm-svn: 349680

5 years ago[gn build] Add build file for clang/lib/Basic and dependencies, 2nd try
Nico Weber [Wed, 19 Dec 2018 20:21:49 +0000 (20:21 +0000)]
[gn build] Add build file for clang/lib/Basic and dependencies, 2nd try

Adds a build file for clang-tblgen and an action for running it, and uses that
to process all the .td files in include/clang/Basic.

Also adds an action to write include/clang/Config/config.h and
include/clang/Basic/Version.inc.

Differential Revision: https://reviews.llvm.org/D55847

(The previous commit of this contained unrelated changes, so I reverted the
whole previous commit and I'm now landing only what I intended to land.)

llvm-svn: 349679

5 years agoRevert 349677, it contained a whole bunch of stuff I did not mean to commit
Nico Weber [Wed, 19 Dec 2018 20:19:58 +0000 (20:19 +0000)]
Revert 349677, it contained a whole bunch of stuff I did not mean to commit

llvm-svn: 349678

5 years ago[gn build] Add build file for clang/lib/Basic and dependencies
Nico Weber [Wed, 19 Dec 2018 20:18:59 +0000 (20:18 +0000)]
[gn build] Add build file for clang/lib/Basic and dependencies

Adds a build file for clang-tblgen and an action for running it, and uses that
to process all the .td files in include/clang/Basic.

Also adds an action to write include/clang/Config/config.h and
include/clang/Basic/Version.inc.

Differential Revision: https://reviews.llvm.org/D55847

llvm-svn: 349677

5 years ago[libcxx] Use custom allocator's `construct` in C++03 when available.
Volodymyr Sapsai [Wed, 19 Dec 2018 20:08:43 +0000 (20:08 +0000)]
[libcxx] Use custom allocator's `construct` in C++03 when available.

Makes libc++ behavior consistent between C++03 and C++11.

Can use `decltype` in C++03 because `include/__config` defines a macro when
`decltype` is not available.

Reviewers: mclow.lists, EricWF, erik.pilkington, ldionne

Reviewed By: ldionne

Subscribers: dexonsmith, cfe-commits, howard.hinnant, ldionne, christof, jkorous, Quuxplusone

Differential Revision: https://reviews.llvm.org/D48753

llvm-svn: 349676

5 years ago[NativePDB] Enable function-level-linking.test in native mode.
Zachary Turner [Wed, 19 Dec 2018 20:00:25 +0000 (20:00 +0000)]
[NativePDB] Enable function-level-linking.test in native mode.

This test passes with the native reader, so run it in both modes.

llvm-svn: 349675

5 years ago[BDCE][DemandedBits] Detect dead uses of undead instructions
Nikita Popov [Wed, 19 Dec 2018 19:56:21 +0000 (19:56 +0000)]
[BDCE][DemandedBits] Detect dead uses of undead instructions

This (mostly) fixes https://bugs.llvm.org/show_bug.cgi?id=39771.

BDCE currently detects instructions that don't have any demanded bits
and replaces their uses with zero. However, if an instruction has
multiple uses, then some of the uses may be dead (have no demanded bits)
even though the instruction itself is still live. This patch extends
DemandedBits/BDCE to detect such uses and replace them with zero.
While this will not immediately render any instructions dead, it may
lead to simplifications (in the motivating case, by converting a rotate
into a simple shift), break dependencies, etc.

The implementation tries to strike a balance between analysis power and
complexity/memory usage. Originally I wanted to track demanded bits on
a per-use level, but ultimately we're only really interested in whether
a use is entirely dead or not. I'm using an extra set to track which uses
are dead. However, as initially all uses are dead, I'm not storing uses
those user is also dead. This case is checked separately instead.

The test case has a couple of cases that are not simplified yet. In
particular, we're only looking at uses of instructions right now. I think
it would make sense to also extend this to arguments. Furthermore
DemandedBits doesn't yet know some of the tricks that InstCombine does
for the demanded bits or bitwise or/and/xor in combination with known
bits information.

Differential Revision: https://reviews.llvm.org/D55563

llvm-svn: 349674

5 years ago[NativePDB] Fix a use after free and enable corresponding native test.
Zachary Turner [Wed, 19 Dec 2018 19:45:30 +0000 (19:45 +0000)]
[NativePDB] Fix a use after free and enable corresponding native test.

We had a use after free where we were assigning the result of a function
that returned a string to a StringRef.  After fixing this use after
free, one of the DIA PDB tests now passes with the native PDB reader,
so we enable the test under native mode as well.  The goal is to
eventually make all the tests pass under both, at which point we can
disable them all under DIA mode.

llvm-svn: 349673

5 years agoRe-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
Alexandre Ganea [Wed, 19 Dec 2018 19:42:21 +0000 (19:42 +0000)]
Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
(was reverted by mistake)

llvm-svn: 349672

5 years ago[X86] Remove a bunch of 'else' after returns in reduceVMULWidth. NFC
Craig Topper [Wed, 19 Dec 2018 19:39:34 +0000 (19:39 +0000)]
[X86] Remove a bunch of 'else' after returns in reduceVMULWidth. NFC

This reduces indentation and makes it obvious this function always returns something.

llvm-svn: 349671

5 years agollvm-dwarfdump: Improve/fix pretty printing of array dimensions
David Blaikie [Wed, 19 Dec 2018 19:34:24 +0000 (19:34 +0000)]
llvm-dwarfdump: Improve/fix pretty printing of array dimensions

This is to address post-commit feedback from Paul Robinson on r348954.

The original commit misinterprets count and upper bound as the same thing (I thought I saw GCC producing an upper bound the same as Clang's count, but GCC correctly produces an upper bound that's one less than the count (in C, that is, where arrays are zero indexed)).

I want to preserve the C-like output for the common case, so in the absence of a lower bound the count (or one greater than the upper bound) is rendered between []. In the trickier cases, where a lower bound is specified, a half-open range is used (eg: lower bound 1, count 2 would be "[1, 3)" and an unknown parts use a '?' (eg: "[1, ?)" or "[?, 7)" or "[?, ? + 3)").

Reviewers: aprantl, probinson, JDevlieghere

Differential Revision: https://reviews.llvm.org/D55721

llvm-svn: 349670

5 years agoPR40096: Forwards-compatible with C++20 rule regarding aggregates not having user...
David Blaikie [Wed, 19 Dec 2018 19:33:35 +0000 (19:33 +0000)]
PR40096: Forwards-compatible with C++20 rule regarding aggregates not having user-declared ctors

Looks like these were in place to make these types move-only. That's
generally not a feature that the type should prescribe (unless it's an
inherent limitation) - instead leaving it up to the users of a type.

llvm-svn: 349669

5 years ago[lldbsuite] Un-xfail tests on Windows that are now passing (pt.2)
Stella Stamenova [Wed, 19 Dec 2018 19:10:25 +0000 (19:10 +0000)]
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.2)

This is a set of tests that were all marked as failing becuse of pr21765. The bug is not fixed (as in more of the tests that were marked this way are failing), but this set is passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green.

llvm-svn: 349668

5 years ago[ThinLTO] Remove dllimport attribute from locally defined symbols
Matthew Voss [Wed, 19 Dec 2018 19:07:45 +0000 (19:07 +0000)]
[ThinLTO] Remove dllimport attribute from locally defined symbols

Summary:
The LTO/ThinLTO driver currently creates invalid bitcode by setting
symbols marked dllimport as dso_local. The compiler often has access
to the definition (often dllexport) and the declaration (often
dllimport) of an object at link-time, leading to a conflicting
declaration. This patch resolves the inconsistency by removing the
dllimport attribute.

Reviewers: tejohnson, pcc, rnk, echristo

Reviewed By: rnk

Subscribers: dmikulin, wristow, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, dang, llvm-commits

Differential Revision: https://reviews.llvm.org/D55627

llvm-svn: 349667

5 years ago[sanitizer] Remove spurious semi-colon
Kostya Kortchinsky [Wed, 19 Dec 2018 19:05:29 +0000 (19:05 +0000)]
[sanitizer] Remove spurious semi-colon

Summary:
An extra ';' at the end of a namespace triggers a pedantic warning:
```
.../sanitizer_common/sanitizer_type_traits.h:42:2: warning: extra ‘;’ [-Wpedantic]
 };  // namespace __sanitizer
```

Reviewers: eugenis, delcypher

Reviewed By: eugenis

Subscribers: kubamracek, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D55849

llvm-svn: 349666

5 years ago[lldbsuite] Un-xfail tests on Windows that are now passing
Stella Stamenova [Wed, 19 Dec 2018 19:04:01 +0000 (19:04 +0000)]
[lldbsuite] Un-xfail tests on Windows that are now passing

This is a set of tests that were all marked as failing becuse of pr24489. The bug is not fixed (as in more of the tests that were marked this way are failing), but this set is passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green.

llvm-svn: 349665

5 years ago[GlobalISel][AArch64] Add support for @llvm.ceil
Jessica Paquette [Wed, 19 Dec 2018 19:01:36 +0000 (19:01 +0000)]
[GlobalISel][AArch64] Add support for @llvm.ceil

This adds a G_FCEIL generic instruction and uses it in AArch64. This adds
selection for floating point ceil where it has a supported, dedicated
instruction. Other cases aren't handled here.

It updates the relevant gisel tests and adds a select-ceil test. It also adds a
check to arm64-vcvt.ll which ensures that we don't fall back when we run into
one of the relevant cases.

llvm-svn: 349664

5 years agoWork around GCC 9.0 regression
Eric Fiselier [Wed, 19 Dec 2018 18:58:22 +0000 (18:58 +0000)]
Work around GCC 9.0 regression

llvm-svn: 349663

5 years ago[llvm-mca] Rename an error variable.
Matt Davis [Wed, 19 Dec 2018 18:57:43 +0000 (18:57 +0000)]
[llvm-mca] Rename an error variable.

llvm-svn: 349662

5 years ago[X86] Don't match TESTrr from (cmp (and X, Y), 0) during isel. Defer to post processing
Craig Topper [Wed, 19 Dec 2018 18:49:13 +0000 (18:49 +0000)]
[X86] Don't match TESTrr from (cmp (and X, Y), 0) during isel. Defer to post processing

The (cmp (and X, Y) 0) pattern is greedy and ends up forming a TESTrr and consuming the and when it might be better to use one of the BMI/TBM like BLSR or BLSI.

This patch moves removes the pattern from isel and adds a post processing check to combine TESTrr+ANDrr into just a TESTrr. With this patch we are able to select the BMI/TBM instructions, but we'll also emit a TESTrr when the result is compared to 0. In many cases the peephole pass will be able to use optimizeCompareInstr to remove the TEST, but its probably not perfect.

Differential Revision: https://reviews.llvm.org/D55870

llvm-svn: 349661

5 years ago[X86] Fix assert fails in pass X86AvoidSFBPass
Craig Topper [Wed, 19 Dec 2018 18:45:57 +0000 (18:45 +0000)]
[X86] Fix assert fails in pass X86AvoidSFBPass

Fixes https://bugs.llvm.org/show_bug.cgi?id=38743

The function removeRedundantBlockingStores is supposed to remove any blocking stores contained in each other in lockingStoresDispSizeMap.
But it currently looks only at the previous one, which will miss some cases that result in assert.

This patch refine the function to check all previous layouts until find the uncontained one. So all redundant stores will be removed.

Patch by Pengfei Wang

Differential Revision: https://reviews.llvm.org/D55642

llvm-svn: 349660

5 years ago [llvm-mca] Add an error handler for error from parseCodeRegions
Matt Davis [Wed, 19 Dec 2018 18:27:05 +0000 (18:27 +0000)]
 [llvm-mca] Add an error handler for error from parseCodeRegions

Summary:
It's a bit tricky to add a test for the failing path right now, binary support will have an easier path to exercise the path here.

* Ran clang-format.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D55803

llvm-svn: 349659

5 years agoShow the memory region name if there is one in the output of the "memory region"...
Greg Clayton [Wed, 19 Dec 2018 18:16:52 +0000 (18:16 +0000)]
Show the memory region name if there is one in the output of the "memory region" command

Prior to this change we would show the name of the section that a memory region belonged to but not its actual region name. Now we show this,. Added a test that reuses the regions-linux-map.dmp minidump file to test this and verify the correct region names for various memory regions.

Differential Revision: https://reviews.llvm.org/D55854

llvm-svn: 349658

5 years ago[OPENMP]Mark the loop as started when initialized.
Alexey Bataev [Wed, 19 Dec 2018 18:16:37 +0000 (18:16 +0000)]
[OPENMP]Mark the loop as started when initialized.

Need to mark the loop as started when the initialization statement is
found. It is required to prevent possible incorrect loop iteraton
variable detection during template instantiation and fix the compiler
crash during the codegen.

llvm-svn: 349657

5 years agoRevert r349517 "[CMake] Default options for faster executables on MSVC"
Alexandre Ganea [Wed, 19 Dec 2018 18:01:42 +0000 (18:01 +0000)]
Revert r349517 "[CMake] Default options for faster executables on MSVC"

llvm-svn: 349656

5 years ago[CodeComplete] Properly determine qualifiers of 'this' in a lambda
Ilya Biryukov [Wed, 19 Dec 2018 18:01:24 +0000 (18:01 +0000)]
[CodeComplete] Properly determine qualifiers of 'this' in a lambda

Summary:
The clang used to pick up the qualifiers of the lamba's call operator
(which is always const) and fail to show non-const methods of 'this' in
completion results.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D55885

llvm-svn: 349655

5 years agoRevert r349517 "[CMake] Default options for faster executables on MSVC"
Alexandre Ganea [Wed, 19 Dec 2018 17:57:31 +0000 (17:57 +0000)]
Revert r349517 "[CMake] Default options for faster executables on MSVC"

llvm-svn: 349654

5 years agoInitial PSTL commit
JF Bastien [Wed, 19 Dec 2018 17:45:32 +0000 (17:45 +0000)]
Initial PSTL commit

The initial commit of the Parallel STL upstream (under LLVM umbrella) based on
Parallel STL 20181204 open source release, which is available by
https://github.com/intel/parallelstl

Author: Mikhail Dvorskiy <mikhail.dvorskiy@intel.com>

Differential Revision: https://reviews.llvm.org/D55889

llvm-svn: 349653

5 years ago[AArch64] Improve the Exynos M3 pipeline model
Evandro Menezes [Wed, 19 Dec 2018 17:37:51 +0000 (17:37 +0000)]
[AArch64] Improve the Exynos M3 pipeline model

llvm-svn: 349652

5 years ago[llvm-mca] Split test (NFC)
Evandro Menezes [Wed, 19 Dec 2018 17:37:14 +0000 (17:37 +0000)]
[llvm-mca] Split test (NFC)

Split the Exynos test of the register offset addressing mode into separate
loads and stores tests.

llvm-svn: 349651

5 years ago[Driver] [NetBSD] Add -D_REENTRANT when using sanitizers
Michal Gorny [Wed, 19 Dec 2018 17:25:59 +0000 (17:25 +0000)]
[Driver] [NetBSD] Add -D_REENTRANT when using sanitizers

NetBSD intends to support only reentrant interfaces in interceptors.
When -lpthread is used without _REENTRANT defined, things are
not guaranteed to work.

This is especially important for <stdio.h> and sanitization of
interfaces around FILE.  Some APIs have alternative modes depending
on the _REENTRANT definition, and NetBSD intends to support sanitization
of the _REENTRANT ones.

Differential Revision: https://reviews.llvm.org/D55654

llvm-svn: 349650

5 years ago[Driver] Add .hasAnySanitizer() to SanitizerArgs
Michal Gorny [Wed, 19 Dec 2018 17:25:55 +0000 (17:25 +0000)]
[Driver] Add .hasAnySanitizer() to SanitizerArgs

Add a simple method to query whether any sanitizer was enabled,
via SanitizerArgs.  This will be used in the NetBSD driver to pass
additional definitions that are required by all sanitizers.

Differential Revision: https://reviews.llvm.org/D55832

llvm-svn: 349649

5 years ago[Basic] Correct description of SanitizerSet.empty()
Michal Gorny [Wed, 19 Dec 2018 17:25:51 +0000 (17:25 +0000)]
[Basic] Correct description of SanitizerSet.empty()

Differential Revision: https://reviews.llvm.org/D55830

llvm-svn: 349648

5 years ago[Driver] Disable -faddrsig by default on NetBSD
Michal Gorny [Wed, 19 Dec 2018 17:25:46 +0000 (17:25 +0000)]
[Driver] Disable -faddrsig by default on NetBSD

Avoid passing -faddrsig by default on NetBSD.  This platform is still
using old GNU binutils that crashes on executables containing those
sections.

Differential Revision: https://reviews.llvm.org/D55828

llvm-svn: 349647

5 years agoRegenerate test
Simon Pilgrim [Wed, 19 Dec 2018 17:24:34 +0000 (17:24 +0000)]
Regenerate test

llvm-svn: 349646

5 years ago[sanitizer_common] Fix sha2 interceptors not to use vars in array len
Michal Gorny [Wed, 19 Dec 2018 17:22:14 +0000 (17:22 +0000)]
[sanitizer_common] Fix sha2 interceptors not to use vars in array len

Fix the sha2 interceptor macros to use a constant for array parameter
length rather than referencing the extern variable.  Since the digest
length is provided in hash name, reuse the macro parameter for it.
Verify that the calculated value matches the one provided by system
headers.

Differential Revision: https://reviews.llvm.org/D55811

llvm-svn: 349645

5 years agoTest commit
Anton Afanasyev [Wed, 19 Dec 2018 17:18:40 +0000 (17:18 +0000)]
Test commit

Fix typos.

llvm-svn: 349644

5 years ago[X86] Remove already upgraded llvm.x86.avx512.mask.padds/psubs tests
Simon Pilgrim [Wed, 19 Dec 2018 17:18:27 +0000 (17:18 +0000)]
[X86] Remove already upgraded llvm.x86.avx512.mask.padds/psubs tests

Duplicate tests have already been moved to avx512bw-intrinsics-upgrade.ll

llvm-svn: 349643

5 years ago[lit] Make TestConvenienceVariables a cpp file
Jonas Devlieghere [Wed, 19 Dec 2018 17:10:21 +0000 (17:10 +0000)]
[lit] Make TestConvenienceVariables a cpp file

The build.py script always runs the compiler in C++ mode, regardless of
the file extension. This results in mangled names presented to the
linker which in turn cannot find the printf symbol.

While we figure out how to solve this issue I've turned the source file
into a cpp file and added extern c. This should unbreak the bots.

llvm-svn: 349642