platform/upstream/llvm.git
4 years ago[OPENMP50]Multiple vendors in vendor context must be treated as logical
Alexey Bataev [Tue, 8 Oct 2019 19:44:16 +0000 (19:44 +0000)]
[OPENMP50]Multiple vendors in vendor context must be treated as logical
and of vendors, not or.

If several vendors are provided in the same vendor context trait, the
context shall match only if all vendors are matching, not one of them.
This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors,
all selectors in the construct, device, and implementation sets of the
context selector appear in the corresponding trait set of the OpenMP
context.

llvm-svn: 374107

4 years agoStopInfo/Mach: Use early-exits, reflow messy comments, NFCI
Vedant Kumar [Tue, 8 Oct 2019 19:40:13 +0000 (19:40 +0000)]
StopInfo/Mach: Use early-exits, reflow messy comments, NFCI

llvm-svn: 374106

4 years agoTry to get ubsan-blacklist-vfs.c pass more on Windows
Nico Weber [Tue, 8 Oct 2019 19:25:49 +0000 (19:25 +0000)]
Try to get ubsan-blacklist-vfs.c pass more on Windows

llvm-svn: 374105

4 years ago[Reproducer] Don't isntrument methods that get called from the signal handler.
Jonas Devlieghere [Tue, 8 Oct 2019 19:17:42 +0000 (19:17 +0000)]
[Reproducer] Don't isntrument methods that get called from the signal handler.

LLDB's signal handlers call SBDebugger methods, which themselves try to
be really careful about not doing anything non-signal safe. The
Reproducer record macro is not careful though, and does unsafe things
which potentially caused LLDB to crash. Given that these methods are not
particularly interesting I've swapped the RECORD macros with DUMMY ones,
so that we still register the API boundary but don't do anything
non-signal safe.

Thanks Jim for figuring this one out!

llvm-svn: 374104

4 years agoTry to get readability-deleted-default.cpp to pass on Windows.
Nico Weber [Tue, 8 Oct 2019 19:14:34 +0000 (19:14 +0000)]
Try to get readability-deleted-default.cpp to pass on Windows.

In MS compatibility mode, "extern inline void g()" is not a redundant
declaration for "inline void g()", because of redeclForcesDefMSVC()
(see PR19264, r205485).

To fix, run the test with -fms-compatiblity forced on and off
and explicit check for the differing behavior for extern inline.

Final bit of PR43593.

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

llvm-svn: 374103

4 years agoMark several PointerIntPair methods as lvalue-only
Jordan Rose [Tue, 8 Oct 2019 19:01:48 +0000 (19:01 +0000)]
Mark several PointerIntPair methods as lvalue-only

No point in mutating 'this' if it's just going to be thrown away.

https://reviews.llvm.org/D63945

llvm-svn: 374102

4 years ago[tblgen] Add getOperatorAsDef() to Record
Daniel Sanders [Tue, 8 Oct 2019 18:41:32 +0000 (18:41 +0000)]
[tblgen] Add getOperatorAsDef() to Record

Summary:
While working with DagInit's, it's often the case that you expect the
operator to be a reference to a def. This patch adds a wrapper for this
common case to reduce the amount of boilerplate callers need to duplicate
repeatedly.

getOperatorAsDef() returns the record if the DagInit has an operator that is
a DefInit. Otherwise, it prints a fatal error.

There's only a few pre-existing examples in LLVM at the moment and I've
left a few instances of the code this simplifies as they had more specific
error messages than the generic one this produces. I'm going to be using
this a fair bit in my subsequent patches.

Reviewers: bogner, volkan, nhaehnle

Reviewed By: nhaehnle

Subscribers: nhaehnle, hiraditya, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lenary, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

llvm-svn: 374101

4 years ago[CMake] Fix building without python on Windows
Alex Langford [Tue, 8 Oct 2019 18:38:46 +0000 (18:38 +0000)]
[CMake] Fix building without python on Windows

Summary: find_python_libs_windows might set LLDB_DISABLE_PYTHON to ON.
Unfortunately we do not re-check this variable before using variables filled in
by find_python_libs_windows, leading to a failed configuration.

llvm-svn: 374100

4 years ago[BPF] do compile-once run-everywhere relocation for bitfields
Yonghong Song [Tue, 8 Oct 2019 18:23:17 +0000 (18:23 +0000)]
[BPF] do compile-once run-everywhere relocation for bitfields

A bpf specific clang intrinsic is introduced:
   u32 __builtin_preserve_field_info(member_access, info_kind)
Depending on info_kind, different information will
be returned to the program. A relocation is also
recorded for this builtin so that bpf loader can
patch the instruction on the target host.
This clang intrinsic is used to get certain information
to facilitate struct/union member relocations.

The offset relocation is extended by 4 bytes to
include relocation kind.
Currently supported relocation kinds are
 enum {
    FIELD_BYTE_OFFSET = 0,
    FIELD_BYTE_SIZE,
    FIELD_EXISTENCE,
    FIELD_SIGNEDNESS,
    FIELD_LSHIFT_U64,
    FIELD_RSHIFT_U64,
 };
for __builtin_preserve_field_info. The old
access offset relocation is covered by
    FIELD_BYTE_OFFSET = 0.

An example:
struct s {
    int a;
    int b1:9;
    int b2:4;
};
enum {
    FIELD_BYTE_OFFSET = 0,
    FIELD_BYTE_SIZE,
    FIELD_EXISTENCE,
    FIELD_SIGNEDNESS,
    FIELD_LSHIFT_U64,
    FIELD_RSHIFT_U64,
};

void bpf_probe_read(void *, unsigned, const void *);
int field_read(struct s *arg) {
  unsigned long long ull = 0;
  unsigned offset = __builtin_preserve_field_info(arg->b2, FIELD_BYTE_OFFSET);
  unsigned size = __builtin_preserve_field_info(arg->b2, FIELD_BYTE_SIZE);
 #ifdef USE_PROBE_READ
  bpf_probe_read(&ull, size, (const void *)arg + offset);
  unsigned lshift = __builtin_preserve_field_info(arg->b2, FIELD_LSHIFT_U64);
 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  lshift = lshift + (size << 3) - 64;
 #endif
 #else
  switch(size) {
  case 1:
    ull = *(unsigned char *)((void *)arg + offset); break;
  case 2:
    ull = *(unsigned short *)((void *)arg + offset); break;
  case 4:
    ull = *(unsigned int *)((void *)arg + offset); break;
  case 8:
    ull = *(unsigned long long *)((void *)arg + offset); break;
  }
  unsigned lshift = __builtin_preserve_field_info(arg->b2, FIELD_LSHIFT_U64);
 #endif
  ull <<= lshift;
  if (__builtin_preserve_field_info(arg->b2, FIELD_SIGNEDNESS))
    return (long long)ull >> __builtin_preserve_field_info(arg->b2, FIELD_RSHIFT_U64);
  return ull >> __builtin_preserve_field_info(arg->b2, FIELD_RSHIFT_U64);
}

There is a minor overhead for bpf_probe_read() on big endian.

