platform/upstream/llvm.git
4 years ago-fmodules-codegen should not emit extern templates
Luboš Luňák [Sun, 3 Nov 2019 19:47:40 +0000 (20:47 +0100)]
-fmodules-codegen should not emit extern templates

If a header contains 'extern template', then the template should be provided
somewhere by an explicit instantiation, so it is not necessary to generate
a copy. Worse, this can lead to an unresolved symbol, because the codegen's
object file will not actually contain functions from such a template
because of the GVA_AvailableExternally, but the object file for the explicit
instantiation will not contain them either because it will be blocked
by the information provided by the module.

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

4 years ago[mlir][Linalg] Update the semantics, verifier and test for Linalg with tensors.
Nicolas Vasilache [Sat, 11 Jan 2020 07:22:00 +0000 (02:22 -0500)]
[mlir][Linalg] Update the semantics, verifier and test for Linalg with tensors.

Summary:
This diff fixes issues with the semantics of linalg.generic on tensors that appeared when converting directly from HLO to linalg.generic.
The changes are self-contained within MLIR and can be captured and tested independently of XLA.

The linalg.generic and indexed_generic are updated to:

To allow progressive lowering from the value world (a.k.a tensor values) to
the buffer world (a.k.a memref values), a linalg.generic op accepts
mixing input and output ranked tensor values with input and output memrefs.

```
%1 = linalg.generic #trait_attribute %A, %B {other-attributes} :
  tensor<?x?xf32>,
  memref<?x?xf32, stride_specification>
  -> (tensor<?x?xf32>)
```

In this case, the number of outputs (args_out) must match the sum of (1) the
number of output buffer operands and (2) the number of tensor return values.
The semantics is that the linalg.indexed_generic op produces (i.e.
allocates and fills) its return values.

Tensor values must be legalized by a buffer allocation pass before most
transformations can be applied. Such legalization moves tensor return values
into output buffer operands and updates the region argument accordingly.

Transformations that create control-flow around linalg.indexed_generic
operations are not expected to mix with tensors because SSA values do not
escape naturally. Still, transformations and rewrites that take advantage of
tensor SSA values are expected to be useful and will be added in the near
future.

Subscribers: bmahjour, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits

Tags: #llvm

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

4 years ago[DAGCombine] Replace `getIntPtrConstant()` with `getVectorIdxTy()`.
Michael Liao [Tue, 14 Jan 2020 21:30:52 +0000 (16:30 -0500)]
[DAGCombine] Replace `getIntPtrConstant()` with `getVectorIdxTy()`.

- Prefer `getVectorIdxTy()` as the index operand type for
  `EXTRACT_SUBVECTOR` as targets expect different types by overloading
  `getVectorIdxTy()`.

4 years ago[OPENMP]Do not emit special virtual function for NVPTX target.
Alexey Bataev [Tue, 14 Jan 2020 21:42:23 +0000 (16:42 -0500)]
[OPENMP]Do not emit special virtual function for NVPTX target.

There are no special virtual function handlers (like __cxa_pure_virtual)
defined for NVPTX target, so just emit such functions as null pointers
to prevent issues with linking and unresolved references.

4 years ago[mlir] Use double format when parsing bfloat16 hexadecimal values
River Riddle [Tue, 14 Jan 2020 21:47:21 +0000 (13:47 -0800)]
[mlir] Use double format when parsing bfloat16 hexadecimal values

Summary: bfloat16 doesn't have a valid APFloat format, so we have to use double semantics when storing it. This change makes sure that hexadecimal values can be round-tripped properly given this fact.

Reviewed By: mehdi_amini

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

4 years agoRemove trailing `;`. NFC.
Michael Liao [Tue, 14 Jan 2020 21:29:47 +0000 (16:29 -0500)]
Remove trailing `;`. NFC.

4 years ago[AArch64][GlobalISel]: Support @llvm.{return,frame}address selection.
Amara Emerson [Tue, 14 Jan 2020 21:39:23 +0000 (13:39 -0800)]
[AArch64][GlobalISel]: Support @llvm.{return,frame}address selection.

These intrinsics expand to a variable number of instructions so just like in
ISelLowering.cpp we use custom code to deal with them.

Committing Tim's original patch.

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

4 years ago[Driver][test] Fix Driver/hexagon-toolchain-elf.c for -DCLANG_DEFAULT_LINKER=lld...
Fangrui Song [Tue, 14 Jan 2020 00:50:26 +0000 (16:50 -0800)]
[Driver][test] Fix Driver/hexagon-toolchain-elf.c for -DCLANG_DEFAULT_LINKER=lld builds

Reviewed By: nathanchance, sidneym

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

4 years ago[LegalizeTypes] Remove untested code from ExpandIntOp_UINT_TO_FP
Craig Topper [Tue, 14 Jan 2020 20:42:05 +0000 (12:42 -0800)]
[LegalizeTypes] Remove untested code from ExpandIntOp_UINT_TO_FP

This code is untested in tree because the "APFloat::semanticsPrecision(sem) >= SrcVT.getSizeInBits() - 1" check is false for most combinations for int and fp types except maybe i32 and f64. For that you would need i32 to be an illegal type, but f64 to be legal and have custom handling for legalizing the split sint_to_fp. The precision check itself was added in 2010 to fix a double rounding issue in the algorithm that would occur if the sint_to_fp was not able to do the conversion without rounding.

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

4 years ago[GVN] fix comment/argument name to match actual implementation. NFC
Fedor Sergeev [Tue, 14 Jan 2020 20:45:51 +0000 (03:45 +0700)]
[GVN] fix comment/argument name to match actual implementation. NFC

4 years ago[clang][test][NFC] Use more widely supported sanitizer for file dependency tests
Jan Korous [Tue, 14 Jan 2020 19:12:32 +0000 (11:12 -0800)]
[clang][test][NFC] Use more widely supported sanitizer for file dependency tests

The tests aren't concerned at all by the actual sanitizer - only by blacklist being reported as a dependency.
We're unfortunately limited by platform support for any particular sanitizer but we can at least use one that is widely supported.

Post-commit review:
https://reviews.llvm.org/D72729

