platform/upstream/llvm.git
6 years ago[X86][Btver2] Remove JAny resource, and map system/microcoded instructions to JALU...
Simon Pilgrim [Thu, 15 Mar 2018 15:12:12 +0000 (15:12 +0000)]
[X86][Btver2] Remove JAny resource, and map system/microcoded instructions to JALU pipes

Simplifies throughput to the issue width (1/2) instead of permitting any pipe (1/6)

llvm-svn: 327632

6 years ago[InstSimplify] add tests with NaN operand for fp binops; NFC
Sanjay Patel [Thu, 15 Mar 2018 14:48:39 +0000 (14:48 +0000)]
[InstSimplify] add tests with NaN operand for fp binops; NFC

llvm-svn: 327631

6 years ago[X86][SSE] Introduce Float/Vector WriteMove, WriteLoad and Writetore scheduler classes
Simon Pilgrim [Thu, 15 Mar 2018 14:45:30 +0000 (14:45 +0000)]
[X86][SSE] Introduce Float/Vector WriteMove, WriteLoad and Writetore scheduler classes

As discussed on D44428 and PR36726, this patch splits off WriteFMove/WriteVecMove, WriteFLoad/WriteVecLoad and WriteFStore/WriteVecStore scheduler classes to permit vectors to be handled separately from gpr/scalar types.

I've minimised the diff here by only moving various basic SSE/AVX vector instructions across - we can fix the rest when called for. This does fix the MOVDQA vs MOVAPS/MOVAPD discrepancies mentioned on D44428.

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

llvm-svn: 327630

6 years ago[change-namespace] Don't match a function call/ref multiple times.
Eric Liu [Thu, 15 Mar 2018 14:45:02 +0000 (14:45 +0000)]
[change-namespace] Don't match a function call/ref multiple times.

Summary:
Previously, the matcher matches a function call/ref multiple times, one
for each decl ancestor. This might cause problems. For example, in the following
case, `func()` would be matched once (with namespace context) before using decl is
seen and once after using decl is seeing, which would result in different conflicting
replacements as the first match would replace `func` with "ns::func" as it doesn't
know about the using decl.

```
namespace x {
namespace {
using ::ns::func;
void f() { func(); }
}
}
```

Switching from `hasDescendant` matching to `hasAncestor` matching solves the
problem.

Reviewers: hokein

Subscribers: klimek, cfe-commits

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

llvm-svn: 327629

6 years ago[X86] Regenerate schedule tests with zero latency comments
Simon Pilgrim [Thu, 15 Mar 2018 14:30:59 +0000 (14:30 +0000)]
[X86] Regenerate schedule tests with zero latency comments

llvm-svn: 327628

6 years ago[PatternMatch, InstSimplify] allow undef elements when matching any vector FP zero
Sanjay Patel [Thu, 15 Mar 2018 14:29:27 +0000 (14:29 +0000)]
[PatternMatch, InstSimplify] allow undef elements when matching any vector FP zero

This matcher implementation appears to be slightly more efficient than
the generic constant check that it is replacing because every use was
for matching FP patterns, but the previous code would check int and
pointer type nulls too.

llvm-svn: 327627

6 years ago[InstSimplify] remove 'nsz' requirement for frem 0, X
Sanjay Patel [Thu, 15 Mar 2018 14:04:31 +0000 (14:04 +0000)]
[InstSimplify] remove 'nsz' requirement for frem 0, X

From the LangRef definition for frem:
"The value produced is the floating-point remainder of the two operands.
This is the same output as a libm ‘fmod‘ function, but without any
possibility of setting errno. The remainder has the same sign as the
dividend. This instruction is assumed to execute in the default
floating-point environment."

llvm-svn: 327626

6 years agoNext batch of test-tree-cleaning changes
Pavel Labath [Thu, 15 Mar 2018 13:47:09 +0000 (13:47 +0000)]
Next batch of test-tree-cleaning changes

Summary:
The changes here fall into several categories.

- some tests were redirecting inferior stdout/err to a file. For these I
  make sure we use an absolute path for the file. I also create a
  lldbutil.read_file_on_target helper function to encapsulate the
  differences between reading a file locally and remotely.
- some tests were redirecting the pexpect I/O into a file. For these I
  use a python StringIO object to avoid creating a file altogether.
- the TestSettings inferior was creating a file. Here, I make sure the
  inferior is launched with pwd=build-dir so that the files end up
  created there.
- lldb-mi --log (used by some tests) creates a log file in PWD without
  the ability say differently. To make this work I make sure to run
  lldb-mi with PWD=build_dir. This in turn necessitated a couple of
  changes in other lldb-mi tests, which were using relative paths to
  access the source tree.

Reviewers: aprantl

Subscribers: ki.stfu, mehdi_amini, lldb-commits

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

llvm-svn: 327625

6 years ago[AArch64] Codegen tests for the Armv8.2-A FP16 intrinsics
Sjoerd Meijer [Thu, 15 Mar 2018 13:42:28 +0000 (13:42 +0000)]
[AArch64] Codegen tests for the Armv8.2-A FP16 intrinsics

This is a follow up of the AArch64 FP16 intrinsics work;
the codegen tests had not been added yet.

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

llvm-svn: 327624

6 years ago[AAch64] Tests for ACLE FP16 macros
Sjoerd Meijer [Thu, 15 Mar 2018 13:36:30 +0000 (13:36 +0000)]
[AAch64] Tests for ACLE FP16 macros

This adds some missing tests for the AArch64 FP16 macros.

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

llvm-svn: 327623

6 years ago[Debug] Retain both copies of debug intrinsics in HoistThenElseCodeToIf
Ulrich Weigand [Thu, 15 Mar 2018 12:28:48 +0000 (12:28 +0000)]
[Debug] Retain both copies of debug intrinsics in HoistThenElseCodeToIf

When hoisting common code from the "then" and "else" branches of a condition
to before the "if", the HoistThenElseCodeToIf routine will attempt to merge
the debug location associated with the two original copies of the hoisted
instruction.

This is a problem in the special case where the hoisted instruction is a
debug info intrinsic, since for those the debug location is considered
part of the intrinsic and attempting to modify it may resut in invalid
IR.  This is the underlying cause of PR36410.