The code and relocation generated for field_read where bpf_probe_read() is
used to access argument data on little endian mode:
        r3 = r1
        r1 = 0
        r1 = 4  <=== relocation (FIELD_BYTE_OFFSET)
        r3 += r1
        r1 = r10
        r1 += -8
        r2 = 4  <=== relocation (FIELD_BYTE_SIZE)
        call bpf_probe_read
        r2 = 51 <=== relocation (FIELD_LSHIFT_U64)
        r1 = *(u64 *)(r10 - 8)
        r1 <<= r2
        r2 = 60 <=== relocation (FIELD_RSHIFT_U64)
        r0 = r1
        r0 >>= r2
        r3 = 1  <=== relocation (FIELD_SIGNEDNESS)
        if r3 == 0 goto LBB0_2
        r1 s>>= r2
        r0 = r1
LBB0_2:
        exit

Compare to the above code between relocations FIELD_LSHIFT_U64 and
FIELD_LSHIFT_U64, the code with big endian mode has four more
instructions.
        r1 = 41   <=== relocation (FIELD_LSHIFT_U64)
        r6 += r1
        r6 += -64
        r6 <<= 32
        r6 >>= 32
        r1 = *(u64 *)(r10 - 8)
        r1 <<= r6
        r2 = 60   <=== relocation (FIELD_RSHIFT_U64)

The code and relocation generated when using direct load.
        r2 = 0
        r3 = 4
        r4 = 4
        if r4 s> 3 goto LBB0_3
        if r4 == 1 goto LBB0_5
        if r4 == 2 goto LBB0_6
        goto LBB0_9
LBB0_6:                                 # %sw.bb1
        r1 += r3
        r2 = *(u16 *)(r1 + 0)
        goto LBB0_9
LBB0_3:                                 # %entry
        if r4 == 4 goto LBB0_7
        if r4 == 8 goto LBB0_8
        goto LBB0_9
LBB0_8:                                 # %sw.bb9
        r1 += r3
        r2 = *(u64 *)(r1 + 0)
        goto LBB0_9
LBB0_5:                                 # %sw.bb
        r1 += r3
        r2 = *(u8 *)(r1 + 0)
        goto LBB0_9
LBB0_7:                                 # %sw.bb5
        r1 += r3
        r2 = *(u32 *)(r1 + 0)
LBB0_9:                                 # %sw.epilog
        r1 = 51
        r2 <<= r1
        r1 = 60
        r0 = r2
        r0 >>= r1
        r3 = 1
        if r3 == 0 goto LBB0_11
        r2 s>>= r1
        r0 = r2
LBB0_11:                                # %sw.epilog
        exit

Considering verifier is able to do limited constant
propogation following branches. The following is the
code actually traversed.
        r2 = 0
        r3 = 4   <=== relocation
        r4 = 4   <=== relocation
        if r4 s> 3 goto LBB0_3
LBB0_3:                                 # %entry
        if r4 == 4 goto LBB0_7
LBB0_7:                                 # %sw.bb5
        r1 += r3
        r2 = *(u32 *)(r1 + 0)
LBB0_9:                                 # %sw.epilog
        r1 = 51   <=== relocation
        r2 <<= r1
        r1 = 60   <=== relocation
        r0 = r2
        r0 >>= r1
        r3 = 1
        if r3 == 0 goto LBB0_11
        r2 s>>= r1
        r0 = r2
LBB0_11:                                # %sw.epilog
        exit

For native load case, the load size is calculated to be the
same as the size of load width LLVM otherwise used to load
the value which is then used to extract the bitfield value.

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

llvm-svn: 374099

