platform/upstream/llvm.git
5 years ago[MCA][Scheduler] Improved critical memory dependency computation.
Andrea Di Biagio [Sun, 26 May 2019 19:50:31 +0000 (19:50 +0000)]
[MCA][Scheduler] Improved critical memory dependency computation.

This fixes a problem where back-pressure increases caused by register
dependencies were not correctly notified if execution was also delayed by memory
dependencies.

llvm-svn: 361740

5 years ago[SelectionDAG] GetDemandedBits - cleanup to more closely match SimplifyDemandedBits...
Simon Pilgrim [Sun, 26 May 2019 18:58:14 +0000 (18:58 +0000)]
[SelectionDAG] GetDemandedBits - cleanup to more closely match SimplifyDemandedBits. NFCI.

Prep work before adding demanded elts support.

llvm-svn: 361739

5 years ago[SelectionDAG] MaskedValueIsZero - add demanded elements implementation
Simon Pilgrim [Sun, 26 May 2019 18:43:44 +0000 (18:43 +0000)]
[SelectionDAG] MaskedValueIsZero - add demanded elements implementation

Will be used in an upcoming patch but I've updated the original implementation to call this to ensure test coverage.

llvm-svn: 361738

5 years ago[MCA] Refactor the logic that computes the critical memory dependency info. NFCI
Andrea Di Biagio [Sun, 26 May 2019 18:41:35 +0000 (18:41 +0000)]
[MCA] Refactor the logic that computes the critical memory dependency info. NFCI

CriticalRegDep has been renamed CriticalDependency, and it is now used by class
Instruction to store information about the critical register dependency and the
critical memory dependency. No functional change intendend.

llvm-svn: 361737

5 years ago[SimplifyCFG] back out all SwitchInst commits
Shawn Landden [Sun, 26 May 2019 18:15:51 +0000 (18:15 +0000)]
[SimplifyCFG] back out all SwitchInst commits

They caused the sanitizer builds to fail.

My suspicion is the change the countLeadingZeros().

llvm-svn: 361736

5 years agoDeleteNullPointerCheck now deletes until the end brace of the condition.
Mads Ravn [Sun, 26 May 2019 17:00:38 +0000 (17:00 +0000)]
DeleteNullPointerCheck now deletes until the end brace of the condition.

Patch by Jonathan Camilleri

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

llvm-svn: 361735

5 years ago[X86][SSE] Add shuffle combining support for ISD::ANY_EXTEND_VECTOR_INREG
Simon Pilgrim [Sun, 26 May 2019 16:00:35 +0000 (16:00 +0000)]
[X86][SSE] Add shuffle combining support for ISD::ANY_EXTEND_VECTOR_INREG

Reuses what we already have in place for ISD::ZERO_EXTEND_VECTOR_INREG just with a different sentinel

llvm-svn: 361734

5 years ago[SimplifyCFG] NFC, one more fixed test from previous push.
Shawn Landden [Sun, 26 May 2019 15:29:10 +0000 (15:29 +0000)]
[SimplifyCFG] NFC, one more fixed test from previous push.

The old test was checking for a stupid subtract one that is a transform that
makes the code woorse.

The constant-islands-jump-table.ll test wants the code a specific way,
that makes sense, so I will submit code to fix that one.

Sorry that I really didn't know how to run the test suite before this.

llvm-svn: 361733

5 years agoRevert rL361731 : [LLParser] Fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 26 May 2019 15:08:45 +0000 (15:08 +0000)]
Revert rL361731 : [LLParser] Fix uninitialized variable warnings. NFCI.

These 3 variables cause quite a few warnings in the scan-build report on llvm.
........
Revert accidental commit.

llvm-svn: 361732

5 years ago[LLParser] Fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 26 May 2019 15:05:12 +0000 (15:05 +0000)]
[LLParser] Fix uninitialized variable warnings. NFCI.

These 3 variables cause quite a few warnings in the scan-build report on llvm.

llvm-svn: 361731

5 years ago[SimplifyCFG] NFC, fix failing tests from last patches.
Shawn Landden [Sun, 26 May 2019 14:44:14 +0000 (14:44 +0000)]
[SimplifyCFG] NFC, fix failing tests from last patches.

No problems with the transforms.

llvm-svn: 361730

5 years ago[InstCombine] prevent crashing with invalid extractelement index
Sanjay Patel [Sun, 26 May 2019 14:03:50 +0000 (14:03 +0000)]
[InstCombine] prevent crashing with invalid extractelement index

This was found/reduced from a fuzzer report:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14956

llvm-svn: 361729

5 years ago[SimplifyCFG] ReduceSwitchRange: Improve on the case where the SubThreshold doesn...
Shawn Landden [Sun, 26 May 2019 13:55:52 +0000 (13:55 +0000)]
[SimplifyCFG] ReduceSwitchRange: Improve on the case where the SubThreshold doesn't trigger

llvm-svn: 361728

5 years ago[SimplifyCFG] Run ReduceSwitchRange unconditionally, generalize
Shawn Landden [Sun, 26 May 2019 13:55:14 +0000 (13:55 +0000)]
[SimplifyCFG] Run ReduceSwitchRange unconditionally, generalize

Rather than gating on "isSwitchDense" (resulting in necessesarily
sparse lookup tables even when they were generated), always run
this quite cheap transform.

This transform is useful not just for generating tables.
LowerSwitch also wants this: read LowerSwitch.cpp:257.