This patch fixes the problem by handling debug info intrinsics specially:
instead of hoisting one copy and merging the two locations, the code now
simply hoists both copies, each with its original location intact.  Note
that this is still only done in the case where both original copies are
otherwise (i.e. apart from location metadata) identical.

Reviewed By: aprantl

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

llvm-svn: 327622

6 years ago[TSan] fix Go runtime test on amd64 with PIE
Martin Pelikan [Thu, 15 Mar 2018 12:10:43 +0000 (12:10 +0000)]
[TSan] fix Go runtime test on amd64 with PIE

Summary:
Without this diff, the test segfaults.  Examining the generated executable
(which gets auto-deleted likely by cmake/ninja) yields this error message:

ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 1755558480000 (errno: 12)

Note that the address has more than 47 bits, which on amd64 means special
treatment and therefore points out an overflow.  The allocation came from
__tsan_map_shadow on a .data pointer, which (on my work Debian-based box)
means the 0x550000000000 range.  This doesn't correspond to the constants
mentioned in tsan_platform.h for Go binaries on Linux/amd64.

The diff therefore allocates memory in the sort of area Go programs would,
and prevents the test from crashing.  It would be nice if reviewers kindly
considered other setups and architectures :-)

Reviewers: kcc, dvyukov

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

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

llvm-svn: 327621