4 years ago[NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows
Jan Korous [Tue, 8 Oct 2019 18:13:04 +0000 (18:13 +0000)]
[NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows

Previously disabled in d0c2d5daa3e

llvm-svn: 374098

4 years ago[driver][hip] Skip bundler if host action is nothing.
Michael Liao [Tue, 8 Oct 2019 18:06:51 +0000 (18:06 +0000)]
[driver][hip] Skip bundler if host action is nothing.

Reviewers: sfantao, tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 374097

4 years agoReflow/fix doxygen comments.
Adrian Prantl [Tue, 8 Oct 2019 18:04:49 +0000 (18:04 +0000)]
Reflow/fix doxygen comments.

llvm-svn: 374096

4 years agoFix sign extension handling in DumpEnumValue
Frederic Riss [Tue, 8 Oct 2019 17:59:02 +0000 (17:59 +0000)]
Fix sign extension handling in DumpEnumValue

When an enumerator has an unsigned type and its high bit set, the
code introduced in r374067 would fail to match it due to a sign
extension snafu. This commit fixes this aspec of the code and should
fix the bots.

I think it's not a complete fix though, I'll add more test coverage
and additional tweaks in a follow-up commit.

llvm-svn: 374095

4 years agoexception handling in PythonDataObjects.
Lawrence D'Anna [Tue, 8 Oct 2019 17:56:18 +0000 (17:56 +0000)]
exception handling in PythonDataObjects.

Summary:
Python APIs nearly all can return an exception.   They do this
by returning NULL, or -1, or some such value and setting
the exception state with PyErr_Set*().   Exceptions must be
handled before further python API functions are called.   Failure
to do so will result in asserts on debug builds of python.
It will also sometimes, but not usually result in crashes of
release builds.

Nearly everything in PythonDataObjects.h needs to be updated
to account for this.   This patch doesn't fix everything,
but it does introduce some new methods using Expected<>
return types that are safe to use.

split off from https://reviews.llvm.org/D68188

Reviewers: JDevlieghere, jasonmolenda, labath, zturner

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374094

4 years ago[OPENMP50]Do not allow multiple same context traits in the same context
Alexey Bataev [Tue, 8 Oct 2019 17:47:52 +0000 (17:47 +0000)]
[OPENMP50]Do not allow multiple same context traits in the same context
selector.

According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each
trait-selector-name can only be specified once. Added check for this
restriction.

llvm-svn: 374093

4 years agoAMDGPU: Fix i16 arithmetic pattern redundancy
Matt Arsenault [Tue, 8 Oct 2019 17:36:38 +0000 (17:36 +0000)]
AMDGPU: Fix i16 arithmetic pattern redundancy

There were 2 problems here. First, these patterns were duplicated to
handle the inverted shift operands instead of using the commuted
PatFrags.

Second, the point of the zext folding patterns don't apply to the
non-0ing high subtargets. They should be skipped instead of inserting
the extension. The zeroing high code would be emitted when necessary
anyway. This was also emitting unnecessary zexts in cases where the
high bits were undefined.

llvm-svn: 374092

4 years agoRevert "[LoopVectorize][PowerPC] Estimate int and float register pressure separately...
Jinsong Ji [Tue, 8 Oct 2019 17:32:56 +0000 (17:32 +0000)]
Revert "[LoopVectorize][PowerPC] Estimate int and float register pressure separately in loop-vectorize"

Also Revert "[LoopVectorize] Fix non-debug builds after rL374017"

This reverts commit 9f41deccc0e648a006c9f38e11919f181b6c7e0a.
This reverts commit 18b6fe07bcf44294f200bd2b526cb737ed275c04.

The patch is breaking PowerPC internal build, checked with author, reverting
on behalf of him for now due to timezone.

llvm-svn: 374091

4 years ago[SLP] add test with prefer-vector-width function attribute; NFC (PR43578)
Sanjay Patel [Tue, 8 Oct 2019 17:18:32 +0000 (17:18 +0000)]
[SLP] add test with prefer-vector-width function attribute; NFC (PR43578)

llvm-svn: 374090

4 years ago[CodeExtractor] Factor out and reuse shrinkwrap analysis
Vedant Kumar [Tue, 8 Oct 2019 17:17:51 +0000 (17:17 +0000)]
[CodeExtractor] Factor out and reuse shrinkwrap analysis

Factor out CodeExtractor's analysis of allocas (for shrinkwrapping
purposes), and allow the analysis to be reused.

This resolves a quadratic compile-time bug observed when compiling
AMDGPUDisassembler.cpp.o.

Pre-patch (Release + LTO clang):

```
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
  176.5278 ( 57.8%)   0.4915 ( 18.5%)  177.0192 ( 57.4%)  177.4112 ( 57.3%)  Hot Cold Splitting
```

Post-patch (ReleaseAsserts clang):

```
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
  1.4051 (  3.3%)   0.0079 (  0.3%)   1.4129 (  3.2%)   1.4129 (  3.2%)  Hot Cold Splitting
```

Testing: check-llvm, and comparing the AMDGPUDisassembler.cpp.o binary
pre- vs. post-patch.

An alternate approach is to hide CodeExtractorAnalysisCache from clients
of CodeExtractor, and to recompute the analysis from scratch inside of
CodeExtractor::extractCodeRegion(). This eliminates some redundant work
in the shrinkwrapping legality check. However, some clients continue to
exhibit O(n^2) compile time behavior as computing the analysis is O(n).

rdar://55912966

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

llvm-svn: 374089

4 years ago[sanitizer] Disable crypt*.cpp tests on Android
Vitaly Buka [Tue, 8 Oct 2019 17:06:27 +0000 (17:06 +0000)]
[sanitizer] Disable crypt*.cpp tests on Android

llvm-svn: 374088

4 years agoAMDGPU: Add offsets to MMO when lowering buffer intrinsics
Tom Stellard [Tue, 8 Oct 2019 17:04:51 +0000 (17:04 +0000)]
AMDGPU: Add offsets to MMO when lowering buffer intrinsics

Summary:
Without offsets on the MachineMemOperands (MMOs),
MachineInstr::mayAlias() will return true for all reads and writes to the
same resource descriptor.  This leads to O(N^2) complexity in the MachineScheduler
when analyzing dependencies of buffer loads and stores.  It also limits
the SILoadStoreOptimizer from merging more instructions.

This patch reduces the compile time of one pathological compute shader
from 12 seconds to 1 second.

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

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

Tags: #llvm

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

llvm-svn: 374087

4 years ago[Attributor][Fix] Temporary fix for windows build bot failure
Hideto Ueno [Tue, 8 Oct 2019 17:01:56 +0000 (17:01 +0000)]
[Attributor][Fix] Temporary fix for windows build bot failure

D65402 causes test failure related to attributor-max-iterations.
This commit removes attributor-max-iterations-verify for now.
I'll examine the factor and the flag should be reverted.

llvm-svn: 374086

4 years agoCodeGenPrepare - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
Simon Pilgrim [Tue, 8 Oct 2019 17:00:01 +0000 (17:00 +0000)]
CodeGenPrepare - silence static analyzer dyn_cast<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 374085

4 years agoObjectFileMachO: Replace std::map with llvm::DenseMap (NFC)
Adrian Prantl [Tue, 8 Oct 2019 16:59:24 +0000 (16:59 +0000)]
ObjectFileMachO: Replace std::map with llvm::DenseMap (NFC)

This makes parsing the symbol table of clang marginally faster. (Hashtable versus tree).

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

llvm-svn: 374084

4 years ago[AMDGPU] Disable unused gfx10 dpp instructions
Stanislav Mekhanoshin [Tue, 8 Oct 2019 16:56:01 +0000 (16:56 +0000)]
[AMDGPU] Disable unused gfx10 dpp instructions

Inhibit generation of unused real dpp instructions on gfx10 just
like it is done on other subtargets. This does not change anything
because these are illegal anyway and not accepted, but it does
reduce the number of instruction definitions generated.

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

llvm-svn: 374083

4 years agoReplace regex match with rfind (NFCish)
Adrian Prantl [Tue, 8 Oct 2019 16:29:39 +0000 (16:29 +0000)]
Replace regex match with rfind (NFCish)

This change is mostly performance-neutral since our regex engine is
fast, but it's IMHO slightly more readable.  Also, matching matching
parenthesis is not a great match for regular expressions.

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

llvm-svn: 374082

4 years agoReplace static const StringRef with StringRef (NFC)
Adrian Prantl [Tue, 8 Oct 2019 16:29:36 +0000 (16:29 +0000)]
Replace static const StringRef with StringRef (NFC)

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

llvm-svn: 374081

4 years agoRemove constructor and unused method (NFC).
Adrian Prantl [Tue, 8 Oct 2019 16:29:33 +0000 (16:29 +0000)]
Remove constructor and unused method (NFC).

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

llvm-svn: 374080

4 years ago[libc++] Make sure we link all system libraries into the benchmarks
Louis Dionne [Tue, 8 Oct 2019 16:26:24 +0000 (16:26 +0000)]
[libc++] Make sure we link all system libraries into the benchmarks

It turns out that r374056 broke _some_ build bots again, specifically
the ones using sanitizers. Instead of trying to link the right system
libraries to the benchmarks bit-by-bit, let's just link exactly the
system libraries that libc++ itself needs.

llvm-svn: 374079

4 years ago[UpdateCCTestChecks] Detect function mangled name on separate line
David Greene [Tue, 8 Oct 2019 16:25:42 +0000 (16:25 +0000)]
[UpdateCCTestChecks] Detect function mangled name on separate line

Sometimes functions with large comment blocks in front of them have their
declarations output on several lines by c-index-test.  Hence the one-line
function name/line/mangled pattern will not work to detect them.  Break the
pattern up into two patterns and keep state after seeing the name/line
information until we finally see the mangled name.

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

llvm-svn: 374078

4 years agoRevert "[platform process list] add a flag for showing the processes of all users"
Shafik Yaghmour [Tue, 8 Oct 2019 16:24:28 +0000 (16:24 +0000)]
Revert "[platform process list] add a flag for showing the processes of all users"

This reverts commit 080f35fb875f52c924ee37ed4d56a51fe7056afa.

 Conflicts:
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py

llvm-svn: 374077

4 years ago[Testsuite] Get rid of most of the recursive shared library Makefiles
Frederic Riss [Tue, 8 Oct 2019 16:23:28 +0000 (16:23 +0000)]
[Testsuite] Get rid of most of the recursive shared library Makefiles

Most of the secondary Makefiles we have are just a couple variable
definitions and then an include of Makefile.rules. This patch removes
most of the secondary Makefiles and replaces them with a direct
invocation of Makefile.rules in the main Makefile. The specificities
of each sub-build are listed right there on the recursive $(MAKE)
call. All the variables that matter are being passed automagically by
make as they have been passed on the command line. The only things you
need to specify are the variables customizating the Makefile.rules
logic for each image.

This patch also removes most of the clean logic from those Makefiles
and from Makefile.rules. The clean rule is not required anymore now
that we run the testsuite in a separate build directory that is wiped
with each run. The patch leaves a very crude version of clean in
Makefile.rules which removes everything inside of $(BUILDDIR). It does
this only when the $(BUILDDIR) looks like a sub-directory of our
standard testsuite build directory to be extra safe.

Reviewers: aprantl, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374076

4 years ago[NFC][CVP] Add tests where we can replace sext with zext
Roman Lebedev [Tue, 8 Oct 2019 16:21:13 +0000 (16:21 +0000)]
[NFC][CVP] Add tests where we can replace sext with zext

If the sign bit of the value that is being sign-extended is not set,
i.e. the value is non-negative (s>= 0), then zero-extension will suffice,
and is better for analysis: https://rise4fun.com/Alive/a8PD

llvm-svn: 374075

4 years ago(Re)generate various tests. NFC
Amaury Sechet [Tue, 8 Oct 2019 16:16:26 +0000 (16:16 +0000)]
(Re)generate various tests. NFC

llvm-svn: 374074

4 years ago[WebAssembly] Fix a bug in 'try' placement
Heejin Ahn [Tue, 8 Oct 2019 16:15:39 +0000 (16:15 +0000)]
[WebAssembly] Fix a bug in 'try' placement

Summary:
When searching for local expression tree created by stackified
registers, for 'block' placement, we start the search from the previous
instruction of a BB's terminator. But in 'try''s case, we should start
from the previous instruction of a call that can throw, or a EH_LABEL
that precedes the call, because the return values of the call's previous
instructions can be stackified and consumed by the throwing call.

For example,
```
  i32.call @foo
  call @bar         ; may throw
  br $label0
```
In this case, if we start the search from the previous instruction of
the terminator (`br` here), we end up stopping at `call @bar` and place
a 'try' between `i32.call @foo` and `call @bar`, because `call @bar`
does not have a return value so it is not a local expression tree of
`br`.

But in this case, unlike when placing 'block's, we should start the
search from `call @bar`, because the return value of `i32.call @foo` is
stackified and used by `call @bar`.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 374073

4 years ago[OPENMP50]Prohibit multiple context selector sets in context selectors.
Alexey Bataev [Tue, 8 Oct 2019 15:56:43 +0000 (15:56 +0000)]
[OPENMP50]Prohibit multiple context selector sets in context selectors.

According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each
trait-set-selector-name can only be specified once. Added check to
implement this restriction.

llvm-svn: 374072

4 years ago[lldb] Avoid resource leak
Konrad Kleine [Tue, 8 Oct 2019 15:56:02 +0000 (15:56 +0000)]
[lldb] Avoid resource leak

Summary:
Before the pointer variable `args_dict` was assigned the result of an
allocation with `new` and then `args_dict` is passed to
`GetValueForKeyAsDictionary` which immediatly and unconditionally
assigns `args_dict` to `nullptr`:

```
    bool GetValueForKeyAsDictionary(llvm::StringRef key,
                                    Dictionary *&result) const {
      result = nullptr;
```

This caused a memory leak which was found in my coverity scan instance
under CID 224753: https://scan.coverity.com/projects/kwk-llvm-project.

Reviewers: jankratochvil, teemperor

Reviewed By: teemperor

Subscribers: teemperor, lldb-commits

Tags: #lldb

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

llvm-svn: 374071

4 years ago[builtins] Unbreak build on FreeBSD armv7 after D60351
David Carlier [Tue, 8 Oct 2019 15:45:35 +0000 (15:45 +0000)]
[builtins] Unbreak build on FreeBSD armv7 after D60351

headers include reordering.

Reviewers: phosek, echristo

Reviewed-By: phosek
Differential Revsion: https://reviews.llvm.org/D68045

llvm-svn: 374070

4 years agoSimplify LZMA decoding by using ArrayRef::take_back
Konrad Kleine [Tue, 8 Oct 2019 15:43:29 +0000 (15:43 +0000)]
Simplify LZMA decoding by using ArrayRef::take_back

Summary: Follow-up for D66791#inline-616303

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374069

4 years ago[DebugInfo][If-Converter] Update call site info during the optimization
Nikola Prica [Tue, 8 Oct 2019 15:43:12 +0000 (15:43 +0000)]
[DebugInfo][If-Converter] Update call site info during the optimization

During the If-Converter optimization pay attention when copying or
deleting call instructions in order to keep call site information in
valid state.

Reviewers: aprantl, vsk, efriedma

Reviewed By: vsk, efriedma

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

llvm-svn: 374068

4 years agoAdd pretty printing of Clang "bitfield" enums
Frederic Riss [Tue, 8 Oct 2019 15:35:59 +0000 (15:35 +0000)]
Add pretty printing of Clang "bitfield" enums

Summary:
Using enumerators as flags is standard practice. This patch adds
support to LLDB to display such enum values symbolically, eg:

(E) e1 = A | B

If enumerators don't cover the whole value, the remaining bits are
displayed as hexadecimal:

(E) e4 = A | 0x10

Detecting whether an enum is used as a bitfield or not is
complicated. This patch implements a heuristic that assumes that such
enumerators will either have only 1 bit set or will be a combination
of previous values.

This patch doesn't change the way we currently display enums which the
above heuristic would not consider as bitfields.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

llvm-svn: 374067

4 years agoExtract and simplify DumpEnumValue
Frederic Riss [Tue, 8 Oct 2019 15:35:58 +0000 (15:35 +0000)]
Extract and simplify DumpEnumValue

llvm-svn: 374066

4 years agogn build: Merge r374062
GN Sync Bot [Tue, 8 Oct 2019 15:34:52 +0000 (15:34 +0000)]
gn build: Merge r374062

llvm-svn: 374065

4 years agogn build: Merge r374061
GN Sync Bot [Tue, 8 Oct 2019 15:28:36 +0000 (15:28 +0000)]
gn build: Merge r374061

llvm-svn: 374064

4 years ago[Attributor][MustExec] Deduce dereferenceable and nonnull attribute using MustBeExecu...
Hideto Ueno [Tue, 8 Oct 2019 15:25:56 +0000 (15:25 +0000)]
[Attributor][MustExec] Deduce dereferenceable and nonnull attribute using MustBeExecutedContextExplorer

Summary:
In D65186 and related patches, MustBeExecutedContextExplorer is introduced. This enables us to traverse instructions guaranteed to execute from function entry. If we can know the argument is used as `dereferenceable` or `nonnull` in these instructions, we can mark `dereferenceable` or `nonnull` in the argument definition:

1. Memory instruction (similar to D64258)
Trace memory instruction pointer operand. Currently, only inbounds GEPs are traced.
```
define i64* @f(i64* %a) {
entry:
  %add.ptr = getelementptr inbounds i64, i64* %a, i64 1
; (because of inbounds GEP we can know that %a is at least dereferenceable(16))
  store i64 1, i64* %add.ptr, align 8
  ret i64* %add.ptr ; dereferenceable 8 (because above instruction stores into it)
}
```

2. Propagation from callsite (similar to D27855)
If `deref` or `nonnull` are known in call site parameter attributes we can also say that argument also that attribute.

```
declare void @use3(i8* %x, i8* %y, i8* %z);
declare void @use3nonnull(i8* nonnull %x, i8* nonnull %y, i8* nonnull %z);

define void @parent1(i8* %a, i8* %b, i8* %c) {
  call void @use3nonnull(i8* %b, i8* %c, i8* %a)
; Above instruction is always executed so we can say that@parent1(i8* nonnnull %a, i8* nonnull %b, i8* nonnull %c)
  call void @use3(i8* %c, i8* %a, i8* %b)
  ret void
}
```

Reviewers: jdoerfert, sstefan1, spatel, reames

Reviewed By: jdoerfert

Subscribers: xbolva00, hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 374063

4 years agoRevert [TextAPI] Introduce TBDv4
Cyndy Ishida [Tue, 8 Oct 2019 15:24:37 +0000 (15:24 +0000)]
Revert [TextAPI] Introduce TBDv4

This reverts r374058 (git commit 5d566c5a46aeaa1fa0e5c0b823c9d5f84036dc9a)

llvm-svn: 374062

4 years ago[clang][ifs] Clang Interface Stubs ToolChain plumbing.
Puyan Lotfi [Tue, 8 Oct 2019 15:23:14 +0000 (15:23 +0000)]
[clang][ifs] Clang Interface Stubs ToolChain plumbing.

Second Landing Attempt:

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)

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

