platform/upstream/llvm.git
6 years ago[llvm-mca] Use a const ArrayRef in a few places. NFC
Andrea Di Biagio [Tue, 13 Mar 2018 13:58:02 +0000 (13:58 +0000)]
[llvm-mca] Use a const ArrayRef in a few places. NFC

llvm-svn: 327396

6 years ago[TTI] Fix a typo in the comment
Haicheng Wu [Tue, 13 Mar 2018 13:52:47 +0000 (13:52 +0000)]
[TTI] Fix a typo in the comment

llvm-svn: 327395

6 years ago[llvm-mca] Fix unused variable warning in opt mode.
Clement Courbet [Tue, 13 Mar 2018 13:44:18 +0000 (13:44 +0000)]
[llvm-mca] Fix unused variable warning in opt mode.

llvm-svn: 327394

6 years ago[Hexagon] Clang side of r327302 in LLVM
Krzysztof Parzyszek [Tue, 13 Mar 2018 13:30:43 +0000 (13:30 +0000)]
[Hexagon] Clang side of r327302 in LLVM

Add option -m[no-]packets to control generation of instruction packets
(enabled by default).

llvm-svn: 327393

6 years ago[WebAssembly] Demangle symbol names for use by the browser debugger
Nicholas Wilson [Tue, 13 Mar 2018 13:30:04 +0000 (13:30 +0000)]
[WebAssembly] Demangle symbol names for use by the browser debugger

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

llvm-svn: 327392

6 years ago[WebAssembly] Use helper macro from ELF/Options.td to tidy. NFC
Nicholas Wilson [Tue, 13 Mar 2018 13:16:15 +0000 (13:16 +0000)]
[WebAssembly] Use helper macro from ELF/Options.td to tidy. NFC

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

llvm-svn: 327391

6 years ago[WebAssembly] Add missing --demangle arg
Nicholas Wilson [Tue, 13 Mar 2018 13:12:03 +0000 (13:12 +0000)]
[WebAssembly] Add missing --demangle arg

Previously, Config->Demangle was uninitialised (not hooked up to
commandline handling)

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

llvm-svn: 327390

6 years ago[llvm-mca] Refactor event listeners to make the backend agnostic to event types.
Clement Courbet [Tue, 13 Mar 2018 13:11:01 +0000 (13:11 +0000)]
[llvm-mca] Refactor event listeners to make the backend agnostic to event types.

Summary: This is a first step towards making the pipeline configurable.

Subscribers: llvm-commits, andreadb

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

llvm-svn: 327389

6 years ago[mips] Don't create nested CALLSEQ_START..CALLSEQ_END nodes.
Simon Dardis [Tue, 13 Mar 2018 12:50:03 +0000 (12:50 +0000)]
[mips] Don't create nested CALLSEQ_START..CALLSEQ_END nodes.

For the MIPS O32 ABI, the current call lowering logic naively lowers each
call, creating the reserved argument area to hold the argument spill areas for
$a0..$a3 and the outgoing parameter area if one is required at each call site.

In the case of a sufficently large byval argument, a call to memcpy is used
to write the start+16..end of the argument into the outgoing parameter area.
This is done within the CALLSEQ_START..CALLSEQ_END of the callee. The CALLSEQ
nodes are responsible for performing the necessary stack adjustments.

Since the O32/N32/N64 MIPS ABIs do not have a red-zone and writing below the
stack pointer and reading the values back is unpredictable, the call to memcpy
cannot be hoisted out of the callee's CALLSEQ nodes.

However, for the O32 ABI requires the reserved argument area for functions
which have parameters. The naive lowering of calls will then create nested
CALLSEQ sequences. For N32 and N64 these nodes are also created, but with
zero stack adjustments as those ABIs do not have a reserved argument area.

This patch addresses the correctness issue by recognizing the special case
of lowering a byval argument that uses memcpy. By recognizing that the
incoming chain already has a CALLSEQ_START node on it when calling memcpy,
the CALLSEQ nodes are not created. For the N32 and N64 ABIs, this is not an
issue, as no stack adjustment has to be performed.

For the O32 ABI, the correctness reasoning is different. In the case of a
sufficently large byval argument, registers a0..a3 are going to be used for
the callee's arguments, mandating the creation of the reserved argument area.
The call to memcpy in the naive case will also create its own reserved
argument area. However, since the reserved argument area consists of undefined
values, both calls can use the same reserved argument area.

Reviewers: abeserminji, atanasyan

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

llvm-svn: 327388

6 years ago[clangd] Fix irrelevant declaratations in goto definition (on macros).
Haojian Wu [Tue, 13 Mar 2018 12:30:59 +0000 (12:30 +0000)]
[clangd] Fix irrelevant declaratations in goto definition (on macros).

Summary:
DeclrationAndMacrosFinder will find some declarations (not macro!) that are
referened inside the macro somehow, isSearchedLocation() is not sufficient, we
don't know whether the searched source location is macro or not.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 327387

6 years ago[clangd] Remove extra ";", NFC.
Haojian Wu [Tue, 13 Mar 2018 12:26:28 +0000 (12:26 +0000)]
[clangd] Remove extra ";", NFC.

llvm-svn: 327386

6 years ago[X86][SSE41] createVariablePermute v2X64 - PCMPEQQ can test for index 0/1 and select...
Simon Pilgrim [Tue, 13 Mar 2018 12:22:58 +0000 (12:22 +0000)]
[X86][SSE41] createVariablePermute v2X64 - PCMPEQQ can test for index 0/1 and select between them.

llvm-svn: 327385

6 years ago[dsymutil] Unbreak non-Darwin bots.
Jonas Devlieghere [Tue, 13 Mar 2018 11:32:19 +0000 (11:32 +0000)]
[dsymutil] Unbreak non-Darwin bots.

BinaryHolder -> BinHolder

llvm-svn: 327384

6 years agoclang-import-test: fix build with clang-3.8
Pavel Labath [Tue, 13 Mar 2018 11:28:27 +0000 (11:28 +0000)]
clang-import-test: fix build with clang-3.8

clang-3.8 complains that constructor for '...' must explicitly
initialize the const object. Newer clangs and gcc seem to be fine with
this, but explicitly initializing the variable does not hurt.