6 years ago[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes
Brock Wyma [Thu, 15 Mar 2018 11:52:17 +0000 (11:52 +0000)]
[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes

This patch sorts local variables by lexical scope and emits them inside
an appropriate S_BLOCK32 CodeView symbol.

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

llvm-svn: 327620

6 years ago[New PM][IRCE] port of Inductive Range Check Elimination pass to the new pass manager
Fedor Sergeev [Thu, 15 Mar 2018 11:01:19 +0000 (11:01 +0000)]
[New PM][IRCE] port of Inductive Range Check Elimination pass to the new pass manager

There are two nontrivial details here:
* Loop structure update interface is quite different with new pass manager,
  so the code to add new loops was factored out

* BranchProbabilityInfo is not a loop analysis, so it can not be just getResult'ed from
  within the loop pass. It cant even be queried through getCachedResult as LoopCanonicalization
  sequence (e.g. LoopSimplify) might invalidate BPI results.

  Complete solution for BPI will likely take some time to discuss and figure out,
  so for now this was partially solved by making BPI optional in IRCE
  (skipping a couple of profitability checks if it is absent).

Most of the IRCE tests got their corresponding new-pass-manager variant enabled.
Only two of them depend on BPI, both marked with TODO, to be turned on when BPI
starts being available for loop passes.

Reviewers: chandlerc, mkazantsev, sanjoy, asbirlea
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D43795

llvm-svn: 327619

6 years agoMore warnings when double truncation to float: compound assignment is supported now.
Andrew V. Tischenko [Thu, 15 Mar 2018 10:03:35 +0000 (10:03 +0000)]
More warnings when double truncation to float: compound assignment is supported now.

llvm-svn: 327618

6 years ago[LoopUnroll] Ignore ephemeral values when checking full unroll profitability.
Andrei Elovikov [Thu, 15 Mar 2018 09:59:15 +0000 (09:59 +0000)]
[LoopUnroll] Ignore ephemeral values when checking full unroll profitability.

Summary:
Before this patch call graph is like this in the LoopUnrollPass:

  tryToUnrollLoop
    ApproximateLoopSize
      collectEphemeralValues
      /* Use collected ephemeral values */
    computeUnrollCount
      analyzeLoopUnrollCost
        /* Bail out from the analysis if loop contains CallInst */

This patch moves collection of the ephemeral values to the tryToUnrollLoop
function and passes the collected values into both ApproximateLoopsize (as
before) and additionally starts using them in analyzeLoopUnrollCost:

  tryToUnrollLoop
    collectEphemeralValues
    ApproximateLoopSize(EphValues)
      /* Use EphValues */
    computeUnrollCount(EphValues)
      analyzeLoopUnrollCost(EphValues)
        /* Ignore ephemeral values - they don't contribute to the final cost */
        /* Bail out from the analysis if loop contains CallInst */

Reviewers: mzolotukhin, evstupac, sanjoy

Reviewed By: evstupac

Subscribers: llvm-commits

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

llvm-svn: 327617

6 years ago[ELF] - Fix build bot after rL327612.
George Rimar [Thu, 15 Mar 2018 09:40:25 +0000 (09:40 +0000)]
[ELF] - Fix build bot after rL327612.

Missed this one.

llvm-svn: 327616

6 years ago[SCEV][NFC] Remove TBB, FBB parameters from exit limit computations
Max Kazantsev [Thu, 15 Mar 2018 09:38:00 +0000 (09:38 +0000)]
[SCEV][NFC] Remove TBB, FBB parameters from exit limit computations

Methods `computeExitLimitFromCondCached` and `computeExitLimitFromCondImpl` take
true and false branches as parameters and only use them for asserts and for identifying
whether true/false branch belongs to the loop (which can be done once earlier). This fact
complicates generalization of exit limit computation logic on guards because the guards
don't have blocks to which they go in case of failure explicitly.

The motivation of this patch is that currently this part of SCEV knows nothing about guards
and only works with explicit branches. As result, it fails to prove that a loop

  for (i = 0; i < 100; i++)
    guard(i < 10);

exits after 10th iteration, while in the equivalent example

  for (i = 0; i < 100; i++)
    if (i >= 10) break;

SCEV easily proves this fact. We are going to change it in near future, and this is why
we need to make these methods operate on more abstract level.

This patch refactors this code to get rid of these parameters as meaningless and prepare
ground for teaching these methods to work with guards as well as they work with explicit
branching instructions.

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

llvm-svn: 327615

6 years ago[ELF] - Simplify test case. NFCI.
George Rimar [Thu, 15 Mar 2018 09:26:08 +0000 (09:26 +0000)]
[ELF] - Simplify test case. NFCI.

llvm-svn: 327614

6 years ago[ELF] - Fix build bot after rL327612.
George Rimar [Thu, 15 Mar 2018 09:24:51 +0000 (09:24 +0000)]
[ELF] - Fix build bot after rL327612.

Error was:
error: field 'Size' will be initialized after field 'CommandString' [-Werror,-Wreorder]

llvm-svn: 327613

6 years ago[ELF] - Show data and assignment commands in the map file.
George Rimar [Thu, 15 Mar 2018 09:16:40 +0000 (09:16 +0000)]
[ELF] - Show data and assignment commands in the map file.

Patch teaches LLD to print BYTE/SHORT/LONG/QUAD and
location move commands to the map file.

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

llvm-svn: 327612

6 years ago@skipUnlessDarwin TestTargetSourceMap
Pavel Labath [Thu, 15 Mar 2018 09:16:15 +0000 (09:16 +0000)]
@skipUnlessDarwin TestTargetSourceMap

Our MachO parser works only on darwin.

llvm-svn: 327611

6 years ago[clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name...
Alexander Kornienko [Thu, 15 Mar 2018 08:27:42 +0000 (08:27 +0000)]
[clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name=UnusedRAIICheck

llvm-svn: 327610

6 years agoFixed filename in a comment. NFC
Alexander Kornienko [Thu, 15 Mar 2018 08:26:58 +0000 (08:26 +0000)]
Fixed filename in a comment. NFC

llvm-svn: 327609

6 years ago[clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-container
Alexander Kornienko [Thu, 15 Mar 2018 08:26:47 +0000 (08:26 +0000)]
[clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-container

llvm-svn: 327608

6 years ago[clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expression
Alexander Kornienko [Thu, 15 Mar 2018 08:26:19 +0000 (08:26 +0000)]
[clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expression

llvm-svn: 327607

6 years ago[clang-tidy] rename_check.py {misc,bugprone}-macro-parentheses
Alexander Kornienko [Thu, 15 Mar 2018 08:25:39 +0000 (08:25 +0000)]
[clang-tidy] rename_check.py {misc,bugprone}-macro-parentheses

llvm-svn: 327606

6 years ago[X86] Add test cases for 512-bit addsub from build_vector.
Craig Topper [Thu, 15 Mar 2018 06:49:01 +0000 (06:49 +0000)]
[X86] Add test cases for 512-bit addsub from build_vector.

There is no 512 bit addsub instruction, but we partially match it handle fmaddsub matching. We explicitly bail out for 512 bit vectors after failing the fmaddsub match, but we had no test coverage for that bail out.

We might want to consider splitting and using 256 bit instructions instead of the long sequence seen here.

llvm-svn: 327605

6 years ago[X86] Add support for matching FMSUBADD from build_vector.
Craig Topper [Thu, 15 Mar 2018 06:14:55 +0000 (06:14 +0000)]
[X86] Add support for matching FMSUBADD from build_vector.

llvm-svn: 327604

6 years ago[X86] Remove old TODO. We have coverage for this now.
Craig Topper [Thu, 15 Mar 2018 06:14:53 +0000 (06:14 +0000)]
[X86] Remove old TODO. We have coverage for this now.

Coverage was added in r320950.

llvm-svn: 327603

6 years ago[X86] Use MVT in a couple places where we know the type is legal.
Craig Topper [Thu, 15 Mar 2018 06:14:51 +0000 (06:14 +0000)]
[X86] Use MVT in a couple places where we know the type is legal.

llvm-svn: 327602

6 years ago[DebugInfo] Add a new method IPDBSession::findLineNumbersBySectOffset
Aaron Smith [Thu, 15 Mar 2018 06:04:51 +0000 (06:04 +0000)]
[DebugInfo] Add a new method IPDBSession::findLineNumbersBySectOffset

Summary:
Some PDB symbols do not have a valid VA or RVA but have Addr by Section and Offset. For example, a variable in thread-local storage has the following properties:

     get_addressOffset: 0
     get_addressSection: 5
     get_lexicalParentId: 2
     get_name: g_tls
     get_symIndexId: 12
     get_typeId: 4
     get_dataKind: 6
     get_symTag: 7
     get_locationType: 2

This change provides a new method to locate line numbers by Section and Offset from those symbols.

Reviewers: zturner, rnk, llvm-commits

Subscribers: asmith, JDevlieghere

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

llvm-svn: 327601

6 years agoFix a bug in "target.source-map" where we would resolve unmapped paths incorrectly
Greg Clayton [Thu, 15 Mar 2018 05:13:15 +0000 (05:13 +0000)]
Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

When using:

(lldb) settings set target.source-map ./ /path/to/source
LLDB would fail to set a source file and line breakpoint with:

(lldb) breakpoint set --file /path/to/source/main.c --line 2
Because code in the target was undoing the remapping of "/path/to/source/main.c" to "./main.c" and then it would resolve this path, which would append the current working directory to the path. We don't want to resolve paths that we unmap.

Test case added.

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

llvm-svn: 327600

6 years ago[PowerPC][NFC] formatting-only fix
Lei Huang [Thu, 15 Mar 2018 03:06:44 +0000 (03:06 +0000)]
[PowerPC][NFC] formatting-only fix

llvm-svn: 327599

6 years agoRefactoring code around move/copy initialization. NFC.
Richard Trieu [Thu, 15 Mar 2018 03:00:55 +0000 (03:00 +0000)]
Refactoring code around move/copy initialization.  NFC.

Use an enum parameter instead of a bool for more control on how the copy elision
functions work.  Extract the move initialization code from the move or copy
initialization block.

Patch by: Arthur O'Dwyer

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

llvm-svn: 327598

6 years agoRemove unused variable; NFC
George Burgess IV [Thu, 15 Mar 2018 02:58:36 +0000 (02:58 +0000)]
Remove unused variable; NFC

llvm-svn: 327597

6 years ago[sanitizer] Fix off type in mmap64 interceptor
Vitaly Buka [Thu, 15 Mar 2018 01:13:29 +0000 (01:13 +0000)]
[sanitizer] Fix off type in mmap64 interceptor

llvm-svn: 327596

6 years ago[test] cmake: Ensure liblldb builds before tests run
Vedant Kumar [Thu, 15 Mar 2018 01:09:13 +0000 (01:09 +0000)]
[test] cmake: Ensure liblldb builds before tests run

Without liblldb as a test dependency, tests which link it in from an
lldb framework (via Base.buildDriver()) won't work.

llvm-svn: 327595

6 years ago[ORC] Re-apply r327566 with a fix for test-global-ctors.ll.
Lang Hames [Thu, 15 Mar 2018 00:30:14 +0000 (00:30 +0000)]
[ORC] Re-apply r327566 with a fix for test-global-ctors.ll.

Also clang-formats the patch, which I should have done the first time around.

llvm-svn: 327594

6 years ago[CFG] Allow CallExpr's to be looked up in CFG's
Richard Trieu [Thu, 15 Mar 2018 00:09:26 +0000 (00:09 +0000)]
[CFG] Allow CallExpr's to be looked up in CFG's

r327343 changed the handling for CallExpr in a CFG, which prevented lookups for
CallExpr while other Stmt kinds still worked.  This change carries over the
necessary bits from Stmt function to CallExpr function.

llvm-svn: 327593

6 years ago[Dictionary] Rewrite the test added in r327587 as an inline test.
Davide Italiano [Thu, 15 Mar 2018 00:07:05 +0000 (00:07 +0000)]
[Dictionary] Rewrite the test added in r327587 as an inline test.

Until we have a better story for putting commands and check lines
in the same file (they're currently ignored), it seems that inline
tests are actually more concise and easier to understand.
Too bad we have still some python boilerplate, but that's not
really substantial so we can live with it.

Thanks to Fred for pointing out and Jim for explaining me how
to use the inline test format.

<rdar://problem/34806516>

llvm-svn: 327592

6 years ago[analyzer] Explicitly set an -std level for the analyzer test.
George Karpenkov [Wed, 14 Mar 2018 23:50:18 +0000 (23:50 +0000)]
[analyzer] Explicitly set an -std level for the analyzer test.

llvm-svn: 327591

6 years ago[clang-tidy] Add Zircon module to clang-tidy
Julie Hockett [Wed, 14 Mar 2018 23:47:50 +0000 (23:47 +0000)]
[clang-tidy] Add Zircon module to clang-tidy

Adding a Zircon module to clang-tidy for checks specific to the Zircon
kernel, and adding a checker to fuchsia-zx (for zircon) to flag instances
where specific objects are temporarily created.

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

llvm-svn: 327590

6 years ago[CleanUp] Remove NumInstructions field from LoopVectorizer's RegisterUsage struct.
Matt Davis [Wed, 14 Mar 2018 23:30:31 +0000 (23:30 +0000)]
[CleanUp] Remove NumInstructions field from LoopVectorizer's RegisterUsage struct.

Summary:
This variable is largely going unused; aside from reporting number of instructions for in DEBUG builds.

The only use of NumInstructions is in debug output to represent the LoopSize.  That value can be can be misleading as it also includes metadata instructions (e.g., DBG_VALUE) which have no real impact.  If we do choose to keep this around, we probably should guard it by a DEBUG macro, as it's not used in production builds.

Reviewers: majnemer, congh, rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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

llvm-svn: 327589

6 years ago[X86][Btver2] Add support for multiple pipelines stages for fpu schedules. NFCI.
Simon Pilgrim [Wed, 14 Mar 2018 23:12:09 +0000 (23:12 +0000)]
[X86][Btver2] Add support for multiple pipelines stages for fpu schedules. NFCI.

This allows us to use JWriteResFpuPair for complex schedule classes as well as single pipe instructions.

llvm-svn: 327588

6 years ago[DataFormatters] Implement summary for __NSDictionary0.
Davide Italiano [Wed, 14 Mar 2018 23:09:36 +0000 (23:09 +0000)]
[DataFormatters] Implement summary for __NSDictionary0.

Before the patch:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x0000000100304420

After:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x0000000100304420 0 key/value pairs

There's nothing much else we can do, as this is always empty by
definition.

<rdar://problem/34806516>

llvm-svn: 327587

6 years ago[test] Skip more lldb-mi tests which occasionally time out on Darwin
Vedant Kumar [Wed, 14 Mar 2018 22:52:32 +0000 (22:52 +0000)]
[test] Skip more lldb-mi tests which occasionally time out on Darwin

llvm-svn: 327586

6 years ago[InstSimplify] add tests for frem and vectors with undef; NFC
Sanjay Patel [Wed, 14 Mar 2018 22:45:58 +0000 (22:45 +0000)]
[InstSimplify] add tests for frem and vectors with undef; NFC

These should all be folded. The vector tests need to have
m_AnyZero updated to ignore undef elements, but we need to
be careful not to return the existing value in that case
and unintentionally propagate undef.

llvm-svn: 327585

6 years agoUpdate Error Message
Rumeet Dhindsa [Wed, 14 Mar 2018 22:05:12 +0000 (22:05 +0000)]
Update Error Message

Summary: Updates error message  for dynamic relocation attempt for read only segments.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: emaste, javed.absar, arichardson, llvm-commits

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

llvm-svn: 327584

6 years ago[AMDGPU] Waitcnt pass: Modify the waitcnt pass to propagate info in the case of a...
Mark Searles [Wed, 14 Mar 2018 22:04:32 +0000 (22:04 +0000)]
[AMDGPU] Waitcnt pass: Modify the waitcnt pass to propagate info in the case of a single basic block loop. mergeInputScoreBrackets() does this for us; update it so that it processes the single bb's score bracket when processing the single bb's preds. It is, after all, a pred of itself, so it's score bracket is needed.

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

llvm-svn: 327583

6 years ago[X86][Btver2] Add ResourceCycles and NumMicroOps overrides to scalar instructions...
Simon Pilgrim [Wed, 14 Mar 2018 21:55:54 +0000 (21:55 +0000)]
[X86][Btver2] Add ResourceCycles and NumMicroOps overrides to scalar instructions. NFCI.

Currently still use default values - this is setup for a future patch.

llvm-svn: 327582

6 years ago[FastISel] Sink local value materializations to first use
Reid Kleckner [Wed, 14 Mar 2018 21:54:21 +0000 (21:54 +0000)]
[FastISel] Sink local value materializations to first use

Summary:
Local values are constants, global addresses, and stack addresses that
can't be folded into the instruction that uses them. For example, when
storing the address of a global variable into memory, we need to
materialize that address into a register.

FastISel doesn't want to materialize any given local value more than
once, so it generates all local value materialization code at
EmitStartPt, which always dominates the current insertion point. This
allows it to maintain a map of local value registers, and it knows that
the local value area will always dominate the current insertion point.

The downside is that local value instructions are always emitted without
a source location. This is done to prevent jumpy line tables, but it
means that the local value area will be considered part of the previous
statement. Consider this C code:
  call1();      // line 1
  ++global;     // line 2
  ++global;     // line 3
  call2(&global, &local); // line 4

Today we end up with assembly and line tables like this:
  .loc 1 1
  callq call1
  leaq global(%rip), %rdi
  leaq local(%rsp), %rsi
  .loc 1 2
  addq $1, global(%rip)
  .loc 1 3
  addq $1, global(%rip)
  .loc 1 4
  callq call2

The LEA instructions in the local value area have no source location and
are treated as being on line 1. Stepping through the code in a debugger
and correlating it with the assembly won't make much sense, because
these materializations are only required for line 4.

This is actually problematic for the VS debugger "set next statement"
feature, which effectively assumes that there are no registers live
across statement boundaries. By sinking the local value code into the
statement and fixing up the source location, we can make that feature
work. This was filed as https://bugs.llvm.org/show_bug.cgi?id=35975 and
https://crbug.com/793819.

This change is obviously not enough to make this feature work reliably
in all cases, but I felt that it was worth doing anyway because it
usually generates smaller, more comprehensible -O0 code. I measured a
0.12% regression in code generation time with LLC on the sqlite3
amalgamation, so I think this is worth doing.

There are some special cases worth calling out in the commit message:
1. local values materialized for phis
2. local values used by no-op casts
3. dead local value code

Local values can be materialized for phis, and this does not show up as
a vreg use in MachineRegisterInfo. In this case, if there are no other
uses, this patch sinks the value to the first terminator, EH label, or
the end of the BB if nothing else exists.

Local values may also be used by no-op casts, which adds the register to
the RegFixups table. Without reversing the RegFixups map direction, we
don't have enough information to sink these instructions.

Lastly, if the local value register has no other uses, we can delete it.
This comes up when fastisel tries two instruction selection approaches
and the first materializes the value but fails and the second succeeds
without using the local value.

Reviewers: aprantl, dblaikie, qcolombet, MatzeB, vsk, echristo

Subscribers: dotdash, chandlerc, hans, sdardis, amccarth, javed.absar, zturner, llvm-commits, hiraditya

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

llvm-svn: 327581

6 years ago[CodeGen] Use MIR syntax for MachineMemOperand printing
Francis Visoiu Mistrih [Wed, 14 Mar 2018 21:52:13 +0000 (21:52 +0000)]
[CodeGen] Use MIR syntax for MachineMemOperand printing

Get rid of the "; mem:" suffix and use the one we use in MIR: ":: (load 2)".

rdar://38163529

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

llvm-svn: 327580

6 years ago[WebAssembly] Fix -Werror=extra failure due to enum in ternary
Nicholas Wilson [Wed, 14 Mar 2018 21:43:04 +0000 (21:43 +0000)]
[WebAssembly] Fix -Werror=extra failure due to enum in ternary

llvm-svn: 327579

6 years agoRemove test deep-ast-tree.cpp
Yaxun Liu [Wed, 14 Mar 2018 21:40:55 +0000 (21:40 +0000)]
Remove test deep-ast-tree.cpp

Since there is no reliable way to change the AST depth of this test by supported stack size
of the test environment, remove this test for now.

llvm-svn: 327578

6 years ago[EarlyCSE] Exploit open ended invariant.start scopes
Philip Reames [Wed, 14 Mar 2018 21:35:06 +0000 (21:35 +0000)]
[EarlyCSE] Exploit open ended invariant.start scopes

If we have an invariant.start with no corresponding invariant.end, then the memory location becomes invariant indefinitely after the invariant.start. As a result, anything dominated by the start is guaranteed to see the value the memory location had when the invariant.start executed.

This patch adds an AvailableInvariants table which tracks the generation a particular memory location became invariant and then uses that information to allow value forwarding that would otherwise be disallowed by potentially aliasing stores. (Reminder: In EarlyCSE everything clobbers everything by default.)

This should be compatible with the MemorySSA variant, but design is generational. We can and should add first class support for invariant.start within MemorySSA at a later time.  I took a quick look at doing so, but probably need some input from a MemorySSA expert.

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

llvm-svn: 327577

6 years agoRevert "[ORC] Switch from shared_ptr to unique_ptr for addModule methods."
Reid Kleckner [Wed, 14 Mar 2018 21:32:34 +0000 (21:32 +0000)]
Revert "[ORC] Switch from shared_ptr to unique_ptr for addModule methods."

This reverts commit r327566, it breaks
test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll.

The test doesn't crash with a stack trace, unfortunately. It merely
returns 1 as the exit code.

ASan didn't produce a report, and I reproduced this on my Linux machine
and Windows box.

llvm-svn: 327576

6 years ago[InstSimplify] fix folds for (0.0 - X) + X --> 0 (PR27151)
Sanjay Patel [Wed, 14 Mar 2018 21:23:27 +0000 (21:23 +0000)]
[InstSimplify] fix folds for (0.0 - X) + X --> 0 (PR27151)

As shown in:
https://bugs.llvm.org/show_bug.cgi?id=27151
...the existing fold could miscompile when X is NaN.

The fold was also dependent on 'ninf' but that's not necessary.

From IEEE-754 (with default rounding which we can assume for these opcodes):
"When the sum of two operands with opposite signs (or the difference of two
operands with like signs) is exactly zero, the sign of that sum (or difference)
shall be +0...However, x + x = x − (−x) retains the same sign as x even when
x is zero."

llvm-svn: 327575

6 years ago[ELF] Add .eh_frame pieces to map file
Rui Ueyama [Wed, 14 Mar 2018 21:18:18 +0000 (21:18 +0000)]
[ELF] Add .eh_frame pieces to map file

This patch is a simplified version of https://reviews.llvm.org/D42960
written by Andrew Ng.

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

llvm-svn: 327574

6 years ago[Tooling] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 14 Mar 2018 21:05:51 +0000 (21:05 +0000)]
[Tooling] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 327573

6 years ago[X86] Add haswell testing for PR35635 as well.
Simon Pilgrim [Wed, 14 Mar 2018 21:03:09 +0000 (21:03 +0000)]
[X86] Add haswell testing for PR35635 as well.

To improve complete model testing for schedulers for instructions with multiple results.

llvm-svn: 327572

6 years ago[COFF] Fix LLD COFF tests as a follow-up to r327563
Reid Kleckner [Wed, 14 Mar 2018 20:41:39 +0000 (20:41 +0000)]
[COFF] Fix LLD COFF tests as a follow-up to r327563

I definitely didn't run the tests before committing :(

Most of these tests failed because the LLD map file output changed,
moving the functions from the main text section to a new per-function
section.

ICF also started to fire in a few cases, leading to new layouts.

llvm-svn: 327571

6 years agoReduce AST depth for test deep-ast-tree.cpp for atom
Yaxun Liu [Wed, 14 Mar 2018 20:41:05 +0000 (20:41 +0000)]
Reduce AST depth for test deep-ast-tree.cpp for atom

llvm-svn: 327570

6 years ago[AArch64] Emit CSR loads in the same order as stores
Francis Visoiu Mistrih [Wed, 14 Mar 2018 20:34:03 +0000 (20:34 +0000)]
[AArch64] Emit CSR loads in the same order as stores

Optionally allow the order of restoring the callee-saved registers in the
epilogue to be reversed.

The flag -reverse-csr-restore-seq generates the following code:

```
stp     x26, x25, [sp, #-64]!
stp     x24, x23, [sp, #16]
stp     x22, x21, [sp, #32]
stp     x20, x19, [sp, #48]

; [..]

ldp     x24, x23, [sp, #16]
ldp     x22, x21, [sp, #32]
ldp     x20, x19, [sp, #48]
ldp     x26, x25, [sp], #64
ret
```

Note how the CSRs are restored in the same order as they are saved.

One exception to this rule is the last `ldp`, which allows us to merge
the stack adjustment and the ldp into a post-index ldp. This is done by
first generating:

ldp x26, x27, [sp]
add sp, sp, #64

which gets merged by the arm64 load store optimizer into

ldp x26, x25, [sp], #64

The flag is disabled by default.

llvm-svn: 327569

6 years ago[test] Skip some lldb-mi tests which time out on Darwin
Vedant Kumar [Wed, 14 Mar 2018 20:32:10 +0000 (20:32 +0000)]
[test] Skip some lldb-mi tests which time out on Darwin

These don't always timeout, but it's inconvenient when they do.

llvm-svn: 327568

6 years ago[test] Fix a temp filename in a test from SVN r327561. NFC.
Martin Storsjo [Wed, 14 Mar 2018 20:31:31 +0000 (20:31 +0000)]
[test] Fix a temp filename in a test from SVN r327561. NFC.

An earlier file name accidentally slipped through into the committed
version.

llvm-svn: 327567

6 years ago[ORC] Switch from shared_ptr to unique_ptr for addModule methods.
Lang Hames [Wed, 14 Mar 2018 20:29:45 +0000 (20:29 +0000)]
[ORC] Switch from shared_ptr to unique_ptr for addModule methods.

Layer implementations typically mutate module state, and this is better
reflected by having layers own the Module they are operating on.

llvm-svn: 327566

6 years agoImplement --cref.
Rui Ueyama [Wed, 14 Mar 2018 20:29:45 +0000 (20:29 +0000)]
Implement --cref.

This is an option to print out a table of symbols and filenames.
The output format of this option is the same as GNU, so that it can be
processed by the same scripts as before after migrating from GNU to lld.

This option is mildly useful; we can live without it. But it is pretty
convenient sometimes, and it can be implemented in 50 lines of code, so
I think lld should support this option.

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

llvm-svn: 327565

6 years ago[UpdateTestChecks] Handle IR variables with a '-' in the name
Alexander Richardson [Wed, 14 Mar 2018 20:28:53 +0000 (20:28 +0000)]
[UpdateTestChecks] Handle IR variables with a '-' in the name

Summary:
I noticed that clang will emit variables such as %indirect-arg-temp when
running update_cc1_test_checks.py and therefore update_cc1_test_checks.py
wasn't adding FileCheck captures for those variables.

Reviewers: MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

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

llvm-svn: 327564

6 years ago[COFF] Enable per-function and data sections in LTO
Reid Kleckner [Wed, 14 Mar 2018 20:25:41 +0000 (20:25 +0000)]
[COFF] Enable per-function and data sections in LTO

Summary: This allows post-LTO symbol reordering and ICF.

Reviewers: inglorion

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 327563

6 years ago[MinGW] Add support for the GNU ld flag --kill-at
Martin Storsjo [Wed, 14 Mar 2018 20:17:24 +0000 (20:17 +0000)]
[MinGW] Add support for the GNU ld flag --kill-at

llvm-svn: 327562

6 years ago[COFF] Add support for the GNU ld flag --kill-at
Martin Storsjo [Wed, 14 Mar 2018 20:17:16 +0000 (20:17 +0000)]
[COFF] Add support for the GNU ld flag --kill-at

GNU ld has got a number of different flags for adjusting how to
behave around stdcall functions. The --kill-at flag strips the
trailing sdcall suffix from exported functions (which otherwise
is included by default in MinGW setups).

This also strips it from the corresponding import library though.
That makes it hard to link to such an import library from code
that calls the functions - but this matches what GNU ld does with
this flag. Therefore, this flag is probably not sensibly used
together with import libraries, but probably mostly when creating
some sort of plugin, or if creating the import library separately
with dlltool.

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

llvm-svn: 327561

6 years ago[wasm] Fix wasm lld test on Windows, where the executable name ends in .exe
Reid Kleckner [Wed, 14 Mar 2018 19:49:57 +0000 (19:49 +0000)]
[wasm] Fix wasm lld test on Windows, where the executable name ends in .exe

llvm-svn: 327560

6 years ago[COFF] Add integration test for LTO + /guard:cf
Reid Kleckner [Wed, 14 Mar 2018 19:49:28 +0000 (19:49 +0000)]
[COFF] Add integration test for LTO + /guard:cf

This tests that LLVM emits the relocations that /guard:cf needs to
identify address taken.

This was PR36624, which was fixed in r327557.

llvm-svn: 327559

6 years ago[Parser] (C++) Make -Wextra-semi slightly more useful
Roman Lebedev [Wed, 14 Mar 2018 19:31:34 +0000 (19:31 +0000)]
[Parser] (C++) Make -Wextra-semi slightly more useful

Summary:
Let's suppose the `-Weverything` is passed.

Given code like
```
void F() {}
;
```
If the code is compiled with `-std=c++03`, it would diagnose that extra sema:
```
<source>:2:1: warning: extra ';' outside of a function is a C++11 extension [-Wc++11-extra-semi]
;
^~
```
If the code is compiled with `-std=c++11`, it also would diagnose that extra sema:
```
<source>:2:1: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-pedantic]
;
^~
```

But, let's suppose the C++11 or higher is used, and the used does not care
about `-Wc++98-compat-pedantic`, so he disables that diagnostic.
And that silences the complaint about extra `;` too.
And there is no way to re-enable that particular diagnostic, passing `-Wextra-semi` does nothing...

Now, there is also a related `no newline at end of file` diagnostic, which is also emitted by `-Wc++98-compat-pedantic`
```
<source>:2:2: warning: C++98 requires newline at end of file [-Wc++98-compat-pedantic]
;
 ^
```
But unlike the previous case, if `-Wno-c++98-compat-pedantic` is passed, that diagnostic stays displayed:
```
<source>:2:2: warning: no newline at end of file [-Wnewline-eof]
;
 ^
```

This diff refactors the code so `-Wc++98-compat-extra-semi` can be re-enabled, after the `-Wc++98-compat-pedantic` was disabled.
This seems ugly, but there does not seem to be any saner way.

Testing: `$ ninja check-clang`

Reviewers: rsmith, rtrieu, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jordan_rose, cfe-commits

Tags: #clang

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

llvm-svn: 327558

6 years ago[MC] Always emit relocations for same-section function references
Reid Kleckner [Wed, 14 Mar 2018 19:24:32 +0000 (19:24 +0000)]
[MC] Always emit relocations for same-section function references

Summary:
We already emit relocations in this case when the "incremental linker
compatible" flag is set, but it turns out these relocations are also
required for /guard:cf. Now that we have two use cases for this
behavior, let's make it unconditional to try to keep things simple.

We never hit this problem in Clang because it always sets the
"incremental linker compatible" flag when targeting MSVC. However, LLD
LTO doesn't set this flag, so we'd get CFG failures at runtime when
using ThinLTO and /guard:cf. We probably don't want LLD LTO to set the
"incremental linker compatible" assembler flag, since this has nothing
to do with incremental linking, and we don't need to timestamp LTO
temporary objects.

Fixes PR36624.

Reviewers: inglorion, espindola, majnemer

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

llvm-svn: 327557

6 years ago[libomptarget][nvptx] Bug fix: Correctly identify the warp master active thread.
George Rokos [Wed, 14 Mar 2018 19:11:36 +0000 (19:11 +0000)]
[libomptarget][nvptx] Bug fix: Correctly identify the warp master active thread.

llvm-svn: 327556

6 years agoSeparate sentences to clarify a comment.
Rui Ueyama [Wed, 14 Mar 2018 19:01:00 +0000 (19:01 +0000)]
Separate sentences to clarify a comment.

llvm-svn: 327555

6 years ago[InstSimplify] add tests to show missing/broken fadd folds (PR27151, PR26958); NFC
Sanjay Patel [Wed, 14 Mar 2018 18:52:40 +0000 (18:52 +0000)]
[InstSimplify] add tests to show missing/broken fadd folds (PR27151, PR26958); NFC

llvm-svn: 327554

6 years ago[InstSimplify] regenerate checks; NFC
Sanjay Patel [Wed, 14 Mar 2018 18:49:57 +0000 (18:49 +0000)]
[InstSimplify] regenerate checks; NFC

llvm-svn: 327553

6 years ago[test] Delete some xfailed lldb-mi tests
Vedant Kumar [Wed, 14 Mar 2018 18:37:13 +0000 (18:37 +0000)]
[test] Delete some xfailed lldb-mi tests

This is a first pass at removing some lldb-mi tests which have been
xfailed and unmaintained for a while. We have open PRs for most of these
tests already. I've opened up the following additional PRs:

  llvm.org/PR36739 - lldb-mi driver exits properly
  llvm.org/PR36740 - lldb-mi -gdb-set and -gdb-show
  llvm.org/PR36741 - lldb-mi -symbol-xxx

The motivation here is to address timeout and pexpect-related issues in
the test suite. This was discussed on lldb-dev in the thread: "increase
timeout for tests?".

After this change, the lldb-mi tests seem to be in better health (on
Darwin at least). I consistently get:

$ ./bin/llvm-dotest -p TestMi
===================
Test Result Summary
===================
Test Methods:        101
Reruns:                0
Success:              88
Expected Failure:      0
Failure:               0
Error:                 0
Exceptional Exit:      0
Unexpected Success:    0
Skip:                 13
Timeout:               0
Expected Timeout:      0

llvm-svn: 327552

6 years ago[LLVM-C] [bindings/go] Add C and Golang bindings for COMDAT
Reid Kleckner [Wed, 14 Mar 2018 18:33:53 +0000 (18:33 +0000)]
[LLVM-C] [bindings/go] Add C and Golang bindings for COMDAT

Patch by Ben Clayton

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

llvm-svn: 327551

6 years ago[clangd] Use Contents from inputs in codeComplete and signatureHelp
Simon Marchi [Wed, 14 Mar 2018 18:31:48 +0000 (18:31 +0000)]
[clangd] Use Contents from inputs in codeComplete and signatureHelp

Summary:
ClangdServer::{codeComplete,signatureHelp} both use the Contents from
the draft manager.  Since we want to move the draft manager from
ClangdServer to ClangdLSPServer, this patch changes those methods to
find the file contents from InputsAndPreamble, which contains the source
passed in previously.

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

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

llvm-svn: 327550

6 years agoUse GetItemAtIndexAsString overload for ConstString and move set rather than copy.
Tatyana Krasnukha [Wed, 14 Mar 2018 18:29:41 +0000 (18:29 +0000)]
Use GetItemAtIndexAsString overload for ConstString and move set rather than copy.

llvm-svn: 327549

6 years agoReuse IsEmpty for ConstString::operator bool().
Tatyana Krasnukha [Wed, 14 Mar 2018 18:29:33 +0000 (18:29 +0000)]
Reuse IsEmpty for ConstString::operator bool().

llvm-svn: 327548

6 years agoAttempt to fix failure of deep-ast-tree.cpp on atom and s390
Yaxun Liu [Wed, 14 Mar 2018 18:24:38 +0000 (18:24 +0000)]
Attempt to fix failure of deep-ast-tree.cpp on atom and s390

llvm-svn: 327547

6 years agoUpdate DR script to mark Clang 6 as 'done' not 'svn'.
Richard Smith [Wed, 14 Mar 2018 18:20:45 +0000 (18:20 +0000)]
Update DR script to mark Clang 6 as 'done' not 'svn'.

llvm-svn: 327546

6 years ago[www] Update C++ DR status to match latest issues list.
Richard Smith [Wed, 14 Mar 2018 18:19:41 +0000 (18:19 +0000)]
[www] Update C++ DR status to match latest issues list.

llvm-svn: 327545

6 years agoSet dso_local for NSConcreteStackBlock.
Rafael Espindola [Wed, 14 Mar 2018 18:19:26 +0000 (18:19 +0000)]
Set dso_local for NSConcreteStackBlock.

llvm-svn: 327544

6 years agoSet dso_local on external rtti GVs.
Rafael Espindola [Wed, 14 Mar 2018 18:14:46 +0000 (18:14 +0000)]
Set dso_local on external rtti GVs.

In this particular case it would be possible to just add an else with
CGM.setDSOLocal(GV), but it seems better to have as many callers as
possible just call setGVProperties so that we can centralize the logic
there.

This patch then makes setGVProperties able to handle null Decls.

llvm-svn: 327543

6 years agoError instead of producing broken binary.
Rafael Espindola [Wed, 14 Mar 2018 18:08:33 +0000 (18:08 +0000)]
Error instead of producing broken binary.

This "fixes" PR36678 by just producing an error when we find a case
where we would produce an plt entry that used ebx but ebx would not be
set.

llvm-svn: 327542

6 years ago[InstSimplify] [NFC] cast-unsigned-icmp-cmp-0.ll - don't run instcombine
Roman Lebedev [Wed, 14 Mar 2018 17:59:12 +0000 (17:59 +0000)]
[InstSimplify] [NFC] cast-unsigned-icmp-cmp-0.ll - don't run instcombine

As disscussed in post-commit review of D44421, there is simply
no reason to run instcombine on this testcase.

llvm-svn: 327541

6 years ago[X86] Add back fast-isel code for handling i8 shifts.
Craig Topper [Wed, 14 Mar 2018 17:57:19 +0000 (17:57 +0000)]
[X86] Add back fast-isel code for handling i8 shifts.

I removed this in r316797 because the coverage report showed no coverage and I thought it should have been handled by the auto generated table. I now see that there is code that bypasses the table if the shift amount is out of bounds.

This adds back the code. We'll codegen out of bounds i8 shifts to effectively (amount & 0x1f). The 0x1f is a strange quirk of x86 that shift amounts are always masked to 5-bits(except 64-bits). So if the masked value is still out bounds the result will be 0.

Fixes PR36731.

llvm-svn: 327540

6 years ago[clangd] Fix indentation in the comment. NFC
Ilya Biryukov [Wed, 14 Mar 2018 17:49:19 +0000 (17:49 +0000)]
[clangd] Fix indentation in the comment. NFC

llvm-svn: 327539

6 years agoFix LLVM IR check lines in utils/update_cc_test_checks.py
Fangrui Song [Wed, 14 Mar 2018 17:47:07 +0000 (17:47 +0000)]
Fix LLVM IR check lines in utils/update_cc_test_checks.py

Reviewers: arichardson

Subscribers: llvm-commits

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

llvm-svn: 327538

6 years ago[clangd] Don't expose vfs in TUScheduler::runWithPreamble.
Ilya Biryukov [Wed, 14 Mar 2018 17:46:52 +0000 (17:46 +0000)]
[clangd] Don't expose vfs in TUScheduler::runWithPreamble.

Summary:
It was previously an easy way to concurrently access a mutable vfs,
which is a recipe for disaster.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 327537

6 years agoReduce code duplication a bit.
Rafael Espindola [Wed, 14 Mar 2018 17:41:34 +0000 (17:41 +0000)]
Reduce code duplication a bit.

The code for computing the offset of an entry in the plt is simple,
but it was duplicated in quite a few places.

llvm-svn: 327536

6 years ago[InstSimplify] [NFC] Add tests for peeking through unsigned FP casts for sign compare...
Roman Lebedev [Wed, 14 Mar 2018 17:31:08 +0000 (17:31 +0000)]
[InstSimplify] [NFC] Add tests for peeking through unsigned FP casts for sign compares (PR36682)

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

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 `uitofp`+`bitcast`+`icmp` can be evaluated to a boolean:
* `slt 0`
* `sgt -1`
I did not check vectors, but i'm guessing it's the same there.
{F5889242}

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.

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

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

llvm-svn: 327535

6 years ago[InstCombine] [NFC] Add tests for peeking through unsigned FP casts for zero-equality...
Roman Lebedev [Wed, 14 Mar 2018 17:31:03 +0000 (17:31 +0000)]
[InstCombine] [NFC] Add tests for peeking through unsigned FP casts for zero-equality compares (PR36682)

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

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 `uitofp`+`bitcast` can be dropped:
* `eq 0`
* `ne 0`
I did not check vectors, but i'm guessing it's the same there.
{F5889189}

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
{F5889196}

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

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

llvm-svn: 327534

6 years ago[AArch64] Keep track of MIFlags in the LoadStoreOptimizer
Francis Visoiu Mistrih [Wed, 14 Mar 2018 17:10:58 +0000 (17:10 +0000)]
[AArch64] Keep track of MIFlags in the LoadStoreOptimizer

Merging:

* $x26, $x25 = frame-setup LDPXi $sp, 0
* $sp = frame-destroy ADDXri $sp, 64, 0

into an LDPXpost should preserve the flags from both instructions as
following:

* frame-setup frame-destroy LDPXpost

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

llvm-svn: 327533