llvm-svn: 374061

4 years ago[Attributor] Add helper class to compose two structured deduction.
Hideto Ueno [Tue, 8 Oct 2019 15:20:19 +0000 (15:20 +0000)]
[Attributor] Add helper class to compose two structured deduction.

Summary: This patch introduces a generic way to compose two structured deductions.  This will be used for composing generic deduction with `MustBeExecutedExplorer` and other existing generic deduction.

Reviewers: jdoerfert, sstefan1

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 374060

4 years agogn build: Merge r374058
GN Sync Bot [Tue, 8 Oct 2019 15:12:38 +0000 (15:12 +0000)]
gn build: Merge r374058

llvm-svn: 374059

4 years ago[TextAPI] Introduce TBDv4
Cyndy Ishida [Tue, 8 Oct 2019 15:07:36 +0000 (15:07 +0000)]
[TextAPI] Introduce TBDv4

Summary:
This format introduces new features and platforms
The motivation for this format is to support more than 1 platform since previous versions only supported additional architectures and 1 platform,
for example ios + ios-simulator and macCatalyst.

Reviewers: ributzka, steven_wu

Reviewed By: ributzka

Subscribers: mgorny, hiraditya, mgrang, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 374058

4 years ago[OPENMP50]Allow functions in declare variant directive to have different
Alexey Bataev [Tue, 8 Oct 2019 14:56:20 +0000 (14:56 +0000)]
[OPENMP50]Allow functions in declare variant directive to have different
C linkage.