llvm-svn: 327383

6 years ago[dsymutil] Introduce LinkContext. NFC.
Jonas Devlieghere [Tue, 13 Mar 2018 10:52:49 +0000 (10:52 +0000)]
[dsymutil] Introduce LinkContext. NFC.

This patch introduces the LinkContext which is necessary to have
dsymutil perform analysis and cloning of DIEs in parallel. As requested
in D43945, I'm landing this as two separate commits.

llvm-svn: 327382

6 years ago[Evaluator] Evaluate load/store with bitcast
Eugene Leviant [Tue, 13 Mar 2018 10:19:50 +0000 (10:19 +0000)]
[Evaluator] Evaluate load/store with bitcast

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

llvm-svn: 327381

6 years agoFix clang-3.8 build
Pavel Labath [Tue, 13 Mar 2018 09:46:10 +0000 (09:46 +0000)]
Fix clang-3.8 build

clang-3.8 complains that constructor for '...' must explicitly
initialize the const member. Newer clangs and gcc seem to be fine with
this, but explicitly initializing the member does not hurt.

llvm-svn: 327380

6 years agoFix linux s390x build (pr36694)
Pavel Labath [Tue, 13 Mar 2018 09:46:00 +0000 (09:46 +0000)]
Fix linux s390x build (pr36694)

llvm-svn: 327379

6 years ago[ELF] - Implement INSERT BEFORE.
George Rimar [Tue, 13 Mar 2018 09:18:11 +0000 (09:18 +0000)]
[ELF] - Implement INSERT BEFORE.

This finishes PR35877.

INSERT BEFORE used similar to INSERT AFTER,
it inserts sections before the given target section.

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

llvm-svn: 327378

6 years ago[ELF] - Fix wrong "REQUIRES" in test.
George Rimar [Tue, 13 Mar 2018 08:50:36 +0000 (08:50 +0000)]
[ELF] - Fix wrong "REQUIRES" in test.

Its a follow up for r327374 to fix BB.

llvm-svn: 327377

6 years ago[ELF] - Restrict section offsets that exceeds file size.
George Rimar [Tue, 13 Mar 2018 08:47:17 +0000 (08:47 +0000)]
[ELF] - Restrict section offsets that exceeds file size.

This is part of PR36515.

With some linkerscripts it is possible to get file offset overlaps
and overflows. Currently LLD checks overlaps in checkNoOverlappingSections().
And also we allow broken output with --no-inhibit-exec.
Problem is that sometimes final offset of sections is completely broken
and we calculate output file size wrong and might crash.

Patch implements check to verify that there is no output section
which offset exceeds file size.

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

llvm-svn: 327376

6 years ago[CodeGenPrepare] Respect endianness in splitMergedValStore.
Jonas Paulsson [Tue, 13 Mar 2018 08:36:20 +0000 (08:36 +0000)]
[CodeGenPrepare]  Respect endianness in splitMergedValStore.

splitMergedValStore will split a store into two if target prefers this, or if
-force-split-store is passed.

This patch adds the missing handling for endianness in this function along
with a test case.

Review: Eli Friedman
https://reviews.llvm.org/D44396

llvm-svn: 327375

6 years ago[ELF] - Drop special flags for empty output sections.
George Rimar [Tue, 13 Mar 2018 08:32:56 +0000 (08:32 +0000)]
[ELF] - Drop special flags for empty output sections.

This fixes PR36598.

LLD currently crashes when we have empty output section
with SHF_LINK_ORDER flag. This might happen if we place an
empty synthetic section in the linker script, but keep output
section alive with the use of additional symbol, for example.

The patch fixes the issue by dropping all special flags
for empty sections.

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

llvm-svn: 327374

6 years ago[SCEV][NFC] Smarter implementation of isAvailableAtLoopEntry
Max Kazantsev [Tue, 13 Mar 2018 07:46:06 +0000 (07:46 +0000)]
[SCEV][NFC] Smarter implementation of isAvailableAtLoopEntry

isAvailableAtLoopEntry duplicates logic of `properlyDominates` after checking invariance.
This patch replaces this logic with invocation of this method which is more profitable
because it supports caching.

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

llvm-svn: 327373

6 years ago[MergeICmps] Make sure that the comparison only has one use.
Clement Courbet [Tue, 13 Mar 2018 07:05:55 +0000 (07:05 +0000)]
[MergeICmps] Make sure that the comparison only has one use.

Summary: Fixes PR36557.

Reviewers: trentxintong, spatel

Subscribers: mstorsjo, llvm-commits

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

llvm-svn: 327372

6 years agobpf: Enhance debug information for peephole optimization passes
Yonghong Song [Tue, 13 Mar 2018 06:47:07 +0000 (06:47 +0000)]
bpf: Enhance debug information for peephole optimization passes

Add more debug information for peephole optimization passes.

These would only be enabled for debug version binary and could help
analyzing why some optimization opportunities were missed.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327371

6 years agobpf: New post-RA peephole optimization pass to eliminate bad RA codegen
Yonghong Song [Tue, 13 Mar 2018 06:47:06 +0000 (06:47 +0000)]
bpf: New post-RA peephole optimization pass to eliminate bad RA codegen

This new pass eliminate identical move:

  MOV rA, rA

This is particularly possible to happen when sub-register support
enabled. The special type cast insn MOV_32_64 involves different
register class on src (i32) and dst (i64), RA could generate useless
instruction due to this.

This pass also could serve as the bast for further post-RA optimization.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327370

6 years agobpf: Don't expand BSWAP on i32, promote it
Yonghong Song [Tue, 13 Mar 2018 06:47:05 +0000 (06:47 +0000)]
bpf: Don't expand BSWAP on i32, promote it

Currently, there is no ALU32 bswap support in eBPF ISA.

BSWAP on i32 was set to EXPAND which would need about eight instructions
for single BSWAP.

It would be more efficient to promote it to i64, then doing BSWAP on i64.
For eBPF programs, most of the promotion are zero extensions which are
likely be elimiated later by peephole optimizations.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327369