4 years ago[InstCombine] Fix worklist management when removing guard intrinsic
Nikita Popov [Sat, 11 Jan 2020 14:10:50 +0000 (15:10 +0100)]
[InstCombine] Fix worklist management when removing guard intrinsic

When multiple guard intrinsics are merged into one, currently the
result of eraseInstFromFunction() is returned -- however, this
should only be done if the current instruction is being removed.
In this case we're removing a different instruction and should
instead report that the current one has been modified by returning it.

For this test case, this reduces the number of instcombine iterations
from 5 to 2 (the minimum possible).

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

4 years ago[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Amy Huang [Sat, 4 Jan 2020 00:28:48 +0000 (16:28 -0800)]
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.

Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.

I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.

Total object file size on Windows, compiling with RelWithDebInfo:
  before: 4,257,448 kb
  after:  2,104,963 kb

And on Linux
  before: 9,225,140 kb
  after:  4,387,464 kb

According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182

Reviewers: rnk, dblaikie

Subscribers: aprantl, cfe-commits

Tags: #clang

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

4 years ago[analyzer] Fix SARIF column locations
Joe Ranieri [Tue, 14 Jan 2020 20:05:01 +0000 (15:05 -0500)]
[analyzer] Fix SARIF column locations

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

4 years agodotest.py: Add option to pass extra lldb settings to dotest
Adrian Prantl [Tue, 14 Jan 2020 20:34:13 +0000 (12:34 -0800)]
dotest.py: Add option to pass extra lldb settings to dotest

The primary motivation for this is to add another dimension to the
Swift LLDB test matrix, but this seems generally useful.

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

4 years ago[libcxx] [Windows] Make a more proper implementation of strftime_l for mingw with...
Martin Storsjö [Mon, 28 Oct 2019 21:53:09 +0000 (23:53 +0200)]
[libcxx] [Windows] Make a more proper implementation of strftime_l for mingw with msvcrt.dll

This also makes this function consistent with the rest of the
libc++ provided fallbacks.

The locale support in msvcrt.dll is very limited anyway; it can
only be configured processwide, not per thread, and it only seems
to support the locales "C" and "" (the user set locale), so it's
hard to make any meaningful automatic test for it. But manually tested,
this change does make time formatting locale code in libc++ output
times in the user requested format, when using locale "".

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

4 years ago[SVE] Add patterns for MUL immediate instruction.
Danilo Carvalho Grael [Mon, 13 Jan 2020 22:47:02 +0000 (17:47 -0500)]
[SVE] Add patterns for MUL immediate instruction.

Summary: Add the missing MUL pattern for integer immediate instructions.

Reviewers: sdesmalen, huntergr, efriedma, c-rhodes, kmclaughlin

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits, amehsan

Tags: #llvm

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

4 years ago[Driver] Ignore -fno-semantic-interposition
Fangrui Song [Tue, 14 Jan 2020 18:46:33 +0000 (10:46 -0800)]
[Driver] Ignore -fno-semantic-interposition

Fedora wants to build projects with -fno-semantic-interposition (e.g.
https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup),
which is supported by GCC>=5.

Clang's current behavior is similar to -fno-semantic-interposition and
the end goal is to make it more so
(https://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html).
Ignore this option.

We should let users know -fsemantic-interposition is not currently
supported, so it should remain a hard error.

Reviewed By: serge-sans-paille

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

4 years ago[OpenMP][Tool] Runtime warning for missing TSan-option
Joachim Protze [Tue, 14 Jan 2020 08:24:00 +0000 (22:24 -1000)]
[OpenMP][Tool] Runtime warning for missing TSan-option

TSan spuriously reports for any OpenMP application a race on the initialization
of a runtime internal mutex:

```
Atomic read of size 1 at 0x7b6800005940 by thread T4:
  #0 pthread_mutex_lock <null> (a.out+0x43f39e)
  #1 __kmp_resume_64 <null> (libomp.so.5+0x84db4)

Previous write of size 1 at 0x7b6800005940 by thread T7:
  #0 pthread_mutex_init <null> (a.out+0x424793)
  #1 __kmp_suspend_initialize_thread <null> (libomp.so.5+0x8422e)
```

According to @AndreyChurbanov this is a false positive report, as the control
flow of the runtime guarantees the ordering of the mutex initialization and
the lock:
https://software.intel.com/en-us/forums/intel-open-source-openmp-runtime-library/topic/530363

To suppress this report, I suggest the use of
TSAN_OPTIONS='ignore_uninstrumented_modules=1'.
With this patch, a runtime warning is provided in case an OpenMP application
is built with Tsan and executed without this Tsan-option.

Reviewed By: jdoerfert

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

4 years ago[NewPM] Port MergeFunctions pass
Nikita Popov [Fri, 10 Jan 2020 20:52:19 +0000 (21:52 +0100)]
[NewPM] Port MergeFunctions pass

This ports the MergeFunctions pass to the NewPM. This was rather
straightforward, as no analyses are used.

Additionally MergeFunctions needs to be conditionally enabled in
the PassBuilder, but I left that part out of this patch.

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

4 years ago[OPENMP]Improve handling of possibly incorrectly mapped types.
Alexey Bataev [Tue, 14 Jan 2020 19:13:47 +0000 (14:13 -0500)]
[OPENMP]Improve handling of possibly incorrectly mapped types.

Need to analayze the type of the expression for mapping, not the type of
the declaration.

4 years ago[InstCombine] Fix infinite loop due to bitcast <-> phi transforms
Nikita Popov [Mon, 13 Jan 2020 17:57:14 +0000 (18:57 +0100)]
[InstCombine] Fix infinite loop due to bitcast <-> phi transforms

Fix for https://bugs.llvm.org/show_bug.cgi?id=44245.

The optimizeBitCastFromPhi() and FoldPHIArgOpIntoPHI() end up
fighting against each other, because optimizeBitCastFromPhi()
assumes that bitcasts of loads will get folded. This doesn't
happen here, because a dangling phi node prevents the one-use
fold in https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp#L620-L628 from triggering.

This patch fixes the issue by explicitly performing the load
combine as part of the bitcast of phi transform. Other attempts
to force the load to be combined first were ultimately too
unreliable.

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

4 years ago[InstCombine] Make combineLoadToNewType a method; NFC
Nikita Popov [Mon, 13 Jan 2020 17:56:28 +0000 (18:56 +0100)]
[InstCombine] Make combineLoadToNewType a method; NFC

So it can be reused as part of other combines.
In particular for D71164.

4 years ago[InstCombine] Fix user iterator invalidation in bitcast of phi transform
Nikita Popov [Mon, 13 Jan 2020 22:54:42 +0000 (23:54 +0100)]
[InstCombine] Fix user iterator invalidation in bitcast of phi transform

This fixes the issue encountered in D71164. Instead of using a
range-based for, manually iterate over the users and advance the
iterator beforehand, so we do not skip any users due to iterator
invalidation.

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

4 years ago[InstCombine] Add test for iterator invalidation bug; NFC
Nikita Popov [Mon, 13 Jan 2020 22:49:03 +0000 (23:49 +0100)]
[InstCombine] Add test for iterator invalidation bug; NFC

4 years ago[nfc][libomptarget] Refactor nvptx/target_impl.cu
Jon Chesterfield [Tue, 14 Jan 2020 19:27:44 +0000 (19:27 +0000)]
[nfc][libomptarget] Refactor nvptx/target_impl.cu

Summary:
[nfc][libomptarget] Refactor nxptx/target_impl.cu

Use __kmpc_impl_atomic_add instead of atomicAdd to match the rest of the file.
Alternatively, target_impl.cu could use the cuda functions directly. Using a mixture in this
file was an oversight, happy to resolve in either direction.

Removed some comments that look outdated.

Call __kmpc_impl_unset_lock directly to avoid a redundant diagnostic and remove an implict
dependency on interface.h.

Reviewers: ABataev, grokos, jdoerfert

Reviewed By: jdoerfert

Subscribers: jfb, openmp-commits

Tags: #openmp

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

4 years ago[nfc][libomptarget] Refactor amdgcn target_impl
Jon Chesterfield [Tue, 14 Jan 2020 19:27:06 +0000 (19:27 +0000)]
[nfc][libomptarget] Refactor amdgcn target_impl

Summary:
[nfc][libomptarget] Refactor amdgcn target_impl

Removes references to internal libraries from the header
Standardises on C++ mangling for all the target_impl functions
Update comment block
clang-format
Move some functions into a new target_impl.hip source file

This lays the groundwork for implementing the remaining unresolved
symbols in the target_impl.hip source.

Reviewers: jdoerfert, grokos, ABataev, ronlieb

Reviewed By: jdoerfert

Subscribers: jvesely, mgorny, jfb, openmp-commits

Tags: #openmp

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

4 years agoFix NetBSD bot after b4a99a061f517e60985667e39519f60186cbb469 ([Clang][Driver] Re...
Alexandre Ganea [Tue, 14 Jan 2020 19:14:07 +0000 (14:14 -0500)]
Fix NetBSD bot after b4a99a061f517e60985667e39519f60186cbb469 ([Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation)

4 years ago[InstCombine] add test for possible cast-of-select transform; NFC
Sanjay Patel [Tue, 14 Jan 2020 18:51:22 +0000 (13:51 -0500)]
[InstCombine] add test for possible cast-of-select transform; NFC

4 years ago[MachineScheduler] Reduce reordering due to mem op clustering
Jay Foad [Tue, 14 Jan 2020 15:40:52 +0000 (15:40 +0000)]
[MachineScheduler] Reduce reordering due to mem op clustering

Summary:
Mem op clustering adds a weak edge in the DAG between two loads or
stores that should be clustered, but the direction of this edge is
pretty arbitrary (it depends on the sort order of MemOpInfo, which
represents the operands of a load or store). This often means that two
loads or stores will get reordered even if they would naturally have
been scheduled together anyway, which leads to test case churn and goes
against the scheduler's "do no harm" philosophy.

The fix makes sure that the direction of the edge always matches the
original code order of the instructions.

Reviewers: atrick, MatzeB, arsenm, rampitec, t.p.northover

Subscribers: jvesely, wdng, nhaehnle, kristof.beyls, hiraditya, javed.absar, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[lldb/test] test_breakpoints_func_full from TestNamespace.NamespaceBreakpointTestCase...
Stella Stamenova [Tue, 14 Jan 2020 19:13:22 +0000 (11:13 -0800)]
[lldb/test] test_breakpoints_func_full from TestNamespace.NamespaceBreakpointTestCase is now passing on Windows

After https://reviews.llvm.org/D70846, the test is now passing on Windows

4 years ago[gn build] Port 36fcbb838c8
LLVM GN Syncbot [Tue, 14 Jan 2020 19:06:58 +0000 (19:06 +0000)]
[gn build] Port 36fcbb838c8

4 years agoAdded readability-qualified-auto check
Nathan James [Tue, 14 Jan 2020 19:05:45 +0000 (14:05 -0500)]
Added readability-qualified-auto check

Adds a check that detects any auto variables that are deduced to a pointer or
a const pointer then adds in the const and asterisk according. Will also
check auto L value references that could be written as const. This relates
to the coding standard
https://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto

4 years ago[RISCV] Allow shrink wrapping for RISC-V
lewis-revill [Tue, 14 Jan 2020 18:59:11 +0000 (18:59 +0000)]
[RISCV] Allow shrink wrapping for RISC-V

Enabling shrink wrapping requires ensuring the insertion point of the
epilogue is correct for MBBs without a terminator, in which case the
instruction to adjust the stack pointer is the last instruction in the
block.

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

4 years ago[ThinLTO/WPD] Remove an overly-aggressive assert
Teresa Johnson [Mon, 13 Jan 2020 21:50:41 +0000 (13:50 -0800)]
[ThinLTO/WPD] Remove an overly-aggressive assert

Summary:
An assert added to the index-based WPD was trying to verify that we only
have multiple vtables for a given guid when they are all non-external
linkage. This is too conservative because we may have multiple external
vtable with the same guid when they are in comdat. Remove the assert,
as we don't have comdat information in the index, the linker should
issue an error in this case.

See discussion on D71040 for more information.

Reviewers: evgeny777, aganea

Subscribers: mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[ELF] Delete the RelExpr member R_HINT. NFC
Fangrui Song [Mon, 23 Dec 2019 01:01:53 +0000 (17:01 -0800)]
[ELF] Delete the RelExpr member R_HINT. NFC

R_HINT is ignored like R_NONE. There are no strong reasons to keep
R_HINT. The largest RelExpr member R_RISCV_PC_INDIRECT is 60 now.

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

4 years ago[ThinLTO] Handle variable with twice promoted name (Rust)
Teresa Johnson [Tue, 14 Jan 2020 14:28:37 +0000 (06:28 -0800)]
[ThinLTO] Handle variable with twice promoted name (Rust)

Summary:
Ensure that we can internalize values produced from two rounds of
promotion.

Note that this cannot happen currently via clang, but in other use cases
such as the Rust compiler which does a first round of ThinLTO on library
code, producing bitcode, and a second round on the final binary.

In particular this can happen if a function is exported and promoted,
ending up with a ".llvm.${hash}" suffix, and then goes through a round
of optimization creating an internal switch table expansion variable
that is internal and contains the promoted name of the enclosing
function. This variable will be promoted in the second round of ThinLTO
if @foo is imported again, and therefore ends up with two
".llvm.${hash}" suffixes. Only the final one should be stripped when
consulting the index to locate the summary.

Reviewers: wmi

Subscribers: mehdi_amini, inglorion, hiraditya, JDevlieghere, steven_wu, dexonsmith, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[X86] Directly emit a BROADCAST_LOAD from constant pool in lowerUINT_TO_FP_vXi32...
Craig Topper [Tue, 14 Jan 2020 18:18:32 +0000 (10:18 -0800)]
[X86] Directly emit a BROADCAST_LOAD from constant pool in lowerUINT_TO_FP_vXi32 to avoid double loads seen in D71971

By directly emitting the constants as a constant pool load we seem to avoid the build_vector/extract_subvector combines that resulted in the duplicate loads we had before.

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

4 years agoSCC: Allow ReplaceNode to safely support insertion
Warren Ristow [Tue, 14 Jan 2020 18:30:24 +0000 (10:30 -0800)]
SCC: Allow ReplaceNode to safely support insertion

If scc_iterator::ReplaceNode is inserting a new entry in the map,
rather than replacing an existing entry, the possibility of growing
the map could cause a failure.  This change safely implements the
insertion.

Reviewed By: probinson

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

4 years ago[AIX][XCOFF] Supporting the ReadOnlyWithRel SectionKnd
diggerlin [Tue, 14 Jan 2020 18:21:49 +0000 (13:21 -0500)]
[AIX][XCOFF] Supporting the ReadOnlyWithRel SectionKnd

SUMMARY:
In this patch we put the global variable in a Csect which's SectionKind is "ReadOnlyWithRel" into Data Section.

Reviewers: hubert.reinterpretcast,jasonliu,Xiangling_L
Subscribers: wuzish, nemanjai, hiraditya

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

4 years ago[InstCombine] Let combineLoadToNewType preserve ABI alignment of the load (PR44543)
Juneyoung Lee [Tue, 14 Jan 2020 16:11:20 +0000 (01:11 +0900)]
[InstCombine] Let combineLoadToNewType preserve ABI alignment of the load (PR44543)

Summary:
If aligment on `LoadInst` isn't specified, load is assumed to be ABI-aligned.
And said aligment may be different for different types.
So if we change load type, but don't pay extra attention to the aligment
(i.e. keep it unspecified), we may either overpromise (if the default aligment
of the new type is higher), or underpromise (if the default aligment
of the new type is smaller).

Thus, if no alignment is specified, we need to manually preserve the implied ABI alignment.

This addresses https://bugs.llvm.org/show_bug.cgi?id=44543 by making combineLoadToNewType preserve ABI alignment of the load.

Reviewers: spatel, lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ELF] --exclude-libs: don't assign VER_NDX_LOCAL to undefined symbols
Fangrui Song [Tue, 14 Jan 2020 05:30:05 +0000 (21:30 -0800)]
[ELF] --exclude-libs: don't assign VER_NDX_LOCAL to undefined symbols

Suggested by Peter Collingbourne.

Non-VER_NDX_GLOBAL versions should not be assigned to defined symbols. --exclude-libs violates this and can cause a spurious error "cannot refer to absolute symbol" after D71795.

excludeLibs incorrectly assigns VER_NDX_LOCAL to an undefined weak symbol =>
isPreemptible is false =>
R_PLT_PC is optimized to R_PC =>
in isStaticLinkTimeConstant, an error is emitted.

Reviewed By: pcc, grimar

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

4 years agoRemoved PointerUnion3 and PointerUnion4 aliases in favor of the variadic template
Dmitri Gribenko [Tue, 14 Jan 2020 14:46:13 +0000 (15:46 +0100)]
Removed PointerUnion3 and PointerUnion4 aliases in favor of the variadic template

4 years ago[test] Make data layout of load-bitcast64.ll explicit, use update_test_checks.py
Juneyoung Lee [Tue, 14 Jan 2020 17:49:30 +0000 (02:49 +0900)]
[test] Make data layout of load-bitcast64.ll explicit, use update_test_checks.py

4 years ago[RISCV] Add Clang frontend support for Bitmanip extension
Scott Egerton [Tue, 14 Jan 2020 17:45:45 +0000 (17:45 +0000)]
[RISCV] Add Clang frontend support for Bitmanip extension

Summary: This adds the __riscv_bitmanip macro and the 'b' target feature to enable it.

Reviewers: asb, simoncook, lewis-revill, PaoloS, lenary

Reviewed By: lenary

Subscribers: Jim, rbar, johnrusso, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits

Tags: #clang

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

4 years ago[lldb/Utility] Use assert instead of llvm_unreachable for LLDBAssert
Jonas Devlieghere [Tue, 14 Jan 2020 17:13:15 +0000 (09:13 -0800)]
[lldb/Utility] Use assert instead of llvm_unreachable for LLDBAssert

llvm_unreachable is marked noreturn so the compiler can assume the code
for printing the error message in release builds isn't hit which defeats
the purpose.

4 years ago[IR] fix potential crash in Constant::isElementWiseEqual()
Sanjay Patel [Tue, 14 Jan 2020 16:47:22 +0000 (11:47 -0500)]
[IR] fix potential crash in Constant::isElementWiseEqual()

There's only one user of this API currently, and it seems
impossible that it would compare values with different types.

But that's not true in general, so we need to make sure the
types are the same.

As denoted by the FIXME comments, we will also crash on FP
values. That's what brought me here, but we can make that a
follow-up patch.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 16:30:05 +0000 (16:30 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately in all cases and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" clang static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 14:15:51 +0000 (14:15 +0000)]
Fix "pointer is null" clang static analyzer warnings. NFCI.

Use cast<>/castAs<> instead of dyn_cast<>/getAs<> since the pointers are always dereferenced and cast<>/castAs<> will perform the null assertion for us.

4 years ago[clang][OpenCL] Fix covered switch warning
Jinsong Ji [Tue, 14 Jan 2020 16:21:13 +0000 (16:21 +0000)]
[clang][OpenCL] Fix covered switch warning

-Werror clang build is broken now.

tools/clang/lib/Sema/OpenCLBuiltins.inc:11824:5: error: default label in
switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
    default:

We don't need default now, since all enumeration values are covered.

Reviewed By: svenvh

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

4 years ago[ARM][MVE] VTP Block Pass fix
Sjoerd Meijer [Tue, 14 Jan 2020 16:00:59 +0000 (16:00 +0000)]
[ARM][MVE] VTP Block Pass fix

Fix a missing and broken test: 2 VPT blocks predicated on the same VCMP
instruction that can be folded. The problem was that for each VPT block, we
record the predicate statements with a list, but the same instruction was added
twice. Thus, we were running in an assert trying to remove the same instruction
twice. To avoid this the instructions are now recorded with a set.

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

4 years ago[Syntax] Unset IsOriginal flag on nodes removed from the tree
Ilya Biryukov [Tue, 14 Jan 2020 11:34:00 +0000 (12:34 +0100)]
[Syntax] Unset IsOriginal flag on nodes removed from the tree

And add a corresponding test.
Only nodes inside the TranslationUnit subtree can be marked as original,
computeReplacements() relies on this.

4 years ago[scudo][standalone] Fork support
Kostya Kortchinsky [Thu, 9 Jan 2020 19:43:16 +0000 (11:43 -0800)]
[scudo][standalone] Fork support

Summary:
fork() wasn't well (or at all) supported in Scudo. This materialized
in deadlocks in children.

In order to properly support fork, we will lock the allocator pre-fork
and unlock it post-fork in parent and child. This is done via a
`pthread_atfork` call installing the necessary handlers.

A couple of things suck here: this function allocates - so this has to
be done post initialization as our init path is not reentrance, and it
doesn't allow for an extra pointer - so we can't pass the allocator we
are currently working with.

In order to work around this, I added a post-init template parameter
that gets executed once the allocator is initialized for the current
thread. Its job for the C wrappers is to install the atfork handlers.

I reorganized a bit the impacted area and added some tests, courtesy
of cferris@ that were deadlocking prior to this fix.

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.
Tom Weaver [Tue, 14 Jan 2020 15:51:11 +0000 (15:51 +0000)]
[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.

Adds 22 distinct tests that exercise the live-debug-values passes
expected behaviour.

reviewers: aprantl, vsk

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

4 years ago[Syntax] Mark synthesized nodes as modifiable
Ilya Biryukov [Tue, 14 Jan 2020 15:27:06 +0000 (16:27 +0100)]
[Syntax] Mark synthesized nodes as modifiable

This was an oversight in the original patch.
Also add corresponding tests.

4 years ago[Syntax] Assert invariants on tree structure and fix a bug in mutations
Ilya Biryukov [Tue, 14 Jan 2020 15:07:11 +0000 (16:07 +0100)]
[Syntax] Assert invariants on tree structure and fix a bug in mutations

Add checks for some structural invariants when building and mutating
the syntax trees.

Fix a bug failing the invariants after mutations: the parent of nodes
added into the tree was null.

4 years ago[clang-tidy] Match InitListExpr in modernize-use-default-member-init
Malcolm Parsons [Tue, 14 Jan 2020 15:19:19 +0000 (15:19 +0000)]
[clang-tidy] Match InitListExpr in modernize-use-default-member-init

Summary:
modernize-use-default-member-init wasn't warning about redundant initialisers
when the initialiser was an InitListExpr.  Add initListExpr to the matcher.

Fixes: PR44439

Reviewers: aaron.ballman, alexfh, JonasToth

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years agoRevert "[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests."
Tom Weaver [Tue, 14 Jan 2020 15:12:02 +0000 (15:12 +0000)]
Revert "[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests."

This reverts commit 35787e3a062a4a21c145137552d20cb1169c74fc.

4 years ago[AArch64] Fix save register pairing for Windows AAPCS
Sanne Wouda [Tue, 14 Jan 2020 13:16:57 +0000 (13:16 +0000)]
[AArch64] Fix save register pairing for Windows AAPCS

Summary:
On Windows, when a function does not have an unwind table (for example, EH
filtering funclets), we don't correctly pair FP and LR to form the frame record
in all circumstances.

Fix this by invalidating a pair when the second register is FP when compiling
for Windows, even when CFI is not needed.

Fixes PR44271 introduced by D65653.

Reviewers: efriedma, sdesmalen, rovka, rengolin, t.p.northover, thegameg, greened

Reviewed By: rengolin

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomput...
Florian Hahn [Tue, 14 Jan 2020 14:50:07 +0000 (14:50 +0000)]
Revert "Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.""

This reverts commit a03d7b0f24b65d69721dbbbc871df0629efcf774.

As discussed in D68298, this causes a compile-time regression, in case
the DTs requested are not used elsewhere in GlobalOpt. We should only
get the DTs if they are available here, but this seems not possible with
the legacy pass manager from a module pass.

4 years ago[OpenCL] Add MSAA sharing extension builtin functions
Sven van Haastregt [Tue, 14 Jan 2020 14:46:42 +0000 (14:46 +0000)]
[OpenCL] Add MSAA sharing extension builtin functions

Add the MSAA sharing builtin functions from the OpenCL Extension
Specification.

Patch by Pierre Gondois and Sven van Haastregt.

4 years ago[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.
Tom Weaver [Tue, 14 Jan 2020 14:43:30 +0000 (14:43 +0000)]
[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.

Adds 22 distinct tests that exercise the live-debug-values passes
expected behaviour.

reviewers: aprantl, vsk

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

4 years ago[AIX] ExternalSymbolSDNode lowering
Xiangling Liao [Tue, 7 Jan 2020 15:53:24 +0000 (10:53 -0500)]
[AIX] ExternalSymbolSDNode lowering

For memcpy/memset/memmove etc., replace ExternalSymbolSDNode with a
MCSymbolSDNode, which have a prefix dot before function name as entry
point symbol.

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

4 years ago[lldb/DWARF] Move location list sections into DWARFContext
Pavel Labath [Mon, 23 Dec 2019 15:31:36 +0000 (16:31 +0100)]
[lldb/DWARF] Move location list sections into DWARFContext

These are the last sections not managed by the DWARFContext object. I
also introduce separate SectionType enums for dwo section variants, as
this is necessary for proper handling of single-file split dwarf.

4 years ago[llvm-readobj][llvm-readelf][test] - Add a few more dynamic section tests.
Georgii Rymar [Thu, 26 Dec 2019 11:55:53 +0000 (14:55 +0300)]
[llvm-readobj][llvm-readelf][test] - Add a few more dynamic section tests.

This adds a few more tests for dynamic section.

We only had tests for simple unknown values for 64-bits target,
in this patch I've added OS specific and processor specific tags.
Also it tests both 32 and 64-bits targets now.

It will help to fix the formatting issues we have and diagnose a possible new ones.

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

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:54:39 +0000 (13:54 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Remove Ctx null test as clang static analyzer assumes that this can fail - replace it with an assertion as the pointer is always dereferenced below.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:48:02 +0000 (13:48 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use cast<> instead of cast_or_null<> since the pointers are always dereferenced and cast<> will perform the null assertion for us.

4 years agoRemove duplicate variable. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:42:26 +0000 (13:42 +0000)]
Remove duplicate variable. NFCI.

4 years agoMerge isa<> and getAs<> calls to fix "pointer is null" static analyzer warnings....
Simon Pilgrim [Tue, 14 Jan 2020 13:41:07 +0000 (13:41 +0000)]
Merge isa<> and getAs<> calls to fix "pointer is null" static analyzer warnings. NFCI.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:28:46 +0000 (13:28 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

4 years agoFix "null pointer passed to nonnull argument" clang static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:23:56 +0000 (13:23 +0000)]
Fix "null pointer passed to nonnull argument" clang static analyzer warnings. NFCI.

Assert that the memcpy arguments are valid.

4 years agoExpression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions
Levon Ter-Grigoryan [Tue, 14 Jan 2020 13:33:43 +0000 (14:33 +0100)]
Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions

Summary:
This change is connected with
https://reviews.llvm.org/D69843

In large codebases, we sometimes see Module::FindFunctions (when called from
ClangExpressionDeclMap::FindExternalVisibleDecls) returning huge amounts of
functions.

In current fix I trying to return only function_fullnames from ManualDWARFIndex::GetFunctions when eFunctionNameTypeFull is passed as argument.

Reviewers: labath, jarin, aprantl

Reviewed By: labath

Subscribers: shafik, clayborg, teemperor, arphaman, lldb-commits

Tags: #lldb

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

4 years agoAArch64: fix bitcode upgrade of @llvm.neon.addp.
Tim Northover [Thu, 9 Jan 2020 14:28:48 +0000 (14:28 +0000)]
AArch64: fix bitcode upgrade of @llvm.neon.addp.

We were upgrading it to faddp, but a version taking two type parameters instead
of one. This then got upgraded a second time to the version with just one
parameter, but occasionally (for reasons I don't understand) this unusual
two-stage process corrupted a use-list, leading to a crash when the two faddp
declarations didn't match.

4 years ago[InstSimplify] add tests for vector select; NFC
Sanjay Patel [Tue, 14 Jan 2020 13:40:27 +0000 (08:40 -0500)]
[InstSimplify] add tests for vector select; NFC

4 years ago[TableGen] Update editor modes for new keywords.
Simon Tatham [Tue, 14 Jan 2020 13:12:16 +0000 (13:12 +0000)]
[TableGen] Update editor modes for new keywords.

Summary:
D71407 and D71474 added new keywords to the Tablegen language:
`defvar`, `if`, `then` and `else`. This commit updates the various
editor modes to highlight them appropriately.

Some of the modes also didn't include `defset`, so I've added that too
while I was there.

Reviewers: MaskRay, lebedev.ri, plotfi

Reviewed By: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRef
Raphael Isemann [Tue, 14 Jan 2020 12:06:31 +0000 (13:06 +0100)]
[lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRef

4 years ago[FPEnv] Add some comments to IRBuilder.h
Ulrich Weigand [Tue, 14 Jan 2020 13:19:02 +0000 (14:19 +0100)]
[FPEnv] Add some comments to IRBuilder.h

As requested via post-commit comment for D71467, this adds comments
documenting CreateFCmp vs. CreateFCmpS to the header file.

4 years ago[RISCV][NFC] Deduplicate Atomic Intrinsic Definitions
Sam Elliott [Tue, 14 Jan 2020 13:16:52 +0000 (13:16 +0000)]
[RISCV][NFC] Deduplicate Atomic Intrinsic Definitions

Summary:
This is a slight cleanup, to use multiclasses to avoid the duplication between
the different atomic intrinsic definitions. The produced intrinsics are
unchanged, they're just generated in a more succinct way.

Reviewers: asb, luismarques, jrtc27

Reviewed By: luismarques, jrtc27

Subscribers: Jim, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits

Tags: #llvm

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

4 years ago[FPEnv] Fix chain handling regression after 04a8696
Ulrich Weigand [Tue, 14 Jan 2020 13:04:53 +0000 (14:04 +0100)]
[FPEnv] Fix chain handling regression after 04a8696

Code in getRoot made the assumption that every node in PendingLoads
must always itself have a dependency on the current DAG root node.

After the changes in 04a8696, it turns out that this assumption no
longer holds true, causing wrong codegen in some cases (e.g. stores
after constrained FP intrinsics might get deleted).

To fix this, we now need to make sure that the TokenFactor created
by getRoot always includes the previous root, if there is no implicit
dependency already present.

The original getControlRoot code already has exactly this check,
so this patch simply reuses that code now for getRoot as well.
This fixes the regression.

NFC if no constrained FP intrinsic is present.

4 years agoMake helper functions static or move them into anonymous namespaces. NFC.
Benjamin Kramer [Tue, 14 Jan 2020 13:06:12 +0000 (14:06 +0100)]
Make helper functions static or move them into anonymous namespaces.  NFC.

4 years ago[unittests] Fix "comparison of integers of different signs" warnings
Miloš Stojanović [Mon, 13 Jan 2020 18:27:03 +0000 (19:27 +0100)]
[unittests] Fix "comparison of integers of different signs" warnings

A warning is sent because `std::distance()` returns a signed type so
`CmpHelperEQ()` gets instantiated into a function that compares
differently signed arguments.

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

4 years ago[ARM,MVE] Use the new Tablegen `defvar` and `if` statements.
Simon Tatham [Tue, 14 Jan 2020 12:02:30 +0000 (12:02 +0000)]
[ARM,MVE] Use the new Tablegen `defvar` and `if` statements.

Summary:
This cleans up a lot of ugly `foreach` bodges that I've been using to
work around the lack of those two language features. Now they both
exist, I can make then all into something more legible!

In particular, in the common pattern in `ARMInstrMVE.td` where a
multiclass defines an `Instruction` instance plus one or more `Pat` that
select it, I've used a `defvar` to wrap `!cast<Instruction>(NAME)` so
that the patterns themselves become a little more legible.

Replacing a `foreach` with a `defvar` removes a level of block
structure, so several pieces of code have their indentation changed by
this patch. Best viewed with whitespace ignored.

NFC: the output of `llvm-tblgen -print-records` on the two affected
Tablegen sources is exactly identical before and after this change, so
there should be no effect at all on any of the other generated files.

Reviewers: MarkMurrayARM, miyuki

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, dmgreen, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[lldb/Expression] Improve interpreter error message with a non-running target
Med Ismail Bennani [Tue, 14 Jan 2020 11:12:57 +0000 (12:12 +0100)]
[lldb/Expression] Improve interpreter error message with a non-running target

When trying to interpret an expression with a function call, if the
process hasn't been launched, the expression fails to be interpreted
and the user gets the following  error message:

```error: Can't run the expression locally```

This message doesn't explain why the expression failed to be
interpreted, that's why this patch improves the error message that is
displayed when trying to run an expression while no process is running.

rdar://11991708

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[ARM][LowOverheadLoops] Allow all MVE instrs.
Sam Parker [Tue, 14 Jan 2020 12:02:32 +0000 (12:02 +0000)]
[ARM][LowOverheadLoops] Allow all MVE instrs.

We have a whitelist of instructions that we allow when tail
predicating, since these are trivial ones that we've deemed need no
special handling. Now change ARMLowOverheadLoops to allow the
non-trivial instructions if they're contained within a valid VPT
block. Since a valid block is one that is predicated upon the VCTP so
we know that these non-trivial instructions will still behave as
expected once the implicit predication is used instead.

This also fixes a previous test failure.

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

4 years agoFix "MIParser::getIRValue(unsigned int)’ defined but not used" warning. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 11:58:54 +0000 (11:58 +0000)]
Fix "MIParser::getIRValue(unsigned int)’ defined but not used" warning. NFCI.

4 years ago[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and...
Simon Pilgrim [Tue, 14 Jan 2020 11:51:09 +0000 (11:51 +0000)]
[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and generic ISD::SHL handling.

As mentioned by @nikic on rGef5debac4302, we can merge the guaranteed bottom zero bits from the shifted value, and then, if a min shift amount is known, zero out the bottom bits as well.

4 years ago[ARM][LowOverheadLoops] Change predicate inspection
Sam Parker [Fri, 10 Jan 2020 14:47:29 +0000 (14:47 +0000)]
[ARM][LowOverheadLoops] Change predicate inspection

Use the already provided helper function to get the operand type so
that we can detect whether the vpr is being used as a predicate or
not. Also use existing helpers to get the predicate indices when we
converting the vpt blocks. This enables us to support both types of
vpr predicate operand.

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

4 years ago[ARM][Thumb2] Fix ADD/SUB invalid writes to SP
Diogo Sampaio [Mon, 13 Jan 2020 11:36:02 +0000 (11:36 +0000)]
[ARM][Thumb2] Fix ADD/SUB invalid writes to SP

Summary:
This patch fixes pr23772  [ARM] r226200 can emit illegal thumb2 instruction: "sub sp, r12, #80".
The violation was that SUB and ADD (reg, immediate) instructions can only write to SP if the source register is also SP. So the above instructions was unpredictable.
To enforce that the instruction t2(ADD|SUB)ri does not write to SP we now enforce the destination register to be rGPR (That exclude PC and SP).
Different than the ARM specification, that defines one instruction that can read from SP, and one that can't, here we inserted one that can't write to SP, and other that can only write to SP as to reuse most of the hard-coded size optimizations.
When performing this change, it uncovered that emitting Thumb2 Reg plus Immediate could not emit all variants of ADD SP, SP #imm instructions before so it was refactored to be able to. (see test/CodeGen/Thumb2/mve-stacksplot.mir where we use a subw sp, sp, Imm12 variant )
It also uncovered a disassembly issue of adr.w instructions, that were only written as SUBW instructions (see llvm/test/MC/Disassembler/ARM/thumb2.txt).

Reviewers: eli.friedman, dmgreen, carwil, olista01, efriedma, andreadb

Reviewed By: efriedma

Subscribers: gbedwell, john.brawn, efriedma, ostannard, kristof.beyls, hiraditya, dmgreen, llvm-commits

Tags: #llvm

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

4 years ago[X86][SSE] Add add(shl(and(x,c1),c2),c3) test case with non-uniform shift value
Simon Pilgrim [Tue, 14 Jan 2020 11:41:26 +0000 (11:41 +0000)]
[X86][SSE] Add add(shl(and(x,c1),c2),c3) test case with non-uniform shift value

As mentioned by @nikic on rGef5debac4302, we should merge the guaranteed top zero bits from the shifted value and min shift amount code so they can both set the high bits to zero.

4 years ago[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and...
Simon Pilgrim [Tue, 14 Jan 2020 11:20:09 +0000 (11:20 +0000)]
[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and generic ISD::SRL handling.

As mentioned by @nikic on rGef5debac4302 (although that was just about SHL), we can merge the guaranteed top zero bits from the shifted value, and then, if a min shift amount is known, zero out the top bits as well.

SHL tests / handling will be added in a follow up patch.

4 years ago[ARM][MVE] Disallow VPSEL for tail predication
Sam Parker [Tue, 14 Jan 2020 11:02:32 +0000 (11:02 +0000)]
[ARM][MVE] Disallow VPSEL for tail predication

Due to the current way that we collect predicated instructions, we
can't easily handle vpsel in tail predicated loops. There are a
couple of issues:
1) It will use the VPR as a predicate operand, but doesn't have to be
   instead a VPT block, which means we can assert while building up
   the VPT block because we don't find another VPST to being a new
   one.
2) VPSEL still requires a VPR operand even after tail predicating,
   which means we can't remove it unless there is another
   instruction, such as vcmp, that can provide the VPR def.

The first issue should be a relatively simple fix in the logic of the
LowOverheadLoops pass, whereas the second will require us to
represent the 'implicit' tail predication with an explicit value.

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

4 years ago[mlir] Fix translation of splat constants to LLVM IR
Alex Zinenko [Tue, 14 Jan 2020 10:30:25 +0000 (11:30 +0100)]
[mlir] Fix translation of splat constants to LLVM IR

Summary:
When converting splat constants for nested sequential LLVM IR types wrapped in
MLIR, the constant conversion was erroneously assuming it was always possible
to recursively construct a constant of a sequential type given only one value.
Instead, wait until all sequential types are unpacked recursively before
constructing a scalar constant and wrapping it into the surrounding sequential
type.

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits

Tags: #llvm

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

4 years ago[RISCV] Fix ILP32D lowering for double+double/double+int return types
James Clarke [Tue, 14 Jan 2020 11:17:19 +0000 (11:17 +0000)]
[RISCV] Fix ILP32D lowering for double+double/double+int return types

Summary:
Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.

Reviewers: asb, lenary

Reviewed By: asb, lenary

Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits

Tags: #clang

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

4 years ago[mlir] Create a gpu.module operation for the GPU Dialect.
Tres Popp [Tue, 14 Jan 2020 10:09:59 +0000 (11:09 +0100)]
[mlir] Create a gpu.module operation for the GPU Dialect.

Summary:
This is based on the use of code constantly checking for an attribute on
a model and instead represents the distinct operaion with a different
op. Instead, this op can be used to provide better filtering.

Reviewers: herhut, mravishankar, antiagainst, rriddle

Reviewed By: herhut, antiagainst, rriddle

Subscribers: liufengdb, aartbik, jholewinski, mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Cleanup ClangASTContext::CompleteTagDeclarationDefinition
Raphael Isemann [Tue, 14 Jan 2020 10:35:57 +0000 (11:35 +0100)]
[lldb][NFC] Cleanup ClangASTContext::CompleteTagDeclarationDefinition

Makes this function exit early instead of nesting if statements.

Also removed all the if (tag_type->getDecl()) checks. If we created
a TagType with a nullptr as a Decl then Clang would have already
deferenced that nullptr during TagType creation so there is no point
in gracefully handling a nullptr here.

4 years ago[mlir] Ran git-clang-format.
Adrian [Tue, 14 Jan 2020 10:41:40 +0000 (11:41 +0100)]
[mlir] Ran git-clang-format.

Summary:
I forgot to ran git-clang-format before committing.

4 years ago[mlir] Add loop.parallel, loop.reduce and loop.reduce.return operations.
Adrian Kuegel [Wed, 8 Jan 2020 13:06:22 +0000 (14:06 +0100)]
[mlir] Add loop.parallel, loop.reduce and loop.reduce.return operations.

Summary:
These operations can be used to specify a loop nest with a body that can
contain reductions. The iteration space can be iterated in any order.

RFC: https://groups.google.com/a/tensorflow.org/d/topic/mlir/pwtSgiKFPis/discussion

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

4 years ago[ARM][MVE] Masked gathers from base + vector of offsets
Anna Welker [Tue, 14 Jan 2020 09:48:02 +0000 (09:48 +0000)]
[ARM][MVE] Masked gathers from base + vector of offsets

Enables the masked gather pass to create a masked
gather loading from a base and vector of offsets.
This also enables v8i16 and v16i8 gather loads.

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

4 years ago[Target] Fix uninitialized value in 10c11e4e2d05cf0e8f8251f50d84ce77eb1e9b8d
Sam McCall [Tue, 14 Jan 2020 10:16:41 +0000 (11:16 +0100)]
[Target] Fix uninitialized value in 10c11e4e2d05cf0e8f8251f50d84ce77eb1e9b8d

4 years ago[TableGen] Introduce an if/then/else statement.
Simon Tatham [Tue, 14 Jan 2020 09:10:34 +0000 (09:10 +0000)]
[TableGen] Introduce an if/then/else statement.

Summary:
This allows you to make some of the defs in a multiclass or `foreach`
conditional on an expression computed from the parameters or iteration
variables.

It was already possible to simulate an if statement using a `foreach`
with a dummy iteration variable and a list constructed using `!if` so
that it had length 0 or 1 depending on the condition, e.g.

  foreach unusedIterationVar = !if(condition, [1], []<int>) in { ... }

But this syntax is nicer to read, and also more convenient because it
allows an else clause.

To avoid upheaval in the implementation, I've implemented `if` as pure
syntactic sugar on the `foreach` implementation: internally, `ParseIf`
actually does construct exactly the kind of foreach shown above (and
another reversed one for the else clause if present).

Reviewers: nhaehnle, hfinkel

Reviewed By: hfinkel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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