After some discussion with OpenMP developers, it was decided that the
functions with the different C linkage can be used in declare variant
directive.

llvm-svn: 374057

4 years ago[libc++] TAKE 2: Make system libraries PRIVATE dependencies of libc++
Louis Dionne [Tue, 8 Oct 2019 14:53:11 +0000 (14:53 +0000)]
[libc++] TAKE 2: Make system libraries PRIVATE dependencies of libc++

We tried doing that previously (in r373487) and failed (reverted in
r373506) because the benchmarks needed to link against system libraries
and relied on libc++'s dependencies being propagated. Now that this has
been fixed (in r374053), this commit marks the system libraries as
PRIVATE dependencies of libc++.

llvm-svn: 374056

4 years ago[Mips] Emit proper ABI for _mcount calls
Mirko Brkusanin [Tue, 8 Oct 2019 14:32:03 +0000 (14:32 +0000)]
[Mips] Emit proper ABI for _mcount calls

When -pg option is present than a call to _mcount is inserted into every
function. However since the proper ABI was not followed then the generated
gmon.out did not give proper results. By inserting needed instructions
before every _mcount we can fix this.

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

llvm-svn: 374055

4 years ago[llvm-exegesis] Add options to SnippetGenerator.
Clement Courbet [Tue, 8 Oct 2019 14:30:24 +0000 (14:30 +0000)]
[llvm-exegesis] Add options to SnippetGenerator.

Summary:
This adds a `-max-configs-per-opcode` option to limit the number of
configs per opcode.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 374054

4 years ago[libc++] Add missing link-time dependencies to the benchmarks
Louis Dionne [Tue, 8 Oct 2019 14:28:56 +0000 (14:28 +0000)]
[libc++] Add missing link-time dependencies to the benchmarks

Since the benchmarks build with -nostdlib, they need to manually link
against some system libraries that are used by the benchmarks and the
GoogleBenchmark library itself.

Previously, we'd rely on the fact that these libraries were linked
through the PUBLIC dependencies of cxx_shared/cxx_static. However,
if we were to make these dependencies PRIVATE (as they should be
because they are implementation details of libc++), the benchmarks
would fail to link. This commit remediates that.

llvm-svn: 374053

4 years ago[lld][Hexagon] Support PLT relocation R_HEX_B15_PCREL_X/R_HEX_B9_PCREL_X
Sid Manning [Tue, 8 Oct 2019 14:23:49 +0000 (14:23 +0000)]
[lld][Hexagon] Support PLT relocation R_HEX_B15_PCREL_X/R_HEX_B9_PCREL_X

These are sometimes generated by tail call optimizations.

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

llvm-svn: 374052

4 years agoObject/minidump: Add support for the MemoryInfoList stream
Pavel Labath [Tue, 8 Oct 2019 14:15:32 +0000 (14:15 +0000)]
Object/minidump: Add support for the MemoryInfoList stream

Summary:
This patch adds the definitions of the constants and structures
necessary to interpret the MemoryInfoList minidump stream, as well as
the object::MinidumpFile interface to access the stream.

While the code is fairly simple, there is one important deviation from
the other minidump streams, which is worth calling out explicitly.
Unlike other "List" streams, the size of the records inside
MemoryInfoList stream is not known statically. Instead it is described
in the stream header. This makes it impossible to return
ArrayRef<MemoryInfo> from the accessor method, as it is done with other
streams. Instead, I create an iterator class, which can be parameterized
by the runtime size of the structure, and return
iterator_range<iterator> instead.

Reviewers: amccarth, jhenderson, clayborg

Subscribers: JosephTremoulet, zturner, markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 374051

4 years ago[libc++] Use PRIVATE to link benchmark dependencies
Louis Dionne [Tue, 8 Oct 2019 14:10:55 +0000 (14:10 +0000)]
[libc++] Use PRIVATE to link benchmark dependencies

It's better style to use PRIVATE when linking libraries to executables,
and it doesn't make a difference since executables don't need to propagate
their link-time dependencies anyway.

llvm-svn: 374050