6 years agobpf: Support subregister definition check on PHI node
Yonghong Song [Tue, 13 Mar 2018 06:47:04 +0000 (06:47 +0000)]
bpf: Support subregister definition check on PHI node

This patch relax the subregister definition check on Phi node.
Previously, we just cancel the optimizatoin when the definition is Phi
node while actually we could further check the definitions of incoming
parameters of PHI node.

This helps catch more elimination opportunities.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327368

6 years agobpf: Extends zero extension elimination beyond comparison instructions
Yonghong Song [Tue, 13 Mar 2018 06:47:03 +0000 (06:47 +0000)]
bpf: Extends zero extension elimination beyond comparison instructions

The current zero extension elimination was restricted to operands of
comparison. It actually could be extended to more cases.

For example:

  int *inc_p (int *p, unsigned a)
  {
    return p + a;
  }

'a' will be promoted to i64 during addition, and the zero extension could
be eliminated as well.

For the elimination optimization, it should be much better to start
recognizing the candidate sequence from the SRL instruction instead of J*
instructions.

This patch makes it an generic zero extension elimination pass instead of
one restricted with comparison.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327367

6 years agobpf: J*_RR should check both operands
Yonghong Song [Tue, 13 Mar 2018 06:47:02 +0000 (06:47 +0000)]
bpf: J*_RR should check both operands

There is a mistake in current code that we "break" out the optimization
when the first operand of J*_RR doesn't qualify the elimination. This
caused some elimination opportunities missed, for example the one in the
testcase.

The code should just fall through to handle the second operand.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327366

6 years agobpf: Tighten subregister definition check
Yonghong Song [Tue, 13 Mar 2018 06:47:00 +0000 (06:47 +0000)]
bpf: Tighten subregister definition check

The current subregister definition check stops after the MOV_32_64
instruction.

This means we are thinking all the following instruction sequences
are safe to be eliminated:

  MOV_32_64 rB, wA
  SLL_ri    rB, rB, 32
  SRL_ri    rB, rB, 32

However, this is *not* true. The source subregister wA of MOV_32_64 could
come from a implicit truncation of 64-bit register in which case the high
bits of the 64-bit register is not zeroed, therefore we can't eliminate
above sequence.

For example, for i32_val, we shouldn't do the elimination:

  long long bar ();

  int foo (int b, int c)
  {
    unsigned int i32_val = (unsigned int) bar();

    if (i32_val < 10)
      return b;
    else
      return c;
  }

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327365

6 years agobpf: Add more check directives in peephole testcase
Yonghong Song [Tue, 13 Mar 2018 06:46:59 +0000 (06:46 +0000)]
bpf: Add more check directives in peephole testcase

Improve the test accuracy by adding more check directives.

Shifts are expected to be eliminated for zero extension but not for signed
extension.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327364

6 years agoRevert [SCEV] Fix isKnownPredicate
Serguei Katkov [Tue, 13 Mar 2018 06:36:00 +0000 (06:36 +0000)]
Revert [SCEV] Fix isKnownPredicate

It is a revert of rL327362 which causes build bot failures with assert like

Assertion `isAvailableAtLoopEntry(RHS, L) && "RHS is not available at Loop Entry"' failed.

llvm-svn: 327363

6 years ago[SCEV] Fix isKnownPredicate
Serguei Katkov [Tue, 13 Mar 2018 06:10:27 +0000 (06:10 +0000)]
[SCEV] Fix isKnownPredicate

IsKnownPredicate is updated to implement the following algorithm
proposed by @sanjoy and @mkazantsev :
isKnownPredicate(Pred, LHS, RHS) {
  Collect set S all loops on which either LHS or RHS depend.
  If S is non-empty
    a. Let PD be the element of S which is dominated by all other elements of S
    b. Let E(LHS) be value of LHS on entry of PD.
       To get E(LHS), we should just take LHS and replace all AddRecs that
       are attached to PD on with their entry values.
       Define E(RHS) in the same way.
    c. Let B(LHS) be value of L on backedge of PD.
       To get B(LHS), we should just take LHS and replace all AddRecs that
       are attached to PD on with their backedge values.
       Define B(RHS) in the same way.
    d. Note that E(LHS) and E(RHS) are automatically available on entry of PD,
       so we can assert on that.
    e. Return true if isLoopEntryGuardedByCond(Pred, E(LHS), E(RHS)) &&
                      isLoopBackedgeGuardedByCond(Pred, B(LHS), B(RHS))
Return true if Pred, L, R is known from ranges, splitting etc.
}
This is follow-up for https://reviews.llvm.org/D42417.

Reviewers: sanjoy, mkazantsev, reames
Reviewed By: sanjoy, mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D43507

llvm-svn: 327362

6 years ago[polly] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Tue, 13 Mar 2018 05:25:23 +0000 (05:25 +0000)]
[polly] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Reviewers: grosser, efriedma, jdoerfert, bollu, sebpop

Reviewed By: sebpop

Subscribers: sebpop, mehdi_amini, llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 327361

6 years agoReland r327041: [ThinLTO] Keep available_externally symbols live
Vlad Tsyrklevich [Tue, 13 Mar 2018 05:08:48 +0000 (05:08 +0000)]
Reland r327041: [ThinLTO] Keep available_externally symbols live

Summary:
This change fixes PR36483. The bug was originally introduced by a change
that marked non-prevailing symbols dead. This broke LowerTypeTests
handling of available_externally functions, which are non-prevailing.
LowerTypeTests uses liveness information to avoid emitting thunks for
unused functions.

Marking available_externally functions dead is incorrect, the functions
are used though the function definitions are not. This change keeps them
live, and lets the EliminateAvailableExternally/GlobalDCE passes remove
them later instead.

(Reland with a suspected fix for a unit test failure I haven't been able
to reproduce locally)

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: grimar, mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 327360

6 years ago[LTO] Return proper error object rather than null LTOModule
Adam Nemet [Tue, 13 Mar 2018 04:37:01 +0000 (04:37 +0000)]
[LTO] Return proper error object rather than null LTOModule

This caused a crash in LTOModule::createInLocalContext.

rdar://37926841

llvm-svn: 327359

6 years ago[ThinLTO] Add funtions in callees metadata to CallGraphEdges
Taewook Oh [Tue, 13 Mar 2018 04:26:58 +0000 (04:26 +0000)]
[ThinLTO] Add funtions in callees metadata to CallGraphEdges

Summary:
If there's a callees metadata attached to the indirect call instruction, add CallGraphEdges to the callees mentioned in the metadata when computing FunctionSummary.

* Why this is necessary:
Consider following code example:
```
(foo.c)
static int f1(int x) {...}
static int f2(int x);
static int (*fptr)(int) = f2;
static int f2(int x) {
  if (x) fptr=f1; return f1(x);
}
int foo(int x) {
  (*fptr)(x); // !callees metadata of !{i32 (i32)* @f1, i32 (i32)* @f2} would be attached to this call.
}