Be careful to not generate worse code, by introducing a
SubThreshold heuristic.

Instead of just sorting by signed, generalize the finding of the
best base.

And now that it is run unconditionally, do not replicate its
functionality in SwitchToLookupTable (which could use a Sub
when having a hole is smaller, hence the SubThreshold
heuristic located in a single place).
This simplifies SwitchToLookupTable, and fixes
some ugly corner cases due to the use of signed numbers,
such as a table containing i16 32768 and 32769, of which
32769 would be interpreted as -32768, and now the code thinks
the table is size 65536.

(We still use unconditional subtraction when building a single-register mask,
but I think this whole block should go when the more general sparse
map is added, which doesn't leave empty holes in the table.)

And the reason test4 and test5 did not trigger was documented wrong:
it was because they were not considered sufficiently "dense".

Also, fix generation of invalid LLVM-IR: shl by bit-width.

llvm-svn: 361727

5 years ago[SimpligyCFG] NFC, remove GCD that was only used for powers of two
Shawn Landden [Sun, 26 May 2019 13:54:04 +0000 (13:54 +0000)]
[SimpligyCFG] NFC, remove GCD that was only used for powers of two

and replace with an equilivent countTrailingZeros.

GCD is much more expensive than this, with repeated division.

This depends on D60823

llvm-svn: 361726

5 years ago[SimplifyCFG] NFC, update Switch tests to HEAD so I can see if my changes change...
Shawn Landden [Sun, 26 May 2019 13:52:41 +0000 (13:52 +0000)]
[SimplifyCFG] NFC, update Switch tests to HEAD so I can see if my changes change anything

Also add baseline tests to show effect of later patches.

llvm-svn: 361725

5 years ago[Support] make countLeadingZeros() and countTrailingZeros() return unsigned
Shawn Landden [Sun, 26 May 2019 13:49:58 +0000 (13:49 +0000)]
[Support] make countLeadingZeros() and countTrailingZeros() return unsigned

This matches countLeadingOnes() and countTrailingOnes(), and
APInt's countLeadingZeros() and countTrailingZeros().

(as well as __builtin_clzll())

llvm-svn: 361724

5 years ago[ValueTracking] Base computeOverflowForUnsignedMul() on ConstantRange code; NFCI
Nikita Popov [Sun, 26 May 2019 13:22:01 +0000 (13:22 +0000)]
[ValueTracking] Base computeOverflowForUnsignedMul() on ConstantRange code; NFCI

The implementation in ValueTracking and ConstantRange are equally
powerful, reuse the one in ConstantRange, which will make this easier
to extend.

llvm-svn: 361723

5 years agogn build: Merge r361664
Nico Weber [Sun, 26 May 2019 13:06:48 +0000 (13:06 +0000)]
gn build: Merge r361664

llvm-svn: 361722

5 years ago[InstCombine] Refactor OptimizeOverflowCheck; NFCI
Nikita Popov [Sun, 26 May 2019 11:43:37 +0000 (11:43 +0000)]
[InstCombine] Refactor OptimizeOverflowCheck; NFCI

Extract method to compute overflow based on binop and signedness,
and then make the result handling code generic. This extends the
always-overflow handling to signed muls, but has currently no effect,
as we don't compute always overflow for them (thus NFC).

llvm-svn: 361721

5 years ago[InstCombine] Remove OverflowCheckFlavor; NFC
Nikita Popov [Sun, 26 May 2019 11:43:31 +0000 (11:43 +0000)]
[InstCombine] Remove OverflowCheckFlavor; NFC

Instead pass binary op and signedness. The extra enum only makes
things more complicated in this case.

llvm-svn: 361720

5 years ago[ARM] Select fp16 fma
David Green [Sun, 26 May 2019 11:34:30 +0000 (11:34 +0000)]
[ARM] Select fp16 fma

This adds a pattern for fma, similar to the float and double patterns.

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

llvm-svn: 361719

5 years ago[ARM] Select a number of fp16 rounding functions
David Green [Sun, 26 May 2019 11:13:00 +0000 (11:13 +0000)]
[ARM] Select a number of fp16 rounding functions

This add patterns for fp16 round and ceil etc. Same as the float and double
patterns.

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

llvm-svn: 361718

5 years ago[ARM] Promote various fp16 math intrinsics
David Green [Sun, 26 May 2019 10:59:21 +0000 (10:59 +0000)]
[ARM] Promote various fp16 math intrinsics

Promote a number of fp16 math intrinsics to float, so that the relevant float
math routines can be used. Copysign is expanded so as to be handled in-place.

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

llvm-svn: 361717

5 years ago[X86][AVX] combineBitcastvxi1 - peek through bitops to determine size of original...
Simon Pilgrim [Sun, 26 May 2019 10:54:23 +0000 (10:54 +0000)]
[X86][AVX] combineBitcastvxi1 - peek through bitops to determine size of original vector

We were only testing for direct SETCC results - this allows us to peek through AND/OR/XOR combinations of the comparison results as well.

There's a missing SEXT(PACKSS) fold that I need to investigate for v8i1 cases before I can enable it there as well.

llvm-svn: 361716

5 years ago[ARM] Select fp16 fabs
David Green [Sun, 26 May 2019 10:51:58 +0000 (10:51 +0000)]
[ARM] Select fp16 fabs

This adds a pattern for the fabs intrinsic, the same as float and double.

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

llvm-svn: 361715

5 years ago[ARM] Select fp16 fsqrt
David Green [Sun, 26 May 2019 10:42:24 +0000 (10:42 +0000)]
[ARM] Select fp16 fsqrt

This adds a pattern for the sqrt intrinsic, the same as float and double.

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

llvm-svn: 361714

5 years ago[ARM] Promote fp16 frem
David Green [Sun, 26 May 2019 10:30:22 +0000 (10:30 +0000)]
[ARM] Promote fp16 frem

Promote fp16 frem operations on ARM to floats so they call fmodf.

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

llvm-svn: 361713

5 years ago[ARM] Add some base fullfp16 tests. NFC
David Green [Sun, 26 May 2019 10:06:40 +0000 (10:06 +0000)]
[ARM] Add some base fullfp16 tests. NFC

llvm-svn: 361712

5 years ago[PowerPC] Add missing R_PPC_* relocation types
Fangrui Song [Sun, 26 May 2019 08:31:00 +0000 (08:31 +0000)]
[PowerPC] Add missing R_PPC_* relocation types

While people mostly care about 64-bit, some systems need basic lib32
support. The plan is to make lld (see PR40888) capable of linking some
applications (PR40888).

llvm-svn: 361711

5 years ago[Driver][RISCV] Simplify. NFC
Fangrui Song [Sun, 26 May 2019 07:43:45 +0000 (07:43 +0000)]
[Driver][RISCV] Simplify. NFC

llvm-svn: 361710

5 years ago[Driver] Update handling of c++ and runtime directories
Petr Hosek [Sun, 26 May 2019 03:39:07 +0000 (03:39 +0000)]
[Driver] Update handling of c++ and runtime directories

This is a follow up to r361432 and r361504 which addresses issues
introduced by those changes. Specifically, it avoids duplicating
file and runtime paths in case when the effective triple is the
same as the cannonical one. Furthermore, it fixes the broken multilib
setup in the Fuchsia driver and deduplicates some of the code.

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

llvm-svn: 361709

5 years agoAdd missing newline at end of file
Duncan P. N. Exon Smith [Sat, 25 May 2019 22:38:02 +0000 (22:38 +0000)]
Add missing newline at end of file

llvm-svn: 361708

5 years ago[SimplifyCFG] Added condition assumption for unreachable blocks
David Bolvansky [Sat, 25 May 2019 22:34:27 +0000 (22:34 +0000)]
[SimplifyCFG] Added condition assumption for unreachable blocks

Summary: PR41688

Reviewers: spatel, efriedma, craig.topper, hfinkel, reames

Reviewed By: hfinkel

Subscribers: javed.absar, dmgreen, fhahn, hfinkel, reames, nikic, lebedev.ri, llvm-commits

Tags: #llvm

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

llvm-svn: 361707

5 years ago[X86] lowerBuildVectorToBitOp - support build_vector(shift()) -> shift(build_vector...
Simon Pilgrim [Sat, 25 May 2019 18:02:17 +0000 (18:02 +0000)]
[X86] lowerBuildVectorToBitOp - support build_vector(shift()) -> shift(build_vector(),C)

Commonly occurs in sign-extension cases

llvm-svn: 361706

5 years ago[LLVM-C] Add Accessor for Mach-O Universal Binary Slices
Robert Widmann [Sat, 25 May 2019 16:47:27 +0000 (16:47 +0000)]
[LLVM-C] Add Accessor for Mach-O Universal Binary Slices

Summary: Allow for retrieving an object file corresponding to an architecture-specific slice in a Mach-O universal binary file.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 361705

5 years ago[X86] Combine fminnum/fmaxnum with non-nan operand to fmin/fmax
Nikita Popov [Sat, 25 May 2019 16:44:29 +0000 (16:44 +0000)]
[X86] Combine fminnum/fmaxnum with non-nan operand to fmin/fmax

If we have a known non-nan operand, place it in the second operand
of fmin/fmax that is returned if either operand is nan.

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

llvm-svn: 361704

5 years ago[LVI][CVP] Add support for saturating add/sub
Nikita Popov [Sat, 25 May 2019 16:44:14 +0000 (16:44 +0000)]
[LVI][CVP] Add support for saturating add/sub

Adds support for the uadd.sat family of intrinsics in LVI, based on
ConstantRange methods from D60946.

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

llvm-svn: 361703

5 years ago[X86][SSE] vector-sext - cleanup prefix lists
Simon Pilgrim [Sat, 25 May 2019 16:33:17 +0000 (16:33 +0000)]
[X86][SSE] vector-sext - cleanup prefix lists

Add X32-SSE common prefix to merge some checks

llvm-svn: 361702

5 years ago[SelectionDAG] define binops as a superset of commutative binops
Sanjay Patel [Sat, 25 May 2019 15:28:55 +0000 (15:28 +0000)]
[SelectionDAG] define binops as a superset of commutative binops

The test diffs show improved vector narrowing for integer min/max opcodes because
those were all absent from the list. I'm not sure if we can expose functional diffs
for all of the moved/added opcodes though.

It seems like we are missing an AVX512 opportunity to use 256-bit ops in place of
512-bit ops on some tests/targets, but I think that can be a follow-up.

Preliminary steps to make sure the callers are not misusing these queries:
rL361268
rL361547

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

llvm-svn: 361701

5 years ago[X86] Add tests for min/maxnum with const operand; NFC
Nikita Popov [Sat, 25 May 2019 15:06:54 +0000 (15:06 +0000)]
[X86] Add tests for min/maxnum with const operand; NFC

llvm-svn: 361700

5 years ago[LoopVectorize] Fix test by regenerating checks
Nikita Popov [Sat, 25 May 2019 14:33:30 +0000 (14:33 +0000)]
[LoopVectorize] Fix test by regenerating checks

llvm-svn: 361699

5 years ago[CVP] Remove unnecessary checks for empty GNWR; NFC
Nikita Popov [Sat, 25 May 2019 14:11:55 +0000 (14:11 +0000)]
[CVP] Remove unnecessary checks for empty GNWR; NFC

The guaranteed no-wrap region is never empty, it always contains at
least zero, so these optimizations don't ever apply.

To make this more obviously true, replace the conversative return
in makeGNWR with an assertion.

llvm-svn: 361698

5 years ago[NFC] Make tests more robust for new optimizations
David Bolvansky [Sat, 25 May 2019 14:10:20 +0000 (14:10 +0000)]
[NFC] Make tests more robust for new optimizations

llvm-svn: 361697

5 years ago[SelectionDAG] soften assertion when legalizing narrow vector FP ops
Sanjay Patel [Sat, 25 May 2019 13:48:07 +0000 (13:48 +0000)]
[SelectionDAG] soften assertion when legalizing narrow vector FP ops

The test based on PR42010:
https://bugs.llvm.org/show_bug.cgi?id=42010
...may show an inaccuracy for PPC's target defs, but we should not
be so aggressive with an assert here. There's no telling what out-of-tree
targets look like.

llvm-svn: 361696

5 years ago[NFC] Update test checks
David Bolvansky [Sat, 25 May 2019 13:11:22 +0000 (13:11 +0000)]
[NFC] Update test checks

llvm-svn: 361695

5 years ago[CVP] Add tests for saturating add/sub ranges; NFC
Nikita Popov [Sat, 25 May 2019 09:53:51 +0000 (09:53 +0000)]
[CVP] Add tests for saturating add/sub ranges; NFC

llvm-svn: 361694

5 years ago[LVI][CVP] Calculate with.overflow result range
Nikita Popov [Sat, 25 May 2019 09:53:45 +0000 (09:53 +0000)]
[LVI][CVP] Calculate with.overflow result range

In LVI, calculate the range of extractvalue(op.with.overflow(%x, %y), 0)
as the range of op(%x, %y). This is mainly useful in conjunction with
D60650: If the result of the operation is extracted in a branch guarded
against overflow, then the value of %x will be appropriately constrained
and the result range of the operation will be calculated taking that
into account.

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

llvm-svn: 361693

5 years ago[LVI] Extract helper for binary range calculations; NFC
Nikita Popov [Sat, 25 May 2019 09:53:37 +0000 (09:53 +0000)]
[LVI] Extract helper for binary range calculations; NFC

llvm-svn: 361692

5 years ago[X86FixupLEAs] Turn optIncDec into a generic two address LEA optimizer. Support LEA64...
Craig Topper [Sat, 25 May 2019 06:17:47 +0000 (06:17 +0000)]
[X86FixupLEAs] Turn optIncDec into a generic two address LEA optimizer. Support LEA64_32r properly.

INC/DEC is really a special case of a more generic issue. We should also turn leas into add reg/reg or add reg/imm regardless of the slow lea flags.

This also supports LEA64_32 which has 64 bit input registers and 32 bit output registers. So we need to convert the 64 bit inputs to their 32 bit equivalents to check if they are equal to base reg.

One thing to note, the original code preserved the kill flags by adding operands to the new instruction instead of using addReg. But I think tied operands aren't supposed to have the kill flag set. I dropped the kill flags, but I could probably try to preserve it in the add reg/reg case if we think its important. Not sure which operand its supposed to go on for the LEA64_32r instruction due to the super reg implicit uses. Though I'm also not sure those are needed since they were probably just created by an INSERT_SUBREG from a 32-bit input.

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

llvm-svn: 361691

5 years ago[X86] Add zero idioms to the haswell, broadwell, and skylake schedule models. Add...
Craig Topper [Sat, 25 May 2019 04:47:49 +0000 (04:47 +0000)]
[X86] Add zero idioms to the haswell, broadwell, and skylake schedule models. Add 256-bit fp xor to sandybridge zero idioms

This copies the Sandy Bridge zero idiom support to later CPUs. Adding the AVX2 and AVX512F/VL instructions as appropriate.

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

llvm-svn: 361690

5 years ago[X86][llvm-mca] Add zero idiom tests for Intel CPUs. NFC
Craig Topper [Sat, 25 May 2019 04:47:42 +0000 (04:47 +0000)]
[X86][llvm-mca] Add zero idiom tests for Intel CPUs. NFC

This pre-commits tests for D62360

llvm-svn: 361689

5 years agoRevert r361644, "[AMDGPU] Divergence driven ISel. Assign register class for cross...
Peter Collingbourne [Sat, 25 May 2019 01:52:38 +0000 (01:52 +0000)]
Revert r361644, "[AMDGPU] Divergence driven ISel. Assign register class for cross block values according to the divergence."

Broke sanitizer bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/21694/steps/bootstrap%20clang/logs/stdio
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32478/steps/check-llvm%20asan/logs/stdio

llvm-svn: 361688

5 years ago[clangd] tweaks: Add clangBasic dependency to LINK_LIBS
Heejin Ahn [Sat, 25 May 2019 01:35:14 +0000 (01:35 +0000)]
[clangd] tweaks: Add clangBasic dependency to LINK_LIBS

This is necessary to make builds with `-DBUILD_SHARED_LIBS=ON` work.

llvm-svn: 361687

5 years agoPermit static local structured bindings to be named from arbitrary scopes inside...
Richard Smith [Sat, 25 May 2019 01:04:17 +0000 (01:04 +0000)]
Permit static local structured bindings to be named from arbitrary scopes inside their declaring scope.

llvm-svn: 361686

5 years agoRevert "[Analysis] Link library dependencies to Analysis plugins"
Akira Hatanaka [Sat, 25 May 2019 00:50:03 +0000 (00:50 +0000)]
Revert "[Analysis] Link library dependencies to Analysis plugins"

This reverts commit r361340. The following builder has been broken for
the past few days because of this commit:

http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/

Also revert r361399, which was committed to fix r361340.

llvm-svn: 361685

5 years agoRename clangToolingRefactor to clangToolingRefactoring for consistency with its directory
Nico Weber [Sat, 25 May 2019 00:27:19 +0000 (00:27 +0000)]
Rename clangToolingRefactor to clangToolingRefactoring for consistency with its directory

See "[cfe-dev] The name of clang/lib/Tooling/Refactoring".

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

llvm-svn: 361684

5 years agollvm-dwarfdump: Don't error on mixed units using/not using str_offsets
David Blaikie [Sat, 25 May 2019 00:07:22 +0000 (00:07 +0000)]
llvm-dwarfdump: Don't error on mixed units using/not using str_offsets

This lead to errors when dumping binaries with v4 and v5 units linked
together (but could've also errored on v5 units that did/didn't use
str_offsets).

Also improves error handling and messages around invalid str_offsets
contributions.

llvm-svn: 361683

5 years ago[analyzer] Add a prunable note for skipping vbase inits in subclasses.
Artem Dergachev [Fri, 24 May 2019 23:37:11 +0000 (23:37 +0000)]
[analyzer] Add a prunable note for skipping vbase inits in subclasses.

When initialization of virtual base classes is skipped, we now tell the user
about it, because this aspect of C++ isn't very well-known.

The implementation is based on the new "note tags" feature (r358781).
In order to make use of it, allow note tags to produce prunable notes,
and move the note tag factory to CoreEngine.

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

llvm-svn: 361682

5 years ago[CFG] Add branch to skip vbase inits when they're handled by superclass.
Artem Dergachev [Fri, 24 May 2019 23:37:08 +0000 (23:37 +0000)]
[CFG] Add branch to skip vbase inits when they're handled by superclass.

This patch adds the run-time CFG branch that would skip initialization of
virtual base classes depending on whether the constructor is called from a
superclass constructor or not. Previously the Static Analyzer was already
skipping virtual base-class initializers in such constructors, but it wasn't
skipping their arguments and their potential side effects, which was causing
pr41300 (and was generally incorrect). The previous skipping behavior is
now replaced with a hard assertion that we're not even getting there due
to how our CFG works.

The new CFG element is under a CFG build option so that not to break other
consumers of the CFG by this change. Static Analyzer support for this change
is implemented.

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

llvm-svn: 361681

5 years agoFix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.
Richard Smith [Fri, 24 May 2019 23:26:07 +0000 (23:26 +0000)]
Fix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.

The assertion in setConfig read from the (uninitialized) CONFIG
expression.

llvm-svn: 361680

5 years ago[GlobalISel][AArch64] Make FP constraint checks consider possible use/def banks
Jessica Paquette [Fri, 24 May 2019 23:08:45 +0000 (23:08 +0000)]
[GlobalISel][AArch64] Make FP constraint checks consider possible use/def banks

In a few places in getInstrMapping, we check if use/def instructions for the
instruction we're mapping have floating point constraints.

We can improve this check and reduce the number of copies in GISel-compiled code
if we make a couple observations:

- For a def instruction, it only matters if the def instruction must always
  output a value stored on a FPR

- For a use instruction, it only matters if the use instruction must always
  only take in values stored in FPRs

This adds two new functions:

- onlyUsesFP
- onlyDefinesFP

Then we can use those when we're checking the uses/defs instead.

Without this patch, the load, unmerge, store, and select in the added test
would have unnecessary copies.

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

llvm-svn: 361679

5 years ago[WebAssembly] Relax signature checking for undefined functions that are not called...
Sam Clegg [Fri, 24 May 2019 22:45:08 +0000 (22:45 +0000)]
[WebAssembly] Relax signature checking for undefined functions that are not called directly

When function signatures don't match and the undefined function is not
called directly (i.e. only has its address taken) we don't issue a
warning or create a runtime thunk for the undefined function.

Instead in this case we simply use the defined version of the function.
This is possible since checking signatures of dynamic calls happens
at runtime so any invalid usage will still result in a runtime error.

This is needed to allow C++ programs to link without generating
warnings.  Its not uncommon in C++ for vtables to be populated by
function address whee the signature of the function is not known in the
compilation unit.  In this case clang declares the method as void(void)
and relies on the vtable caller casting the data back to the correct
signature.

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

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

llvm-svn: 361678

5 years ago[GlobalISel][AArch64] NFC: Factor out HasFPConstraints into a proper function
Jessica Paquette [Fri, 24 May 2019 22:12:21 +0000 (22:12 +0000)]
[GlobalISel][AArch64] NFC: Factor out HasFPConstraints into a proper function

Factor it out into a function, and replace places where we had the same check
with the new function.

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

llvm-svn: 361677

5 years agoRevert Xcode scheme changes from 361675
Greg Clayton [Fri, 24 May 2019 22:12:01 +0000 (22:12 +0000)]
Revert Xcode scheme changes from 361675

llvm-svn: 361676

5 years agoCleanup fixed form sizes.
Greg Clayton [Fri, 24 May 2019 22:08:50 +0000 (22:08 +0000)]
Cleanup fixed form sizes.

The fix form sizes use to have two arrays: one for 4 byte addresses and in for 8 byte addresses. The table had an issue where DW_FORM_flag_present wasn't being represented as a fixed size form because its actual size _is_ zero and zero was used to indicate the form isn't fixed in size. Any code that needed to quickly access the DWARF had to get a FixedFormSizes instance using the address byte size.

This fix cleans things up by adding a DWARFFormValue::GetFixedSize() both as a static method and as a member function on DWARFFormValue. It correctly can indicate if a form size is zero. This cleanup is a precursor to a follow up patch where I hope to speed up DWARF parsing.

I verified performance doesn't regress by loading hundreds of DWARF files and setting a breakpoint by file and line and by name in files that do not have DWARF indexes. Performance remained consistent between the two approaches.

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

llvm-svn: 361675

5 years agoMark tests as x86.
Alina Sbirlea [Fri, 24 May 2019 21:49:27 +0000 (21:49 +0000)]
Mark tests as x86.

llvm-svn: 361674

5 years ago[Target] Make Processes' GetLanguageRuntime non-virtual
Alex Langford [Fri, 24 May 2019 21:27:37 +0000 (21:27 +0000)]
[Target] Make Processes' GetLanguageRuntime non-virtual

llvm-svn: 361673

5 years ago[DWARFExpression] Remove commented-out code (NFC)
Jonas Devlieghere [Fri, 24 May 2019 21:26:30 +0000 (21:26 +0000)]
[DWARFExpression] Remove commented-out code (NFC)

llvm-svn: 361672

5 years ago[dwarfdump] Add flag to limit the number of parents DIEs
Jonas Devlieghere [Fri, 24 May 2019 21:11:28 +0000 (21:11 +0000)]
[dwarfdump] Add flag to limit the number of parents DIEs

This adds `-parent-recurse-depth` which limits the number of parent DIEs
being dumped.

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

llvm-svn: 361671

5 years agoDefault arguments are potentially constant evaluated.
Richard Smith [Fri, 24 May 2019 21:08:12 +0000 (21:08 +0000)]
Default arguments are potentially constant evaluated.

We need to eagerly instantiate constexpr functions used in them even if
the default argument is never actually used, because we might evaluate
portions of it when performing semantic checks.

llvm-svn: 361670

5 years agoImplement call lowering without parameters on AIX
Jason Liu [Fri, 24 May 2019 20:54:35 +0000 (20:54 +0000)]
Implement call lowering without parameters on AIX

Summary:dd
This patch implements call lowering for calls without parameters
on AIX as initial support.

Reviewers: sfertile, hubert.reinterpretcast, aheejin, efriedma

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

llvm-svn: 361669

5 years agoRefactor use-marking to better match standard terminology. No
Richard Smith [Fri, 24 May 2019 20:42:25 +0000 (20:42 +0000)]
Refactor use-marking to better match standard terminology. No
functionality change intended.

llvm-svn: 361668

5 years ago[COFF] De-virtualize Chunk and SectionChunk
Reid Kleckner [Fri, 24 May 2019 20:25:40 +0000 (20:25 +0000)]
[COFF] De-virtualize Chunk and SectionChunk

Shaves another pointer off of SectionChunk, reducing the size from 96 to
88 bytes, down from 144 before I started working on this. Combined with
D62356, this reduced peak memory usage when linking chrome_child.dll
from 713MB to 675MB, or 5%.

Create NonSectionChunk to provide virtual dispatch to the rest of the
chunk types.

Reviewers: ruiu, aganea

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

llvm-svn: 361667

5 years ago[Process] Clean up some logic around LanguageRuntimes
Alex Langford [Fri, 24 May 2019 19:39:50 +0000 (19:39 +0000)]
[Process] Clean up some logic around LanguageRuntimes

llvm-svn: 361666

5 years ago[GlobalISel][AArch64] Improve register bank mappings for G_SELECT
Jessica Paquette [Fri, 24 May 2019 19:35:25 +0000 (19:35 +0000)]
[GlobalISel][AArch64] Improve register bank mappings for G_SELECT

The fcsel and csel instructions differ in only the register banks they work on.

So, they're entirely interchangeable otherwise.

With this in mind, this does two things:

- Teach AArch64RegisterBankInfo to consider the inputs to G_SELECT as well as
  the outputs.
- Teach it to choose the best register bank mapping based off the constraints
  of the inputs and outputs.

The "best" in this case means the one that requires the smallest number of
copies to properly emit a fcsel/csel.

For example, if the inputs are all already going to be on FPRs, we should
emit a fcsel, even if the output is a GPR. This costs one copy to produce the
result, but saves us from copying the inputs into GPRs.

Also update the regbank-select.mir to check that we end up with the right
select instruction.

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

llvm-svn: 361665

5 years ago[Analyzer] Checker for non-determinism caused by iteration of unordered container...
Mandeep Singh Grang [Fri, 24 May 2019 19:24:08 +0000 (19:24 +0000)]
[Analyzer] Checker for non-determinism caused by iteration of unordered container of pointers

Summary: Added a checker for non-determinism caused by iterating unordered containers like std::unordered_set containing pointer elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus, baloghadamsoftware

Reviewed By: Szelethus

Subscribers: mgorny, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits

Tags: #clang

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

llvm-svn: 361664

5 years ago[cmake] Remove old unused version of FindZ3.cmake from clang [NFC]
Don Hinton [Fri, 24 May 2019 19:21:21 +0000 (19:21 +0000)]
[cmake] Remove old unused version of FindZ3.cmake from clang [NFC]

Summary: This file was moved to llvm in D54978, r356929, but the old
file was never removed.

Reviewed By: beanz

Tags: #clang

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

llvm-svn: 361663

5 years agoAdding an explicit triple to this test to appease build bots.
Aaron Ballman [Fri, 24 May 2019 19:19:00 +0000 (19:19 +0000)]
Adding an explicit triple to this test to appease build bots.

llvm-svn: 361662

5 years ago[AArch64] check for INLINEASM_BR along w/ INLINEASM
Nick Desaulniers [Fri, 24 May 2019 19:00:13 +0000 (19:00 +0000)]
[AArch64] check for INLINEASM_BR along w/ INLINEASM

Summary:
It looks like since INLINEASM_BR was created off of INLINEASM, a few
checks for INLINEASM needed to be updated to check for either case.

pr/41999

Reviewers: t.p.northover, peter.smith

Reviewed By: peter.smith

Subscribers: craig.topper, javed.absar, kristof.beyls, hiraditya, llvm-commits, peter.smith, srhines

Tags: #llvm

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

llvm-svn: 361661

5 years agoAdd JSON dumping tests for ObjC statements; add support for dumping @catch catch...
Aaron Ballman [Fri, 24 May 2019 18:58:29 +0000 (18:58 +0000)]
Add JSON dumping tests for ObjC statements; add support for dumping @catch catch-all statements.

llvm-svn: 361660

5 years ago[ARM] additionally check for ARM::INLINEASM_BR w/ ARM::INLINEASM
Nick Desaulniers [Fri, 24 May 2019 18:58:21 +0000 (18:58 +0000)]
[ARM] additionally check for ARM::INLINEASM_BR w/ ARM::INLINEASM

Summary:
We were observing failures for arm32 allyesconfigs of the Linux kernel
with the asm goto Clang patch, where ldr's were being generated to
offsets too far away to encode in imm12.

It looks like since INLINEASM_BR was created off of INLINEASM, a few
checks for INLINEASM needed to be updated to check for either case.

pr/41999

Link: https://github.com/ClangBuiltLinux/linux/issues/490
Reviewers: peter.smith, kristof.beyls, ostannard, rengolin, t.p.northover

Reviewed By: peter.smith

Subscribers: jyu2, javed.absar, hiraditya, llvm-commits, nathanchance, craig.topper, kees, srhines

Tags: #llvm

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

llvm-svn: 361659

5 years ago[OpenMP] Add test for requires and unified shared memory clause with declare target...
Gheorghe-Teodor Bercea [Fri, 24 May 2019 18:48:42 +0000 (18:48 +0000)]
[OpenMP] Add test for requires and unified shared memory clause with declare target link

Summary:
This patch adds a test for requires with unified share memory clause when a declare target link is present.

This test needs to go in prior to changes to declare target link for comparison purposes.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 361658

5 years ago[COFF] Replace OutputSection* with uint16_t index in Chunk
Reid Kleckner [Fri, 24 May 2019 18:25:49 +0000 (18:25 +0000)]
[COFF] Replace OutputSection* with uint16_t index in Chunk

Shaves another 8 bytes off of SectionChunk, the most commonly allocated
type in LLD.

These indices are only valid after we've assigned chunks to output
sections and removed empty sections, so do that in a new pass.

Reviewers: ruiu, aganea

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

llvm-svn: 361657

5 years agoAMDGPU: Activate all lanes when spilling CSR VGPR for SGPR spills
Matt Arsenault [Fri, 24 May 2019 18:18:51 +0000 (18:18 +0000)]
AMDGPU: Activate all lanes when spilling CSR VGPR for SGPR spills

If some lanes weren't active on entry to the function, this could
clobber their VGPR values.

llvm-svn: 361655

5 years ago[NewPassManager] Add tuning option: LoopUnrolling [clang-change]
Alina Sbirlea [Fri, 24 May 2019 17:40:52 +0000 (17:40 +0000)]
[NewPassManager] Add tuning option: LoopUnrolling [clang-change]

Summary:
Use CodeGenOpts's setting for loop unrolling.
[to be coupled with D61618]

Reviewers: chandlerc

Subscribers: jlebar, dmgreen, cfe-commits, llvm-commits

Tags: #clang

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

llvm-svn: 361653

5 years agoAdd support for dumping Objective C AST declaration nodes to JSON.
Aaron Ballman [Fri, 24 May 2019 17:39:55 +0000 (17:39 +0000)]
Add support for dumping Objective C AST declaration nodes to JSON.

llvm-svn: 361652

5 years ago[WebAssembly] Use "linker" as linker shortname.
Sam Clegg [Fri, 24 May 2019 17:36:07 +0000 (17:36 +0000)]
[WebAssembly] Use "linker" as linker shortname.

This is in line with other platforms.

Also, move the single statement methods into the header (also
in line with other platform).

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

llvm-svn: 361651

5 years ago[ASTImporter] Call to HandleNameConflict in VisitRecordDecl mistakeningly using Name...
Shafik Yaghmour [Fri, 24 May 2019 16:53:44 +0000 (16:53 +0000)]
[ASTImporter] Call to HandleNameConflict in VisitRecordDecl mistakeningly using Name instead of SearchName

Summary:
https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitRecordDecl for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via D->getTypedefNameForAnonDecl()->getDeclName().

This fix is very similar to https://reviews.llvm.org/D59665

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

llvm-svn: 361650

5 years agoAMDGPU: Boost inline threshold with addrspacecasted alloca arguments
Matt Arsenault [Fri, 24 May 2019 16:52:35 +0000 (16:52 +0000)]
AMDGPU: Boost inline threshold with addrspacecasted alloca arguments

This was skipping GetUnderlyingObject for nonprivate addresses, but an
alloca could also be found through an addrspacecast if it's flat.

llvm-svn: 361649

5 years ago[LoopVectorize] update test to be independent of instcombine; NFC
Sanjay Patel [Fri, 24 May 2019 16:46:09 +0000 (16:46 +0000)]
[LoopVectorize] update test to be independent of instcombine; NFC

This is a regression test for vectorization, so remove instcombine
from the RUN line and adjust the comparison predicates to show what
the vectorizer is creating rather than how instcombine cleans it up.

llvm-svn: 361648

5 years ago[clang-tidy] In TransformerClangTidyCheck, require Explanation field.
Yitzhak Mandelbaum [Fri, 24 May 2019 16:32:03 +0000 (16:32 +0000)]
[clang-tidy] In TransformerClangTidyCheck, require Explanation field.

Summary:
In general, the `Explanation` field is optional in `RewriteRule` cases. But,
because the primary purpose of clang-tidy checks is to provide users with
diagnostics, we assume that a missing explanation is a bug.  This change adds an
assertion that checks all cases for an explanation, and updates the code to rely
on that assertion correspondingly.

Reviewers: ilya-biryukov

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 361647

5 years ago[CMake] Fix issues building runtimes
Chris Bieneman [Fri, 24 May 2019 16:21:38 +0000 (16:21 +0000)]
[CMake] Fix issues building runtimes

This resolves two issues:
(1) LIBCXX_HEADER_DIR is a very misleadingly named variable because it shouldn't be set to the header directory, instead it needs to be the root binary dir.
(2) If you build runtimes without libcxx, we can't depend on the libcxx header target, so we should instaed refer to it by the variable name which will be unset if libcxx isn't present.

llvm-svn: 361646

5 years ago[CodeComplete] Add whitespace around braces in lambda completions
Ilya Biryukov [Fri, 24 May 2019 16:16:15 +0000 (16:16 +0000)]
[CodeComplete] Add whitespace around braces in lambda completions

This produces nicer output.
Trivial follow-up to r361461, so sending without review.

llvm-svn: 361645

5 years ago[AMDGPU] Divergence driven ISel. Assign register class for cross block values accordi...
Alexander Timofeev [Fri, 24 May 2019 15:32:18 +0000 (15:32 +0000)]
[AMDGPU] Divergence driven ISel. Assign register class for cross block values according to the divergence.

Details: To make instruction selection really divergence driven it is necessary to assign
         the correct register classes to the cross block values beforehand. For the divergent targets
         same value type requires different register classes dependent on the value divergence.

Reviewers: rampitec, nhaehnle

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

llvm-svn: 361644

5 years ago[LibTooling] Add Explanation parameter to `makeRule`.
Yitzhak Mandelbaum [Fri, 24 May 2019 15:11:45 +0000 (15:11 +0000)]
[LibTooling] Add Explanation parameter to `makeRule`.

Summary:
Conceptually, a single-case RewriteRule has a matcher, edit(s) and an (optional)
explanation. `makeRule` previously only took the matcher and edit(s). This
change adds (optional) support for the explanation.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361643

5 years ago[llvm-objcopy] - Strip undefined symbols if they are no longer referenced following...
George Rimar [Fri, 24 May 2019 15:04:50 +0000 (15:04 +0000)]
[llvm-objcopy] - Strip undefined symbols if they are no longer referenced following --only-section

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

In this patch I teach llvm-objcopy to remove undefined symbols if
them are not used anymore after applying -j/--only-section option.

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

llvm-svn: 361642

5 years ago[OpenCL] Add support for the cl_arm_integer_dot_product extensions
Kevin Petit [Fri, 24 May 2019 14:53:52 +0000 (14:53 +0000)]
[OpenCL] Add support for the cl_arm_integer_dot_product extensions

The specification is available in the Khronos OpenCL registry:

https://www.khronos.org/registry/OpenCL/extensions/arm/cl_arm_integer_dot_product.txt

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
llvm-svn: 361641

5 years agogn build: Merge r361607
Nico Weber [Fri, 24 May 2019 14:24:25 +0000 (14:24 +0000)]
gn build: Merge r361607

llvm-svn: 361640

5 years ago[WebAssebmly] Add support for --wrap
Sam Clegg [Fri, 24 May 2019 14:14:25 +0000 (14:14 +0000)]
[WebAssebmly] Add support for --wrap

The code for implementing this features is taken almost verbatim
from the ELF backend.

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

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

llvm-svn: 361639