4 years agoNope, I'm wrong. It looks like someone else removed these on purpose and
Kevin P. Neal [Tue, 8 Oct 2019 14:10:26 +0000 (14:10 +0000)]
Nope, I'm wrong. It looks like someone else removed these on purpose and
it just happened to break the bot right when I did my push. So I'm undoing
this mornings incorrect push. I've also kicked off an email to hopefully
get the bot fixed the correct way.

llvm-svn: 374049

4 years ago[clangd] Disable expand auto on decltype(auto)
Ilya Biryukov [Tue, 8 Oct 2019 14:03:45 +0000 (14:03 +0000)]
[clangd] Disable expand auto on decltype(auto)

Summary: Applying it produces incorrect code at the moment.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: kuhnel, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 374048

4 years ago[clangd] Bump timeouts in speculative completion tests
Kadir Cetinkaya [Tue, 8 Oct 2019 13:54:03 +0000 (13:54 +0000)]
[clangd] Bump timeouts in speculative completion tests

llvm-svn: 374047

4 years agoTweak minidebuginfo-set-and-hit-breakpoint.test
Pavel Labath [Tue, 8 Oct 2019 13:51:05 +0000 (13:51 +0000)]
Tweak minidebuginfo-set-and-hit-breakpoint.test

On my system, llvm-objcopy was refusing to remove the .dynsym section
because it was still referenced from .rela.plt. Remove that section too,
and clarify that this is needed only because llvm-objcopy
--only-keep-debug does not work (does not set the sections to
SHT_NOBITS). Also, ensure that the test is not creating temporary files
in the source tree.

llvm-svn: 374046

4 years agoRestore documentation that 'svn update' unexpectedly yanked out from under me.
Kevin P. Neal [Tue, 8 Oct 2019 13:38:42 +0000 (13:38 +0000)]
Restore documentation that 'svn update' unexpectedly yanked out from under me.

llvm-svn: 374045

4 years agofix fmls fp16
Sebastian Pop [Tue, 8 Oct 2019 13:23:57 +0000 (13:23 +0000)]
fix fmls fp16

Tim Northover remarked that the added patterns for fmls fp16
produce wrong code in case the fsub instruction has a
multiplication as its first operand, i.e., all the patterns FMLSv*_OP1:

> define <8 x half> @test_FMLSv8f16_OP1(<8 x half> %a, <8 x half> %b, <8 x half> %c) {
> ; CHECK-LABEL: test_FMLSv8f16_OP1:
> ; CHECK: fmls {{v[0-9]+}}.8h, {{v[0-9]+}}.8h, {{v[0-9]+}}.8h
> entry:
>
>   %mul = fmul fast <8 x half> %c, %b
>   %sub = fsub fast <8 x half> %mul, %a
>   ret <8 x half> %sub
> }
>
> This doesn't look right to me. The exact instruction produced is "fmls
> v0.8h, v2.8h, v1.8h", which I think calculates "v0 - v2*v1", but the
> IR is calculating "v2*v1-v0". The equivalent <4 x float> code also
> doesn't emit an fmls.

This patch generates an fmla and negates the value of the operand2 of the fsub.

Inspecting the pattern match, I found that there was another mistake in the
opcode to be selected: matching FMULv4*16 should generate FMLSv4*16
and not FMLSv2*32.

Tested on aarch64-linux with make check-all.

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

llvm-svn: 374044

4 years agoAdd test for rotating truncated vectors. NFC
Amaury Sechet [Tue, 8 Oct 2019 13:08:51 +0000 (13:08 +0000)]
Add test for rotating truncated vectors. NFC

llvm-svn: 374043

4 years ago[SVE][IR] Scalable Vector size queries and IR instruction support
Graham Hunter [Tue, 8 Oct 2019 12:53:54 +0000 (12:53 +0000)]
[SVE][IR] Scalable Vector size queries and IR instruction support

* Adds a TypeSize struct to represent the known minimum size of a type
  along with a flag to indicate that the runtime size is a integer multiple
  of that size
* Converts existing size query functions from Type.h and DataLayout.h to
  return a TypeSize result
* Adds convenience methods (including a transparent conversion operator
  to uint64_t) so that most existing code 'just works' as if the return
  values were still scalars.
* Uses the new size queries along with ElementCount to ensure that all
  supported instructions used with scalable vectors can be constructed
  in IR.

Reviewers: hfinkel, lattner, rkruppe, greened, rovka, rengolin, sdesmalen

Reviewed By: rovka, sdesmalen

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

llvm-svn: 374042

4 years agoAMDGPU: Propagate undef flag during pre-RA exec mask optimizations
Nicolai Haehnle [Tue, 8 Oct 2019 12:46:32 +0000 (12:46 +0000)]
AMDGPU: Propagate undef flag during pre-RA exec mask optimizations

Summary: Issue: https://github.com/GPUOpen-Drivers/llpc/issues/204

Reviewers: arsenm, rampitec

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

Tags: #llvm

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

llvm-svn: 374041

4 years agoMachineSSAUpdater: insert IMPLICIT_DEF at top of basic block
Nicolai Haehnle [Tue, 8 Oct 2019 12:46:20 +0000 (12:46 +0000)]
MachineSSAUpdater: insert IMPLICIT_DEF at top of basic block

Summary:
When getValueInMiddleOfBlock happens to be called for a basic block
that has no incoming value at all, an IMPLICIT_DEF is inserted in that
block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at
the top of its basic block or it will likely not reach the use that
the caller intends to insert.

Issue: https://github.com/GPUOpen-Drivers/llpc/issues/204

Reviewers: arsenm, rampitec

Subscribers: jvesely, wdng, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 374040

4 years ago[SLP] add test with prefer-vector-width function attribute; NFC
Sanjay Patel [Tue, 8 Oct 2019 12:43:46 +0000 (12:43 +0000)]
[SLP] add test with prefer-vector-width function attribute; NFC

llvm-svn: 374039

4 years agoDon't assume Type from `readelf -d` has parentheses
Andrey Churbanov [Tue, 8 Oct 2019 12:39:04 +0000 (12:39 +0000)]
Don't assume Type from `readelf -d` has parentheses

Patch by jbeich (Jan Beich)

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

llvm-svn: 374038

4 years agoDon't link libm with -Wl,--as-needed on FreeBSD
Andrey Churbanov [Tue, 8 Oct 2019 12:23:25 +0000 (12:23 +0000)]
Don't link libm with -Wl,--as-needed on FreeBSD

Patch by jbeich (Jan Beich)

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

llvm-svn: 374037

4 years ago[LoopRotate] Unconditionally get DomTree.
Florian Hahn [Tue, 8 Oct 2019 11:54:42 +0000 (11:54 +0000)]
[LoopRotate] Unconditionally get DomTree.

LoopRotate is a loop pass and the DomTree should always be available.

Similar to a70c5261436322a53187d67b8bdc0445d0463a9a

llvm-svn: 374036

4 years ago[Diagnostics] Silence -Wsizeof-array-div for character buffers
James Clarke [Tue, 8 Oct 2019 11:34:02 +0000 (11:34 +0000)]
[Diagnostics] Silence -Wsizeof-array-div for character buffers