(bar.c)
int bar(int x) {
  return foo(x);
}
```

At LTO time when `foo.o` is imported into `bar.o`, function `foo` might be inlined into `bar` and PGO-guided indirect call promotion will run after that. If the profile data tells that the promotion of `@f1` or `@f2` is beneficial, the optimizer will check if the "promoted" `@f1` or `@f2` (such as `@f1.llvm.0` or `@f2.llvm.0`) is available. Without this patch, importing `!callees` metadata would only add promoted declarations of `@f1` and `@f2` to the `bar.o`, but still the optimizer will assume that the function is available and perform the promotion. The result of that is link failure with `undefined reference to @f1.llvm.0`.

This patch fixes this problem by adding callees in the `!callees` metadata to CallGraphEdges so that their definition would be properly imported into.

One may ask that there already is a logic to add indirect call promotion targets to be added to CallGraphEdges. However, if profile data says "indirect call promotion is only beneficial under a certain inline context", the logic wouldn't work. In the code example above, if profile data is like
```
bar:1000000:100000
  1:100000
    1: foo:100000
        1: 100000 f1:100000
```
, Computing FunctionSummary for `foo.o` wouldn't add `foo->f1` to CallGraphEdges. (Also, it is at least "possible" that one can provide profile data to only link step but not to compilation step).

Reviewers: tejohnson, mehdi_amini, pcc

Reviewed By: tejohnson

Subscribers: inglorion, eraman, llvm-commits

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

llvm-svn: 327358

6 years agoUse PLT relocations in test.
Rafael Espindola [Tue, 13 Mar 2018 01:41:49 +0000 (01:41 +0000)]
Use PLT relocations in test.

Currently lld creates plain plt entries when a R_386_PC32 resolves to
a symbol in a shared library. That is a bug (PR36678). Don't depend on
that behavior on this test.

llvm-svn: 327357

6 years ago[ExpressionParser] Fix crash when evaluating invalid expresssions.
Davide Italiano [Tue, 13 Mar 2018 01:40:00 +0000 (01:40 +0000)]
[ExpressionParser] Fix crash when evaluating invalid expresssions.

Typical example, illformed comparisons (operator== where LHS and
RHS are not compatible). If a symbol matched `operator==` in any
of the object files lldb inserted a generic function declaration
in the ASTContext on which Sema operates. Maintaining the AST
context invariants is fairly tricky and sometimes resulted in
crashes inside clang (or assertions hit).

The real reason why this feature exists in the first place is
that of allowing users to do something like:
(lldb) call printf("patatino")

even if the debug informations for printf() is not available.
Eventually, we might reconsider this feature in its
entirety, but for now we can't remove it as it would break
a bunch of users. Instead, try to limit it to non-C++ symbols,
where getting the invariants right is hopefully easier.

Now you can't do in lldb anymore
(lldb) call _Zsomethingsomething(1,2,3)

but that doesn't seem to be such a big loss.

<rdar://problem/35645893>

llvm-svn: 327356

6 years ago[LegalizeTypes] In SplitVecOp_TruncateHelper, use GetSplitVector on the input instead...
Craig Topper [Tue, 13 Mar 2018 01:17:40 +0000 (01:17 +0000)]
[LegalizeTypes] In SplitVecOp_TruncateHelper, use GetSplitVector on the input instead of creating new extract_subvectors.

llvm-svn: 327355

6 years agoAdd missing "env" so that test added in r327322 passes on Windows bots.
Douglas Yung [Tue, 13 Mar 2018 00:41:44 +0000 (00:41 +0000)]
Add missing "env" so that test added in r327322 passes on Windows bots.

llvm-svn: 327354

6 years ago[lld] Fix comdat tests
Alexander Shaposhnikov [Tue, 13 Mar 2018 00:07:53 +0000 (00:07 +0000)]
[lld] Fix comdat tests

This diff adjusts the comdat tests after changing the format
of llvm-readobj output for .group sections.

llvm-svn: 327353

6 years ago[CFG] [analyzer] Don't add construction context to a return-by-reference call.
Artem Dergachev [Mon, 12 Mar 2018 23:52:36 +0000 (23:52 +0000)]
[CFG] [analyzer] Don't add construction context to a return-by-reference call.

Call expressions that return objects by an lvalue reference or an rvalue
reference have a value type in the AST but wear an auxiliary flag of being an
lvalue or an xvalue respectively.

Use the helper method for obtaining the actual return type of the function.

Fixes a crash.

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

llvm-svn: 327352

6 years agoObjCARC: address review comments from majnemer
Saleem Abdulrasool [Mon, 12 Mar 2018 23:48:20 +0000 (23:48 +0000)]
ObjCARC: address review comments from majnemer

I forgot to incorporate these comments into the original revision.  This
is just code cleanup addressing the feedback, NFC.

llvm-svn: 327351

6 years ago[lit] `llvm-mc` is now a dependency to run tests.
Davide Italiano [Mon, 12 Mar 2018 23:42:37 +0000 (23:42 +0000)]
[lit] `llvm-mc` is now a dependency to run tests.

llvm-svn: 327350

6 years ago[llvm] Fix mc tests
Alexander Shaposhnikov [Mon, 12 Mar 2018 23:36:25 +0000 (23:36 +0000)]
[llvm] Fix mc tests

This diff adjusts the mc tests after changing the format
of llvm-readobj output for .group sections.

llvm-svn: 327349

6 years ago[analyzer] Support temporaries conjured by conservatively evaluated functions.
Artem Dergachev [Mon, 12 Mar 2018 23:36:12 +0000 (23:36 +0000)]
[analyzer] Support temporaries conjured by conservatively evaluated functions.

Properly perform destruction and lifetime extension of such temporaries.

C++ object-type return values of conservatively evaluated functions are now
represented as compound values of well-defined temporary object regions. The
function creates a region that represents the temporary object and will later
be used for destruction or materialization, invalidates it, and returns the
invalidated compound value of the object.

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

llvm-svn: 327348

6 years ago[analyzer] NFC: Move the code for setting temp object lifetime into method.
Artem Dergachev [Mon, 12 Mar 2018 23:27:52 +0000 (23:27 +0000)]
[analyzer] NFC: Move the code for setting temp object lifetime into method.

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

llvm-svn: 327347

6 years agoRevert "Reland "[clang-doc] Setup clang-doc frontend framework""
Julie Hockett [Mon, 12 Mar 2018 23:23:24 +0000 (23:23 +0000)]
Revert "Reland "[clang-doc] Setup clang-doc frontend framework""

This reverts commit r327295 since it was causing the Windows bots to
fail.

llvm-svn: 327346

6 years ago[analyzer] Destroy and lifetime-extend inlined function return values properly.
Artem Dergachev [Mon, 12 Mar 2018 23:22:35 +0000 (23:22 +0000)]
[analyzer] Destroy and lifetime-extend inlined function return values properly.

This patch uses the newly added CFGCXXRecordTypedCall element at the call site
of the caller to construct the return value within the callee directly into the
caller's stack frame. This way it is also capable of populating the temporary
destructor and lifetime extension maps for the temporary, which allows
temporary destructors and lifetime extension to work correctly.

This patch does not affect temporaries that were returned from conservatively
evaluated functions.

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

llvm-svn: 327345

6 years ago[clangd] Remove Tagged and some related APIs from ClangdServer.
Sam McCall [Mon, 12 Mar 2018 23:22:35 +0000 (23:22 +0000)]
[clangd] Remove Tagged and some related APIs from ClangdServer.

Context can do what Tagged was intended to support (snapshot filesystems),
and less intrusively.
getTaggedFileSystem() no longer needs a filename.

Cleanups while here:
 - code-complete now returns errors as Expected, like other functions
 - added an alias Callback<T> for the usual callback function type

llvm-svn: 327344

6 years ago[CFG] [analyzer] Add construction context to C++ return-by-value call elements.
Artem Dergachev [Mon, 12 Mar 2018 23:12:40 +0000 (23:12 +0000)]
[CFG] [analyzer] Add construction context to C++ return-by-value call elements.

This patch adds a new CFGStmt sub-class, CFGCXXRecordTypedCall, which replaces
the regular CFGStmt for the respective CallExpr whenever the CFG has additional
information to provide regarding the lifetime of the returned value.

This additional call site information is represented by a ConstructionContext
(which was previously used for CFGConstructor elements) that provides references
to CXXBindTemporaryExpr and MaterializeTemporaryExpr that surround the call.

This corresponds to the common C++ calling convention solution of providing
the target address for constructing the return value as an auxiliary implicit
argument during function call.

One of the use cases for such extra context at the call site would be to perform
any sort of inter-procedural analysis over the CFG that involves functions
returning objects by value. In this case the elidable constructor at the return
site would construct the object explained by the context at the call site, and
its lifetime would also be managed by the caller, not the callee.

The extra context would also be useful for properly handling the return-value
temporary at the call site, even if the callee is not being analyzed
inter-procedurally.

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

llvm-svn: 327343

6 years ago[InstCombine] add test to show fmul transform creates extra fdiv; NFC
Sanjay Patel [Mon, 12 Mar 2018 23:10:08 +0000 (23:10 +0000)]
[InstCombine] add test to show fmul transform creates extra fdiv; NFC

Also, move fmul reassociation tests to the same file as other fmul transforms.

llvm-svn: 327342

6 years ago[llvm-readobj] Extend the output of -elf-section-groups
Alexander Shaposhnikov [Mon, 12 Mar 2018 22:40:09 +0000 (22:40 +0000)]
[llvm-readobj] Extend the output of -elf-section-groups

This diff extends the output of -elf-section-groups
(llvm style, gnu style is unchanged since it's meant to be
compatible with binutils readelf) with sh_link and sh_info.
This change will enable us to use llvm-readobj -elf-section-groups
for testing llvm-objcopy's support for .group sections.

Test plan: make check-all

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

llvm-svn: 327341

6 years agoBlockExtractor: Don’t delete functions directly
Volkan Keles [Mon, 12 Mar 2018 22:28:18 +0000 (22:28 +0000)]
BlockExtractor: Don’t delete functions directly

Blocks may have function calls, so don’t erase functions
directly to avoid erasing a function that has a user.

llvm-svn: 327340

6 years ago[PatternMatch] enhance m_NaN() to ignore undef elements in vectors
Sanjay Patel [Mon, 12 Mar 2018 22:18:47 +0000 (22:18 +0000)]
[PatternMatch] enhance m_NaN() to ignore undef elements in vectors

llvm-svn: 327339

6 years ago[Sanitizers] Add more standard compliant posix_memalign implementation for LSan.
Alex Shlyapnikov [Mon, 12 Mar 2018 21:59:06 +0000 (21:59 +0000)]
[Sanitizers] Add more standard compliant posix_memalign implementation for LSan.

Summary:
Add more standard compliant posix_memalign implementation for LSan and
use corresponding sanitizer's posix_memalign implenetations in allocation
wrappers on Mac.

Reviewers: eugenis, fjricci

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 327338

6 years ago[asan] poison_heap=0 should not disable __asan_handle_no_return.
Evgeniy Stepanov [Mon, 12 Mar 2018 21:46:55 +0000 (21:46 +0000)]
[asan] poison_heap=0 should not disable __asan_handle_no_return.

Reviewers: kcc, alekseyshl, vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 327337

6 years agoObjCARC: teach the cloner about funclets
Saleem Abdulrasool [Mon, 12 Mar 2018 21:46:09 +0000 (21:46 +0000)]
ObjCARC: teach the cloner about funclets

In the case that the CallInst that is being moved has an associated
operand bundle which is a funclet, the move will construct an invalid
instruction.  The new site will have a different token and needs to be
reassociated with the new instruction.

Unfortunately, there is no way to alter the bundle after the
construction of the instruction.  Replace the call instruction cloning
with a custom helper to clone the instruction and reassociate the
funclet token.

llvm-svn: 327336

6 years ago[InstSimplify] add fcmp tests for constant NaN vector with undef elt; NFC
Sanjay Patel [Mon, 12 Mar 2018 21:44:17 +0000 (21:44 +0000)]
[InstSimplify] add fcmp tests for constant NaN vector with undef elt; NFC

llvm-svn: 327335

6 years agoRe-land "[Sema] Make getCurFunction() return null outside function parsing"
Reid Kleckner [Mon, 12 Mar 2018 21:43:02 +0000 (21:43 +0000)]
Re-land "[Sema] Make getCurFunction() return null outside function parsing"

This relands r326965.

There was a null dereference in typo correction that was triggered in
Sema/diagnose_if.c. We are not always in a function scope when doing
typo correction. The fix is to add a null check.

LLVM's optimizer made it hard to find this bug. I wrote it up in a
not-very-well-editted blog post here:
http://qinsb.blogspot.com/2018/03/ub-will-delete-your-null-checks.html

llvm-svn: 327334

6 years ago[docs] Adding clang-doc to CTE toctree to fix docs build error
Julie Hockett [Mon, 12 Mar 2018 21:39:01 +0000 (21:39 +0000)]
[docs] Adding clang-doc to CTE toctree to fix docs build error

llvm-svn: 327333

6 years ago[X86][Btver2] Clean up formatting/comments in scheduler model. NFCI.
Simon Pilgrim [Mon, 12 Mar 2018 21:35:12 +0000 (21:35 +0000)]
[X86][Btver2] Clean up formatting/comments in scheduler model. NFCI.

Moved 'special cases' to be closer to other system classes.

llvm-svn: 327332

6 years agoRe-add change for https://reviews.llvm.org/D42582 with added directories.
Jim Ingham [Mon, 12 Mar 2018 21:17:04 +0000 (21:17 +0000)]
Re-add change for https://reviews.llvm.org/D42582 with added directories.

llvm-svn: 327331

6 years agoIntroduce a setting to disable Spotlight while running the test suite
Adrian Prantl [Mon, 12 Mar 2018 20:52:36 +0000 (20:52 +0000)]
Introduce a setting to disable Spotlight while running the test suite

This is a more principled approach to disabling Spotlight .dSYM
lookups while running the testsuite, most importantly it also works
for the LIT-based tests, which I overlooked in my initial fix
(renaming the test build dir to lldb-tests.noindex).

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

llvm-svn: 327330

6 years agoRemove the LoopInstSimplify pass (-loop-instsimplify)
Vedant Kumar [Mon, 12 Mar 2018 20:49:42 +0000 (20:49 +0000)]
Remove the LoopInstSimplify pass (-loop-instsimplify)

LoopInstSimplify is unused and untested. Reading through the commit
history the pass also seems to have a high maintenance burden.

It would be best to retire the pass for now. It should be easy to
recover if we need something similar in the future.

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

llvm-svn: 327329

6 years agoImprove caching scheme in ProvenanceAnalysis.
Michael Zolotukhin [Mon, 12 Mar 2018 20:36:25 +0000 (20:36 +0000)]
Improve caching scheme in ProvenanceAnalysis.

Summary:
ProvenanceAnalysis::related(A, B) currently memoizes its results, and on big
tests the cache grows too large, and we're spending most of the time
growing/looking through DenseMap.

This patch reduces the size of the cache by normalizing keys first: we do that
by calling GetUnderlyingObjCPtr on the input values. The results of
GetUnderlyingObjCPtr are also memoized in a separate cache.

The patch doesn't bring noticable changes to compile time on CTMark, however
significantly helps one of our internal tests.

Reviewers: gottesmm

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 327328

6 years agoRevert "Improve prologue handling to support functions with multiple entry points."
Vedant Kumar [Mon, 12 Mar 2018 20:35:33 +0000 (20:35 +0000)]
Revert "Improve prologue handling to support functions with multiple entry points."

This reverts commit r327318. It breaks the Xcode and CMake Darwin
builders:

clang: error: no such file or directory:
'.../source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp'
clang: error: no input files

More details are in https://reviews.llvm.org/D42582.

llvm-svn: 327327

6 years ago[WebAssembly] Refactor to avoid conflating global and fucntion index space. NFC
Sam Clegg [Mon, 12 Mar 2018 19:56:23 +0000 (19:56 +0000)]
[WebAssembly] Refactor to avoid conflating global and fucntion index space. NFC

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

llvm-svn: 327326

6 years ago[WebAssembly] Verify contents of relocation target before writing it
Sam Clegg [Mon, 12 Mar 2018 19:54:26 +0000 (19:54 +0000)]
[WebAssembly] Verify contents of relocation target before writing it

Verify that the location where a relocation is about the be
applied contains the expected existing value.

This is essentially a sanity check to catch bugs in the compiler
and the linker.

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

llvm-svn: 327325

6 years agonan: Implement
Jan Vesely [Mon, 12 Mar 2018 19:46:52 +0000 (19:46 +0000)]
nan: Implement

Passes CTS on carrizo and turks

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327324

6 years agotravis: Add build using llvm-6
Jan Vesely [Mon, 12 Mar 2018 19:46:48 +0000 (19:46 +0000)]
travis: Add build using llvm-6

Acked-by: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327323

6 years ago[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing
Alex Lorenz [Mon, 12 Mar 2018 19:36:29 +0000 (19:36 +0000)]
[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing

This ensures that diagnostics are not remapped to incorrect preamble locations after
the second reparse with a remapped header file occurs.

rdar://37502480

llvm-svn: 327322

6 years ago[scudo] Secondary allocator overhaul to support Windows
Kostya Kortchinsky [Mon, 12 Mar 2018 19:29:38 +0000 (19:29 +0000)]
[scudo] Secondary allocator overhaul to support Windows

Summary:
The need for this change stems from the fact that Windows doesn't support
partial unmapping (`MEM_RELEASE` implies the entire allocated region). So we
now have to keep track of the reserved region and the committed region, so that
we can function without the trimming we did when dealing with larger alignments.

Instead of just having a `ReservedAddressRange` per chunk, we introduce a
`LargeChunkHeader` (and `LargeChunk` namespace) that additionally holds the
committed size and the usable size. The former is needed for stats purposes,
the latter is used by the frontend. Requiring both is debatable, we could only
work with the usable size but then be off by up to a page per chunk when
dealing with stats.

Additionally, we introduce more stats since they turned out to be useful for
experiments, and a `PrintStats` function that will be used by the combined
allocator in later patch.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 327321

6 years ago[llvm-readobj][ELF] Move ELF note parsing into libObject
Scott Linder [Mon, 12 Mar 2018 19:28:50 +0000 (19:28 +0000)]
[llvm-readobj][ELF] Move ELF note parsing into libObject

Clean up the parsing of notes in llvm-readobj, improve bounds checking, and
allow the parsing code to be reused.

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

llvm-svn: 327320

6 years ago[PowerPC][NFC] Explicitly state types on FP SDAG patterns in anticipation of adding...
Lei Huang [Mon, 12 Mar 2018 19:26:18 +0000 (19:26 +0000)]
[PowerPC][NFC] Explicitly state types on FP SDAG patterns in anticipation of adding the f128 type

llvm-svn: 327319

6 years agoImprove prologue handling to support functions with multiple entry points.
Jim Ingham [Mon, 12 Mar 2018 19:21:59 +0000 (19:21 +0000)]
Improve prologue handling to support functions with multiple entry points.

https://reviews.llvm.org/D42582

Patch from Leandro Lupori.

llvm-svn: 327318

6 years agoCheck that ubsan is the only supported sanitizer on OpenBSD
Vedant Kumar [Mon, 12 Mar 2018 19:18:51 +0000 (19:18 +0000)]
Check that ubsan is the only supported sanitizer on OpenBSD

Patch by David Carlier!

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

llvm-svn: 327317

6 years ago[AArch64] Fold adds with tprel_lo12_nc and secrel_lo12 into a following ldr/str
Martin Storsjo [Mon, 12 Mar 2018 18:47:43 +0000 (18:47 +0000)]
[AArch64] Fold adds with tprel_lo12_nc and secrel_lo12 into a following ldr/str

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

llvm-svn: 327316

6 years ago[InstCombine] Replace calls to getNumUses with hasNUses or hasNUsesOrMore
Craig Topper [Mon, 12 Mar 2018 18:46:05 +0000 (18:46 +0000)]
[InstCombine] Replace calls to getNumUses with hasNUses or hasNUsesOrMore

getNumUses is a linear time operation. It traverses the user linked list to the end and counts as it goes. Since we are only interested in small constant counts, we should use hasNUses or hasNUsesMore more that terminate the traversal as soon as it can provide the answer.

There are still two other locations in InstCombine, but changing those would force a rebase of D44266 which if accepted would remove them.

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

llvm-svn: 327315

6 years ago[CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero...
Craig Topper [Mon, 12 Mar 2018 18:40:59 +0000 (18:40 +0000)]
[CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero return from getNumUses

getNumUses is a linear operation. It walks a linked list to get a count. So in this case its better to just ask if there are any users rather than how many.

llvm-svn: 327314

6 years ago[Driver] Add text description of --help-hidden so it is shown in help
Jan Korous [Mon, 12 Mar 2018 18:33:55 +0000 (18:33 +0000)]
[Driver] Add text description of --help-hidden so it is shown in help

llvm-svn: 327313

6 years ago[NFC] Replace iterators in PrintHelp with range-based for
Jan Korous [Mon, 12 Mar 2018 18:31:07 +0000 (18:31 +0000)]
[NFC] Replace iterators in PrintHelp with range-based for

llvm-svn: 327312

6 years ago[NFC] PrintHelp cleanup
Jan Korous [Mon, 12 Mar 2018 18:30:47 +0000 (18:30 +0000)]
[NFC] PrintHelp cleanup

llvm-svn: 327311

6 years ago[Hexagon] Fix typo in testcase
Krzysztof Parzyszek [Mon, 12 Mar 2018 18:29:47 +0000 (18:29 +0000)]
[Hexagon] Fix typo in testcase

llvm-svn: 327310

6 years ago[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance
George Karpenkov [Mon, 12 Mar 2018 18:27:36 +0000 (18:27 +0000)]
[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance

rdar://38383753

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

llvm-svn: 327309

6 years ago[Hexagon] Counting leading/trailing bits is cheap
Krzysztof Parzyszek [Mon, 12 Mar 2018 18:18:23 +0000 (18:18 +0000)]
[Hexagon] Counting leading/trailing bits is cheap

llvm-svn: 327308

6 years ago[PatternMatch, InstSimplify] allow undef elements when matching vector -0.0
Sanjay Patel [Mon, 12 Mar 2018 18:17:01 +0000 (18:17 +0000)]
[PatternMatch, InstSimplify] allow undef elements when matching vector -0.0

This is the FP equivalent of D42818. Use it for the few cases in InstSimplify
with -0.0 folds (that's the only current use of m_NegZero()).

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

llvm-svn: 327307

6 years ago[X86][Btver2] FSqrt/FDiv reg-reg instructions don't use the AGU.
Simon Pilgrim [Mon, 12 Mar 2018 18:12:46 +0000 (18:12 +0000)]
[X86][Btver2] FSqrt/FDiv reg-reg instructions don't use the AGU.

I love you llvm-mca.

llvm-svn: 327306

6 years agoupdate_mir_test_checks: Fix handling of IR input after r326284
Justin Bogner [Mon, 12 Mar 2018 18:06:58 +0000 (18:06 +0000)]
update_mir_test_checks: Fix handling of IR input after r326284

llvm-svn: 327305

6 years ago[libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp.
Mike Edwards [Mon, 12 Mar 2018 18:06:37 +0000 (18:06 +0000)]
[libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp.

After two failed attempts last week to make this work I am
going back to a known good method of making this test pass on
macOS...adding the current apple-clang version to the
UNSUPPORTED list.

During a previous patch review (https://reviews.llvm.org/D44103)
it was suggested to just XFAIL libcpp-no-deduction-guides
as was done to iter_alloc_deduction.pass.cpp. However
this caused a an unexpected pass on:
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std/builds/214

I then attempted to just mark libcpp-no-deduction-guides
as UNSUPPORTED, however this caused an additional bot
failure.  So I reverted everything (https://reviews.llvm.org/rCXX327191).

To solve this and get work unblocked I am adding
apple-clang-9 to the original UNSUPPORTED list.

llvm-svn: 327304

6 years ago[SelectionDAG] Improve handling of dangling debug info
Bjorn Pettersson [Mon, 12 Mar 2018 18:02:39 +0000 (18:02 +0000)]
[SelectionDAG] Improve handling of dangling debug info

Summary:
1) Make sure to discard dangling debug info if the variable (or
variable fragment) is mapped to something new before we had a
chance to resolve the dangling debug info.

2) When resolving debug info, make sure to bump the associated
SDNodeOrder to ensure that the DBG_VALUE is emitted after the
instruction that defines the value used in the DBG_VALUE.
This will avoid a debug-use before def scenario as seen in
https://bugs.llvm.org/show_bug.cgi?id=36417.

The new test case, test/DebugInfo/X86/sdag-dangling-dbgvalue.ll,
show some other limitations in how dangling debug info is
handled in the SelectionDAG. Since we currently only support
having one dangling dbg.value per Value, we will end up dropping
debug info when there are more than one variable that is described
by the same "dangling value".

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: aprantl, eraman, llvm-commits, JDevlieghere

Tags: #debug-info

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

llvm-svn: 327303

6 years ago[Hexagon] Subtarget feature to emit one instruction per packet
Krzysztof Parzyszek [Mon, 12 Mar 2018 17:47:46 +0000 (17:47 +0000)]
[Hexagon] Subtarget feature to emit one instruction per packet

This adds two features: "packets", and "nvj".

Enabling "packets" allows the compiler to generate instruction packets,
while disabling it will prevent it and disable all optimizations that
generate them. This feature is enabled by default on all subtargets.
The feature "nvj" allows the compiler to generate new-value jumps and it
implies "packets". It is enabled on all subtargets.

The exception is made for packets with endloop instructions, since they
require a certain minimum number of instructions in the packets to which
they apply. Disabling "packets" will not prevent hardware loops from
being generated.

llvm-svn: 327302

6 years ago[InstCombine] [NFC] Add tests for peeking through FP casts for sign-bit compares...
Roman Lebedev [Mon, 12 Mar 2018 17:43:02 +0000 (17:43 +0000)]
[InstCombine] [NFC] Add tests for peeking through FP casts for sign-bit compares (PR36682)

Summary:
This pattern came up in PR36682:
https://bugs.llvm.org/show_bug.cgi?id=36682
https://godbolt.org/g/LhuD9A

Tests for proposed fix in D44367.

Looking at the IR pattern in question, as per [[ https://github.com/rutgers-apl/alive-nj | alive-nj ]], for all the type combinations i checked
(input: `i16`, `i32`, `i64`; intermediate: `half`/`i16`, `float`/`i32`, `double`/`i64`)
for the following `icmp` comparisons the `sitofp`+`bitcast` can be dropped:
* `eq 0`
* `ne 0`
* `slt 0`
* `sle 0`
* `sge 0`
* `sgt 0`
* `slt 1`
* `sge 1`
* `sle -1`
* `sgt -1`
I did not check vectors, but i'm guessing it's the same there.
{F5887419}

Thus all these cases are in the testcase (along with the vector variant with additional `undef` element in the middle).
There are no negative patterns here (unless alive-nj lied/is broken), all of these should be optimized.

Generated with {F5887551}

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: nlopes, wdng, llvm-commits

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

llvm-svn: 327301

6 years ago[X86] Deleting README-MMX.txt now that all tasks have been completed.
Simon Pilgrim [Mon, 12 Mar 2018 17:29:54 +0000 (17:29 +0000)]
[X86] Deleting README-MMX.txt now that all tasks have been completed.

MMX buildvectors were improved at rL327247 - new MMX bugs should be raised on bugzilla

llvm-svn: 327300

6 years ago[AMDGPU][MC][GFX8] Added BUFFER_STORE_LDS_DWORD Instruction
Dmitry Preobrazhensky [Mon, 12 Mar 2018 17:29:24 +0000 (17:29 +0000)]
[AMDGPU][MC][GFX8] Added BUFFER_STORE_LDS_DWORD Instruction

See bug 36558: https://bugs.llvm.org/show_bug.cgi?id=36558

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

Reviewers: artem.tamazov, arsenm
llvm-svn: 327299

6 years ago[X86] Add all of the MRM_C0-MRM_FF forms to the switch in RecognizableInstr::emitInst...
Craig Topper [Mon, 12 Mar 2018 17:24:50 +0000 (17:24 +0000)]
[X86] Add all of the MRM_C0-MRM_FF forms to the switch in RecognizableInstr::emitInstructionSpecifier. NFC

Remove the special casing for MRM_F8 by using HANDLE_OPTIONAL.

This should be NFC as the forms that were missing aren't used by any instructions today. They exist in the enum so that we didn't have to put them in one at a time when instructions are added. But looks like we failed here.

llvm-svn: 327298

6 years ago[sanitizer] Align & pad the allocator structures to the cacheline size v2
Kostya Kortchinsky [Mon, 12 Mar 2018 17:18:26 +0000 (17:18 +0000)]
[sanitizer] Align & pad the allocator structures to the cacheline size v2

Summary:
This is a new version of D44261, which broke some builds with older gcc, as
they can't align on a constexpr, but rather require an integer (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56859) among others.

We introduce `SANITIZER_CACHE_LINE_SIZE` in `sanitizer_platform.h` to be
used in `ALIGNED` attributes instead of using directly `kCacheLineSize`.

Reviewers: alekseyshl, thakis

Reviewed By: alekseyshl

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 327297