Summary:
Character buffers are sometimes used to represent a pool of memory that
contains non-character objects, due to them being synonymous with a stream of
bytes on almost all modern architectures. Often, when interacting with hardware
devices, byte buffers are therefore used as an intermediary and so we can end
Character buffers are sometimes used to represent a pool of memory that
contains non-character objects, due to them being synonymous with a stream of
bytes on almost all modern architectures. Often, when interacting with hardware
devices, byte buffers are therefore used as an intermediary and so we can end
up generating lots of false-positives.

Moreover, due to the ability of character pointers to alias non-character
pointers, the strict aliasing violations that would generally be implied by the
calculations caught by the warning (if the calculation itself is in fact
correct) do not apply here, and so although the length calculation may be
wrong, that is the only possible issue.

Reviewers: rsmith, xbolva00, thakis

Reviewed By: xbolva00, thakis

Subscribers: thakis, lebedev.ri, cfe-commits

Tags: #clang

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

llvm-svn: 374035

4 years ago[MCA][LSUnit] Track loads and stores until retirement.
Andrea Di Biagio [Tue, 8 Oct 2019 10:46:01 +0000 (10:46 +0000)]
[MCA][LSUnit] Track loads and stores until retirement.

Before this patch, loads and stores were only tracked by their corresponding
queues in the LSUnit from dispatch until execute stage. In practice we should be
more conservative and assume that memory opcodes leave their queues at
retirement stage.

Basically, loads should leave the load queue only when they have completed and
delivered their data. We conservatively assume that a load is completed when it
is retired. Stores should be tracked by the store queue from dispatch until
retirement. In practice, stores can only leave the store queue if their data can
be written to the data cache.

This is mostly a mechanical change. With this patch, the retire stage notifies
the LSUnit when a memory instruction is retired. That would triggers the release
of LDQ/STQ entries.  The only visible change is in memory tests for the bdver2
model. That is because bdver2 is the only model that defines the load/store
queue size.

This patch partially addresses PR39830.

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

llvm-svn: 374034

4 years ago[ISEL][ARM][AARCH64] Tracking simple parameter forwarding registers
Nikola Prica [Tue, 8 Oct 2019 09:43:05 +0000 (09:43 +0000)]
[ISEL][ARM][AARCH64] Tracking simple parameter forwarding registers

Support for tracking registers that forward function parameters into the
following function frame. For now we only support cases when parameter
is forwarded through single register.

Reviewers: aprantl, vsk, t.p.northover

Reviewed By: vsk

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

llvm-svn: 374033

4 years agoRemove an useless allocation (from by clang-analyzer/scan-build)
Sylvestre Ledru [Tue, 8 Oct 2019 09:17:46 +0000 (09:17 +0000)]
Remove an useless allocation (from by clang-analyzer/scan-build)
https://llvm.org/reports/scan-build/report-TargetInfo.cpp-detectFPCCEligibleStruct-9-1.html#EndPath

llvm-svn: 374032

4 years ago[llvm-exegesis] Finish plumbing the `Config` field.
Clement Courbet [Tue, 8 Oct 2019 09:06:48 +0000 (09:06 +0000)]
[llvm-exegesis] Finish plumbing the `Config` field.

Summary:
Right now there are no snippet generators that emit the `Config` Field,
but I plan to add it to investigate LEA operands for PR32326.

What was broken was:
 - `Config` Was not propagated up until the BenchmarkResult::Key.
 - Clustering should really consider different configs as measuring
 different things, so we should stabilize on (Opcode, Config) instead of
 just Opcode.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits, lebedev.ri

Tags: #llvm

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

llvm-svn: 374031

4 years agoRevert "[lldb-server/android] Show more processes and package name when necessary"
Pavel Labath [Tue, 8 Oct 2019 09:05:31 +0000 (09:05 +0000)]
Revert "[lldb-server/android] Show more processes and package name when necessary"

This reverts r373758 because it causes several to test to be flaky (=
failing ~90% of the time) on linux.

llvm-svn: 374030

4 years agoFix a -Wpedantic warning
Pavel Labath [Tue, 8 Oct 2019 09:05:25 +0000 (09:05 +0000)]
Fix a -Wpedantic warning

namespace-closing '}' don't need ';'.

llvm-svn: 374029

4 years ago[llvm-readobj/llvm-readelf] - Add checks for GNU-style to "all.test" test case.
George Rimar [Tue, 8 Oct 2019 08:59:12 +0000 (08:59 +0000)]
[llvm-readobj/llvm-readelf] - Add checks for GNU-style to "all.test" test case.

We do not check the GNU-style output when -all is given.
This patch does that.

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

llvm-svn: 374028

4 years ago[NFC] Add REQUIRES for r374017 in testcase
Zi Xuan Wu [Tue, 8 Oct 2019 08:49:15 +0000 (08:49 +0000)]
[NFC] Add REQUIRES for r374017 in testcase

llvm-svn: 374027

4 years ago[LoopRotate] Unconditionally get ScalarEvolution.
Florian Hahn [Tue, 8 Oct 2019 08:46:38 +0000 (08:46 +0000)]
[LoopRotate] Unconditionally get ScalarEvolution.

Summary: LoopRotate is a loop pass and SE should always be available.

Reviewers: anemet, asbirlea

Reviewed By: asbirlea

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

llvm-svn: 374026

4 years ago[ARM] Generate vcmp instead of vcmpe
Kristof Beyls [Tue, 8 Oct 2019 08:25:42 +0000 (08:25 +0000)]
[ARM] Generate vcmp instead of vcmpe

Based on the discussion in
http://lists.llvm.org/pipermail/llvm-dev/2019-October/135574.html, the
conclusion was reached that the ARM backend should produce vcmp instead
of vcmpe instructions by default, i.e. not be producing an Invalid
Operation exception when either arguments in a floating point compare
are quiet NaNs.

In the future, after constrained floating point intrinsics for floating
point compare have been introduced, vcmpe instructions probably should
be produced for those intrinsics - depending on the exact semantics
they'll be defined to have.

This patch logically consists of the following parts:
- Revert http://llvm.org/viewvc/llvm-project?rev=294945&view=rev and
  http://llvm.org/viewvc/llvm-project?rev=294968&view=rev, which
  implemented fine-tuning for when to produce vcmpe (i.e. not do it for
  equality comparisons). The complexity introduced by those patches
  isn't needed anymore if we just always produce vcmp instead. Maybe
  these patches need to be reintroduced again once support is needed to
  map potential LLVM-IR constrained floating point compare intrinsics to
  the ARM instruction set.
- Simply select vcmp, instead of vcmpe, see simple changes in
  lib/Target/ARM/ARMInstrVFP.td
- Adapt lots of tests that tested for vcmpe (instead of vcmp). For all
  of these test, the intent of what is tested for isn't related to
  whether the vcmp should produce an Invalid Operation exception or not.

Fixes PR43374.

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

llvm-svn: 374025

4 years ago[Tools] Mark output of tools as text if it is text
Kai Nacke [Tue, 8 Oct 2019 08:21:20 +0000 (08:21 +0000)]
[Tools] Mark output of tools as text if it is text

Several LLVM tools write text files/streams without using OF_Text.
This can cause problems on platforms which distinguish between
text and binary output. This PR adds the OF_Text flag for the
following tools:

- llvm-dis
- llvm-dwarfdump
- llvm-mca
- llvm-mc (assembler files only)
- opt (assembler files only)
- RemarkStreamer (used e.g. by opt)

Reviewers: rnk, vivekvpandya, Bigcheese, andreadb

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

llvm-svn: 374024

4 years agoUse /dev/null for tests that we do not need outputs
Rui Ueyama [Tue, 8 Oct 2019 08:03:44 +0000 (08:03 +0000)]
Use /dev/null for tests that we do not need outputs

llvm-svn: 374023

4 years agoReport error if -export-dynamic is used with -r
Rui Ueyama [Tue, 8 Oct 2019 08:03:40 +0000 (08:03 +0000)]
Report error if -export-dynamic is used with -r

The combination of the two flags doesn't make sense. And other linkers
seem to just ignore --export-dynamic if --relocatable is given, but
we probably should report it as an error to let users know that is
an invalid combination.

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

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

llvm-svn: 374022

4 years ago[LoopVectorize] Fix non-debug builds after rL374017
Kadir Cetinkaya [Tue, 8 Oct 2019 07:39:50 +0000 (07:39 +0000)]
[LoopVectorize] Fix non-debug builds after rL374017

llvm-svn: 374021

4 years ago[llvm-exegesis] Add stabilization test with config
Clement Courbet [Tue, 8 Oct 2019 07:08:48 +0000 (07:08 +0000)]
[llvm-exegesis] Add stabilization test with config

In preparation for D68629.

llvm-svn: 374020

4 years ago[IA] Recognize hexadecimal escape sequences
Bill Wendling [Tue, 8 Oct 2019 04:39:52 +0000 (04:39 +0000)]
[IA] Recognize hexadecimal escape sequences

Summary:
Implement support for hexadecimal escape sequences to match how GNU 'as'
handles them. I.e., read all hexadecimal characters and truncate to the
lower 16 bits.

Reviewers: nickdesaulniers, jcai19

Subscribers: llvm-commits, hiraditya

Tags: #llvm

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

llvm-svn: 374018

4 years ago[LoopVectorize][PowerPC] Estimate int and float register pressure separately in loop...
Zi Xuan Wu [Tue, 8 Oct 2019 03:28:33 +0000 (03:28 +0000)]
[LoopVectorize][PowerPC] Estimate int and float register pressure separately in loop-vectorize

In loop-vectorize, interleave count and vector factor depend on target register number. Currently, it does not
estimate different register pressure for different register class separately(especially for scalar type,
float type should not be on the same position with int type), so it's not accurate. Specifically,
it causes too many times interleaving/unrolling, result in too many register spills in loop body and hurting performance.

So we need classify the register classes in IR level, and importantly these are abstract register classes,
and are not the target register class of backend provided in td file. It's used to establish the mapping between
the types of IR values and the number of simultaneous live ranges to which we'd like to limit for some set of those types.

For example, POWER target, register num is special when VSX is enabled. When VSX is enabled, the number of int scalar register is 32(GPR),
float is 64(VSR), but for int and float vector register both are 64(VSR). So there should be 2 kinds of register class when vsx is enabled,
and 3 kinds of register class when VSX is NOT enabled.

It runs on POWER target, it makes big(+~30%) performance improvement in one specific bmk(503.bwaves_r) of spec2017 and no other obvious degressions.

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

llvm-svn: 374017

4 years ago[ConstantRange] [NFC] replace addWithNoSignedWrap with addWithNoWrap.
Chen Zheng [Tue, 8 Oct 2019 03:00:31 +0000 (03:00 +0000)]
[ConstantRange] [NFC] replace addWithNoSignedWrap with addWithNoWrap.

llvm-svn: 374016

4 years ago[WebAssembly] Add REQUIRES: asserts to cfg-stackify-eh.ll
Heejin Ahn [Tue, 8 Oct 2019 02:50:27 +0000 (02:50 +0000)]
[WebAssembly] Add REQUIRES: asserts to cfg-stackify-eh.ll

This was missing in D68552.

llvm-svn: 374015

4 years ago[ItaniumMangle] Fix mangling of GNU __null in an expression to match GCC
James Clarke [Tue, 8 Oct 2019 02:28:57 +0000 (02:28 +0000)]
[ItaniumMangle] Fix mangling of GNU __null in an expression to match GCC

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits

Tags: #clang

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

llvm-svn: 374013

4 years ago[NFC] Fix ubsan-blacklist test
Jan Korous [Tue, 8 Oct 2019 02:26:17 +0000 (02:26 +0000)]
[NFC] Fix ubsan-blacklist test

Restored original test and marked tests for VFS as unsupported on Windows.

llvm-svn: 374011

4 years ago[sanitizer] Fix signal_trap_handler.cpp on android
Vitaly Buka [Tue, 8 Oct 2019 02:00:53 +0000 (02:00 +0000)]
[sanitizer] Fix signal_trap_handler.cpp on android

llvm-svn: 374010

4 years ago[LitConfig] Silenced notes/warnings on quiet.
Andrew Trick [Tue, 8 Oct 2019 01:31:02 +0000 (01:31 +0000)]
[LitConfig] Silenced notes/warnings on quiet.

Lit has a "quiet" option, -q, which is documented to "suppress no
error output". Previously, LitConfig displayed notes and warnings when
the quiet option was specified. The result was that it was not
possible to get only pertinent file/line information to be used by an
editor to jump to the location where checks were failing without
passing a number of unhelpful locations first. Here, the
implementations of LitConfig.note and LitConfig.warning are modified
to account for the quiet flag and avoid displaying if the flag has
indeed been set.

Patch by Nate Chandler

Reviewed by yln

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

llvm-svn: 374009

4 years agoRevert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match...
Jonas Devlieghere [Tue, 8 Oct 2019 01:16:59 +0000 (01:16 +0000)]
Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested"

This breaks TestProcessAttach and TestHelloWorld on Darwin.

llvm-svn: 374008

4 years agotest fix: TestLoadUsingPaths should use realpath
Lawrence D'Anna [Tue, 8 Oct 2019 01:16:29 +0000 (01:16 +0000)]
test fix: TestLoadUsingPaths should use realpath

Summary:
TestLoadUsingPaths will fail if the build directory has
symlinks in its path, because the real paths reported by
the debugger won't match the symlink-laden paths it's expecting.

This can be solved just by using os.path.realpath on the base
path for the test.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374007

4 years agoReland 'Add VFS support for sanitizers' blacklist'
Jan Korous [Tue, 8 Oct 2019 01:13:17 +0000 (01:13 +0000)]
Reland 'Add VFS support for sanitizers' blacklist'

The original patch broke the test for Windows.
Trying to fix as per Reid's suggestions outlined here:
https://reviews.llvm.org/rC371663

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

llvm-svn: 374006

4 years agoFixing missing lldb-scripts rename from D68370
Antonio Afonso [Tue, 8 Oct 2019 01:10:03 +0000 (01:10 +0000)]
Fixing missing lldb-scripts rename from D68370

llvm-svn: 374005