platform/upstream/llvm.git
6 years agos/LLVM_ON_WIN32/_WIN32/, lld
Nico Weber [Tue, 10 Apr 2018 13:15:21 +0000 (13:15 +0000)]
s/LLVM_ON_WIN32/_WIN32/, lld

LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the
default macro instead of a reinvented one.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.

llvm-svn: 329696

6 years agos/LLVM_ON_WIN32/_WIN32/, clang-tools-extra
Nico Weber [Tue, 10 Apr 2018 13:14:03 +0000 (13:14 +0000)]
s/LLVM_ON_WIN32/_WIN32/, clang-tools-extra

LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the
default macro instead of a reinvented one.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.

llvm-svn: 329695

6 years ago[llvm-mca] Increase the default number of iterations to 100.
Andrea Di Biagio [Tue, 10 Apr 2018 12:50:03 +0000 (12:50 +0000)]
[llvm-mca] Increase the default number of iterations to 100.

llvm-svn: 329694

6 years agoThe test was fixed.
Andrew V. Tischenko [Tue, 10 Apr 2018 12:17:01 +0000 (12:17 +0000)]
The test was fixed.

llvm-svn: 329693

6 years ago[DA] Improve alias checking in dependence analysis
David Green [Tue, 10 Apr 2018 11:37:21 +0000 (11:37 +0000)]
[DA] Improve alias checking in dependence analysis

Improve the alias analysis to account for cases where we
know that src/dst pairs cannot alias due to things like
TBAA. As we know they are noalias, we know no dependency
can occur. Also fixes issues around the size parameter
to AA being incorrect.

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

llvm-svn: 329692

6 years ago[AArch64] Use FP to access the emergency spill slot
Francis Visoiu Mistrih [Tue, 10 Apr 2018 11:29:40 +0000 (11:29 +0000)]
[AArch64] Use FP to access the emergency spill slot

In the presence of variable-sized stack objects, we always picked the
base pointer when resolving frame indices if it was available.

This makes us hit an assert where we can't reach the emergency spill
slot if it's too far away from the base pointer. Since on AArch64 we
decide to place the emergency spill slot at the top of the frame, it
makes more sense to use FP to access it.

The changes here don't affect only emergency spill slots but all the
frame indices. The goal here is to try to choose between FP, BP and SP
so that we minimize the offset and avoid scavenging, or worse, asserting
when trying to access a slot allocated by the scavenger.

Previously discussed here: https://reviews.llvm.org/D40876.

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

llvm-svn: 329691

6 years ago[AMDGPU] For OS type AMDPAL, fixed scratch on compute shader
Tim Renouf [Tue, 10 Apr 2018 11:25:15 +0000 (11:25 +0000)]
[AMDGPU] For OS type AMDPAL, fixed scratch on compute shader

Summary:
For OS type AMDPAL, the scratch descriptor is loaded from offset 0 of
the GIT, whose 32 bit pointer is in s0 (s8 for gfx9 merged shaders).

This commit fixes that to use offset 0x10 instead of offset 0 for a
compute shader, per the PAL ABI spec.

V2: Ensure s0 (s8 for gfx9 merged shader) is marked live-in when loading
scratch descriptor from GIT.

Reviewers: kzhuravl, nhaehnle, timcorringham

Subscribers: kzhuravl, wdng, yaxunl, t-tye, llvm-commits, dstuttard, nhaehnle, arsenm

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

Change-Id: I93dffa647758e37f613bb5e0dfca840d82e6d26f
llvm-svn: 329690

6 years agoCodeGen tests - typo fixes NFC
Gabor Buella [Tue, 10 Apr 2018 11:20:05 +0000 (11:20 +0000)]
CodeGen tests - typo fixes NFC

llvm-svn: 329689

6 years ago[compiler-rt][asan][mips] UnXFAIL some consistently passing tests
Simon Dardis [Tue, 10 Apr 2018 11:09:17 +0000 (11:09 +0000)]
[compiler-rt][asan][mips] UnXFAIL some consistently passing tests

llvm-svn: 329688

6 years agoAArch64: diagnose unpredictable store-exclusive instructions
Tim Northover [Tue, 10 Apr 2018 11:04:29 +0000 (11:04 +0000)]
AArch64: diagnose unpredictable store-exclusive instructions

Much like any written register in load/store instructions, the status register
is not allowed to overlap with any others. So diagnose it like we already do
with the other cases.

llvm-svn: 329687

6 years ago[X86][Broadwell] HWPort5 should not be added to BroadwellModelProcResources.
Andrea Di Biagio [Tue, 10 Apr 2018 10:49:41 +0000 (10:49 +0000)]
[X86][Broadwell] HWPort5 should not be added to BroadwellModelProcResources.

The BroadwellModelProcResources had an entry for HWPort5, which is a Haswell
resource, and not a Broadwell processor resource. That entry was added to the
Broadwell model because variable blends were consuming it.

This was clearly a typo (the resource name should have been BWPort5), which
unfortunately was never caught before. It was not reported as an error because
HWPort5 is a resource defined by the Haswell model. It has been found when
testing some code with llvm-mca: the list of resources in the resource pressure
view was odd.

This patch fixes the issue; now variable blend instructions consume 2 cycles on
BWPort5 instead of HWPort5. This is enough to get rid of the extra (spurious)
entry in the BroadWellModelProcResources table.

llvm-svn: 329686

6 years ago[Tooling] fix UB when interpolating compile commands with an empty index
Sam McCall [Tue, 10 Apr 2018 10:36:46 +0000 (10:36 +0000)]
[Tooling] fix UB when interpolating compile commands with an empty index

llvm-svn: 329685

6 years ago-ftime-report switch support in Clang.
Andrew V. Tischenko [Tue, 10 Apr 2018 10:34:13 +0000 (10:34 +0000)]
-ftime-report switch support in Clang.
The current support of the feature produces only 2 lines in report:
 -Some general Code Generation Time;
 -Total time of Backend Consumer actions.
This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc.
Differential Revision: https://reviews.llvm.org/D43578

llvm-svn: 329684

6 years ago[llvm-ar] Temporarily make the tool case detection test Windows-only to fix the build...
Alexandre Ganea [Tue, 10 Apr 2018 10:26:23 +0000 (10:26 +0000)]
[llvm-ar] Temporarily make the tool case detection test Windows-only to fix the build (introduced in r329658)

llvm-svn: 329683

6 years agoArgs: replace isprint8 usage with isprint
Pavel Labath [Tue, 10 Apr 2018 10:07:22 +0000 (10:07 +0000)]
Args: replace isprint8 usage with isprint

It looks like we introduced isprint8 way back in r169417 to be used on
getopt's short_options, which we sometimes set to values which are out
of range for normal chars to indicate options with no short form.

However, this is not how the function is used in the Args class, where
we explicitly process a string character by character.

This removes the last external dependency from the Args class.

llvm-svn: 329682

6 years ago[AArch64][SVE] Asm: Add support for unpredicated LSL/LSR (shift by immediate) instruc...
Sander de Smalen [Tue, 10 Apr 2018 10:03:13 +0000 (10:03 +0000)]
[AArch64][SVE] Asm: Add support for unpredicated LSL/LSR (shift by immediate) instructions.

Reviewers: rengolin, fhahn, javed.absar, SjoerdMeijer, huntergr, t.p.northover, echristo, evandro

Reviewed By: rengolin, fhahn

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 329681

6 years agoReapply "[llvm-mca] Do not separate iterations with a newline in the timeline view."
Andrea Di Biagio [Tue, 10 Apr 2018 09:55:33 +0000 (09:55 +0000)]
Reapply "[llvm-mca] Do not separate iterations with a newline in the timeline view."

This reapplies r329403 with a fix for the floating point rounding issue.

llvm-svn: 329680

6 years agoMove OptionElementVector helper structs from Args to Options
Pavel Labath [Tue, 10 Apr 2018 09:48:05 +0000 (09:48 +0000)]
Move OptionElementVector helper structs from Args to Options

These are not used anywhere in the Args class. They should have been
moved as a part of r327110 (Moving Option parsing from Args to Options),
but I did not notice them then.

This does not affect the layering in any way, but in makes sense for the
structs to be defined in the near the code that uses them.

llvm-svn: 329679

6 years ago[ELF] - Do not crash when trying to order --defsym/linker script symbols.
George Rimar [Tue, 10 Apr 2018 09:44:44 +0000 (09:44 +0000)]
[ELF] - Do not crash when trying to order --defsym/linker script symbols.

Currently, we crash because File is null for
such symbols.

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

llvm-svn: 329678

6 years agoMove Args::StringTo*** functions to a new OptionArgParser class
Pavel Labath [Tue, 10 Apr 2018 09:03:59 +0000 (09:03 +0000)]
Move Args::StringTo*** functions to a new OptionArgParser class

Summary:
The idea behind this is to move the functionality which depend on other lldb
classes into a separate class. This way, the Args class can be turned
into a lightweight arc+argv wrapper and moved into the lower lldb
layers.

Reviewers: jingham, zturner

Subscribers: lldb-commits

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

llvm-svn: 329677

6 years ago[MC][TableGen] Fix r329675.
Clement Courbet [Tue, 10 Apr 2018 08:43:46 +0000 (08:43 +0000)]
[MC][TableGen] Fix r329675.

Caught by bots with -Wmissing-braces.

llvm-svn: 329676

6 years ago[MC][TableGen] Add optional libpfm counter names for ProcResUnits.
Clement Courbet [Tue, 10 Apr 2018 08:16:37 +0000 (08:16 +0000)]
[MC][TableGen] Add optional libpfm counter names for ProcResUnits.

Summary:
Subtargets can define the libpfm counter names that can be used to
measure cycles and uops issued on ProcResUnits.
This allows making llvm-exegesis available on more targets.
Fixes PR36984.

Reviewers: gchatelet, RKSimon, andreadb, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 329675

6 years ago[AArch64][SVE] Asm: Add support for SVE INDEX instructions.
Sander de Smalen [Tue, 10 Apr 2018 07:01:53 +0000 (07:01 +0000)]
[AArch64][SVE] Asm: Add support for SVE INDEX instructions.

Reviewers: rengolin, fhahn, javed.absar, SjoerdMeijer, huntergr, t.p.northover, echristo, evandro

Reviewed By: rengolin, fhahn

Subscribers: tschuett, llvm-commits, kristof.beyls

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

llvm-svn: 329674

6 years ago[x86] Model the direction flag (DF) separately from the rest of EFLAGS.
Chandler Carruth [Tue, 10 Apr 2018 06:40:51 +0000 (06:40 +0000)]
[x86] Model the direction flag (DF) separately from the rest of EFLAGS.

This cleans up a number of operations that only claimed te use EFLAGS
due to using DF. But no instructions which we think of us setting EFLAGS
actually modify DF (other than things like popf) and so this needlessly
creates uses of EFLAGS that aren't really there.

In fact, DF is so restrictive it is pretty easy to model. Only STD, CLD,
and the whole-flags writes (WRFLAGS and POPF) need to model this.

I've also somewhat cleaned up some of the flag management instruction
definitions to be in the correct .td file.

Adding this extra register also uncovered a failure to use the correct
datatype to hold X86 registers, and I've corrected that as necessary
here.

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

llvm-svn: 329673

6 years ago[sanitizer] Enable threads for libc++ build used by the symbolizer
Petr Hosek [Tue, 10 Apr 2018 05:54:36 +0000 (05:54 +0000)]
[sanitizer] Enable threads for libc++ build used by the symbolizer

Disabling threads makes <atomic> unusable, but this is needed by LLVM
libraries that are dependencies of the symbolizer.

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

llvm-svn: 329672

6 years ago[ExprConstant] Use an AST node and a version number as a key to create
Akira Hatanaka [Tue, 10 Apr 2018 05:15:01 +0000 (05:15 +0000)]
[ExprConstant] Use an AST node and a version number as a key to create
an APValue and retrieve it from map Temporaries.

The version number is needed when a single AST node is visited multiple
times and is used to create APValues that are required to be distinct
from each other (for example, MaterializeTemporaryExprs in default
arguments and VarDecls in loops).

rdar://problem/36505742

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

llvm-svn: 329671

6 years ago[X86] Prevent folding loads with 64-bit ANDs with immediates that fit in 32-bits.
Craig Topper [Tue, 10 Apr 2018 03:44:15 +0000 (03:44 +0000)]
[X86] Prevent folding loads with 64-bit ANDs with immediates that fit in 32-bits.

Prefer to use the 32-bit AND with immediate instead.

Primarily I'm doing this to ensure that immediates created by shrinkAndImmediate will always get absorbed into the AND. But I do believe this would be a reduction in the number of uops that need to execute. Ideally we should shrink the 'and' and the 'load' during DAG combine to re-enable the fold.

Fixes PR37063.

llvm-svn: 329667

6 years agoRevert "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
Michael Zolotukhin [Tue, 10 Apr 2018 03:40:29 +0000 (03:40 +0000)]
Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.

This reverts r329661. Bots are still unhappy.

llvm-svn: 329666

6 years ago[libcxx] [test] Use the correct type from strlen. Include correct header.
Billy Robert O'Neal III [Tue, 10 Apr 2018 03:04:07 +0000 (03:04 +0000)]
[libcxx] [test] Use the correct type from strlen. Include correct header.

llvm-svn: 329665

6 years agoRevert "Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading.""
Michael Zolotukhin [Tue, 10 Apr 2018 02:16:45 +0000 (02:16 +0000)]
Revert "Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading.""

This reapplies commit r329644.

llvm-svn: 329661

6 years ago[SSAUpdaterBulk] Handle CFG with unreachable from entry blocks.
Michael Zolotukhin [Tue, 10 Apr 2018 02:16:29 +0000 (02:16 +0000)]
[SSAUpdaterBulk] Handle CFG with unreachable from entry blocks.

llvm-svn: 329660

6 years ago[DebugInfo][COFF] Fix reading variable-length encoded records
Alexandre Ganea [Tue, 10 Apr 2018 01:58:45 +0000 (01:58 +0000)]
[DebugInfo][COFF] Fix reading variable-length encoded records

While reading Codeview records which contain variable-length encoded integers,
such as LF_BCLASS, LF_ENUMERATE, LF_MEMBER, LF_VBCLASS or LF_IVBCLASS,
the record's size would be improperly calculated in cases where the value was
indeed of a variable length (>= LF_NUMERIC). This caused a bad alignement on
the next record, which would/might crash later on.

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

llvm-svn: 329659

6 years ago[llvm-ar] Fix lib.exe detection when running within MSVC toolchain
Alexandre Ganea [Tue, 10 Apr 2018 01:50:25 +0000 (01:50 +0000)]
[llvm-ar] Fix lib.exe detection when running within MSVC toolchain

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

llvm-svn: 329658

6 years ago[x86] Introduce a pass to begin more systematically fixing PR36028 and similar issues.
Chandler Carruth [Tue, 10 Apr 2018 01:41:17 +0000 (01:41 +0000)]
[x86] Introduce a pass to begin more systematically fixing PR36028 and similar issues.

The key idea is to lower COPY nodes populating EFLAGS by scanning the
uses of EFLAGS and introducing dedicated code to preserve the necessary
state in a GPR. In the vast majority of cases, these uses are cmovCC and
jCC instructions. For such cases, we can very easily save and restore
the necessary information by simply inserting a setCC into a GPR where
the original flags are live, and then testing that GPR directly to feed
the cmov or conditional branch.

However, things are a bit more tricky if arithmetic is using the flags.
This patch handles the vast majority of cases that seem to come up in
practice: adc, adcx, adox, rcl, and rcr; all without taking advantage of
partially preserved EFLAGS as LLVM doesn't currently model that at all.

There are a large number of operations that techinaclly observe EFLAGS
currently but shouldn't in this case -- they typically are using DF.
Currently, they will not be handled by this approach. However, I have
never seen this issue come up in practice. It is already pretty rare to
have these patterns come up in practical code with LLVM. I had to resort
to writing MIR tests to cover most of the logic in this pass already.
I suspect even with its current amount of coverage of arithmetic users
of EFLAGS it will be a significant improvement over the current use of
pushf/popf. It will also produce substantially faster code in most of
the common patterns.

This patch also removes all of the old lowering for EFLAGS copies, and
the hack that forced us to use a frame pointer when EFLAGS copies were
found anywhere in a function so that the dynamic stack adjustment wasn't
a problem. None of this is needed as we now lower all of these copies
directly in MI and without require stack adjustments.

Lots of thanks to Reid who came up with several aspects of this
approach, and Craig who helped me work out a couple of things tripping
me up while working on this.

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

llvm-svn: 329657

6 years agoShadowCallStack/x86_64: Ignore pseudo-machine instructions
Vlad Tsyrklevich [Tue, 10 Apr 2018 01:31:01 +0000 (01:31 +0000)]
ShadowCallStack/x86_64: Ignore pseudo-machine instructions

llvm-svn: 329656

6 years ago[CodeGen] Allow undefined loads in statement instances outside context.
Michael Kruse [Tue, 10 Apr 2018 01:20:51 +0000 (01:20 +0000)]
[CodeGen] Allow undefined loads in statement instances outside context.

A check in assert-builds was meant to verify that a load provides a
value in all statement instances (i.e. its domain).  The domain is
commonly gist'ed within the parameter context to contain fewer
constraints.  However, statement instances outside the context are
no valid executions, hence the value provided can be undefined.

Refine the check for valid loads to only needed to be defined within
the SCoP context.

In addition, the JSONImporter had to be changed to allow importing
access relations that are broader than the current access relation,
but still defined over all statement instances.

This should fix the compiler crash in test-suite's oggenc of the
-polly-process-unprofitable buildbot.

llvm-svn: 329655

6 years ago[CodeGen] Convert BlockGenerator::generateScalarLoads to isl++. NFC.
Michael Kruse [Tue, 10 Apr 2018 01:20:47 +0000 (01:20 +0000)]
[CodeGen] Convert BlockGenerator::generateScalarLoads to isl++. NFC.

llvm-svn: 329654

6 years ago[ScopInfo] Avoid iterator invalidation.
Michael Kruse [Tue, 10 Apr 2018 01:20:41 +0000 (01:20 +0000)]
[ScopInfo] Avoid iterator invalidation.

Commit r329640 introduced the removal of all MemoryAccesses of a Scop.
It accidentally continued iterating over a vector whose iterators
have been invalidated by a MemoryAccess removal.

Make a copy of the MemoryAccesses to remove to iterate over while
removing them.

llvm-svn: 329653

6 years ago[AST] Attempt to fix buildbot warnings + appease MSVC; NFCI
George Burgess IV [Tue, 10 Apr 2018 01:11:26 +0000 (01:11 +0000)]
[AST] Attempt to fix buildbot warnings + appease MSVC; NFCI

GCC 4.8.4 on a bot was warning about `ArgPassingKind` not fitting in
`ArgPassingRestrictions`, which appears to be incorrect, since
`ArgPassingKind` only has three potential values:

"warning: 'clang::RecordDecl::ArgPassingRestrictions' is too small to
hold all values of 'enum clang::RecordDecl::ArgPassingKind'"

Additionally, I remember hearing (though my knowledge may be outdated)
that MSVC won't merge adjacent bitfields if their types are different.

Try to fix both issues by turning these into `uint8_t`s.

llvm-svn: 329652

6 years agoObject: Don't mark alias unconditionally defined
Vitaly Buka [Tue, 10 Apr 2018 00:53:16 +0000 (00:53 +0000)]
Object: Don't mark alias unconditionally defined

Summary:
Can't remove EmitAssignment override as llvm/test/Object/X86/nm-bitcodeweak.test
expects this behavior.

Reviewers: pcc, espindola

Subscribers: mehdi_amini, hiraditya, llvm-commits

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

llvm-svn: 329651

6 years agoRevert "[PR16756] Use SSAUpdaterBulk in JumpThreading."
Michael Zolotukhin [Tue, 10 Apr 2018 00:42:43 +0000 (00:42 +0000)]
Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading."

This reverts commit r329644.

llvm-svn: 329650

6 years agoFix for the buildbot failure. Now-unused private field TTI deleted.
Hideki Saito [Tue, 10 Apr 2018 00:38:36 +0000 (00:38 +0000)]
Fix for the buildbot failure. Now-unused private field TTI deleted.

llvm-svn: 329649

6 years ago[CachePruning] Fix comment about ext4 per-directory file limit. NFC
Fangrui Song [Tue, 10 Apr 2018 00:12:28 +0000 (00:12 +0000)]
[CachePruning] Fix comment about ext4 per-directory file limit. NFC

There is a limit on number of subdirectories if dir_nlinks is not
enabled (31998), but per-directory number of files is not limited.

llvm-svn: 329648

6 years agohypot: Port from amd builtins
Jan Vesely [Tue, 10 Apr 2018 00:11:58 +0000 (00:11 +0000)]
hypot: Port from amd builtins

v2: Fix whitespace errors

Use only subnormal path.
Passes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>

llvm-svn: 329647

6 years agoFix line endings (CR/LF -> LF) introduced by rL329613
Alexandre Ganea [Tue, 10 Apr 2018 00:09:15 +0000 (00:09 +0000)]
Fix line endings (CR/LF -> LF) introduced by rL329613

reviewer: zturner
llvm-svn: 329646

6 years ago[NFC][LV] Move InterleaveInfo from Legal to CostModel
Hideki Saito [Mon, 9 Apr 2018 23:45:40 +0000 (23:45 +0000)]
[NFC][LV] Move InterleaveInfo from Legal to CostModel

Summary:
Another clean up, following D43208.

Interleaved memory access analysis/optimization has nothing to do with vectorization legality. It doesn't really belong there. On the other hand, cost model certainly has to know about it.

In principle, vectorization should proceed like Legality ==> Optimization ==> CostModel ==> CodeGen, and this change just does that,
by moving the interleaved access analysis/decision out of Legal, and run it just before CostModel object is created.

After this, I can move LoopVectorizationLegality and Hints/Requirements classes into it's own header file, making it shareable within Transform tree. I have the patch already but I don't want to mix with this change. Eventual goal is to move to Analysis tree, but I first need to move RecurrenceDescriptor/InductionDescriptor from Transform/Util/LoopUtil.* to Analysis.

Reviewers: rengolin, hfinkel, mkuper, dcaballe, sguggill, fhahn, aemerson

Reviewed By: rengolin

Subscribers: llvm-commits

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

llvm-svn: 329645

6 years ago[PR16756] Use SSAUpdaterBulk in JumpThreading.
Michael Zolotukhin [Mon, 9 Apr 2018 23:37:37 +0000 (23:37 +0000)]
[PR16756] Use SSAUpdaterBulk in JumpThreading.

Summary:
SSAUpdater is a bottleneck in JumpThreading, and this patch improves the
situation by using SSAUpdaterBulk instead.

Compile time impact: no noticable changes on CTMark, a big improvement
on the test from PR16756.

Reviewers: dberlin, davide, MatzeB

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 329644

6 years ago[PR16756] Add SSAUpdaterBulk.
Michael Zolotukhin [Mon, 9 Apr 2018 23:37:20 +0000 (23:37 +0000)]
[PR16756] Add SSAUpdaterBulk.

Summary:
SSAUpdater is a bottleneck in a number of passes, and one of the reasons
is that it performs a lot of unnecessary computations (DT/IDF) over and
over again. This patch adds a new SSAUpdaterBulk that uses existing DT
and avoids recomputing IDF when possible.

Reviewers: dberlin, davide, MatzeB

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 329643

6 years agoAdd a test for nested --start-group.
Rui Ueyama [Mon, 9 Apr 2018 23:30:21 +0000 (23:30 +0000)]
Add a test for nested --start-group.

llvm-svn: 329642

6 years ago[ScopInfo] Completely remove MemoryAccesses when their parent statement is removed.
Michael Kruse [Mon, 9 Apr 2018 23:13:05 +0000 (23:13 +0000)]
[ScopInfo] Completely remove MemoryAccesses when their parent statement is removed.

Removing a statement left its MemoryAccesses in some lists and maps of
the SCoP.  Which lists depends on at which phase of the SCoP
construction the statement is deleted.  Follow-up passes could still see
the already deleted MemoryAccesses by iterating through these
lists/maps, resulting in an access violation.

When removing a ScopStmt, also remove all its MemoryAccesses by using
the same mechnism that removes a MemoryAccess.

llvm-svn: 329640

6 years ago[ScopInfo] Actually remove from list.
Michael Kruse [Mon, 9 Apr 2018 23:13:01 +0000 (23:13 +0000)]
[ScopInfo] Actually remove from list.

std::remove, despite its name, does not remove elements from a list, but
only moves them to the end of a list.  Call erase() to shorten the
vector to the remaining elements.

Test case included in next commit.

llvm-svn: 329639

6 years ago[MemorySSA] remove cruft; NFC.
George Burgess IV [Mon, 9 Apr 2018 23:09:27 +0000 (23:09 +0000)]
[MemorySSA] remove cruft; NFC.

The caching walker used to hold its own caches, which made its `reset()`
function meaningful. Since caching has been moved out of it, there's no
reason to continue to have these cache-related methods.

Similarly, the EXPENSIVE_CHECKS block that's getting removed used to
rerun the query with caching disabled. Since that's how we always do
queries now, it's redundant.

llvm-svn: 329638

6 years agoAdd --warn-backrefs to maintain compatibility with other linkers
Rui Ueyama [Mon, 9 Apr 2018 23:05:48 +0000 (23:05 +0000)]
Add --warn-backrefs to maintain compatibility with other linkers

I'm proposing a new command line flag, --warn-backrefs in this patch.
The flag and the feature proposed below don't exist in GNU linkers
nor the current lld.

--warn-backrefs is an option to detect reverse or cyclic dependencies
between static archives, and it can be used to keep your program
compatible with GNU linkers after you switch to lld. I'll explain the
feature and why you may find it useful below.

lld's symbol resolution semantics is more relaxed than traditional
Unix linkers. Therefore,

  ld.lld foo.a bar.o

succeeds even if bar.o contains an undefined symbol that have to be
resolved by some object file in foo.a. Traditional Unix linkers
don't allow this kind of backward reference, as they visit each
file only once from left to right in the command line while
resolving all undefined symbol at the moment of visiting.

In the above case, since there's no undefined symbol when a linker
visits foo.a, no files are pulled out from foo.a, and because the
linker forgets about foo.a after visiting, it can't resolve
undefined symbols that could have been resolved otherwise.

That lld accepts more relaxed form means (besides it makes more
sense) that you can accidentally write a command line or a build
file that works only with lld, even if you have a plan to
distribute it to wider users who may be using GNU linkers.  With
--check-library-dependency, you can detect a library order that
doesn't work with other Unix linkers.

The option is also useful to detect cyclic dependencies between
static archives. Again, lld accepts

  ld.lld foo.a bar.a

even if foo.a and bar.a depend on each other. With --warn-backrefs
it is handled as an error.

Here is how the option works. We assign a group ID to each file. A
file with a smaller group ID can pull out object files from an
archive file with an equal or greater group ID. Otherwise, it is a
reverse dependency and an error.

A file outside --{start,end}-group gets a fresh ID when
instantiated. All files within the same --{start,end}-group get the
same group ID. E.g.

  ld.lld A B --start-group C D --end-group E

A and B form group 0, C, D and their member object files form group
1, and E forms group 2. I think that you can see how this group
assignment rule simulates the traditional linker's semantics.

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

llvm-svn: 329636

6 years ago[ObjC++] Never pass structs that transitively contain __weak fields in
Akira Hatanaka [Mon, 9 Apr 2018 22:48:22 +0000 (22:48 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.

This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.

This reapplies r329617. r329617 didn't specify the underlying type for
enum ArgPassingKind, which caused regression tests to fail on a windows
bot.

rdar://problem/39194693

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

llvm-svn: 329635

6 years agoGetRandom / OpenBSD, using getentropy to get high quality randomness
Vitaly Buka [Mon, 9 Apr 2018 22:46:40 +0000 (22:46 +0000)]
GetRandom / OpenBSD, using getentropy to get high quality randomness

Summary:
- getentropy presence since late 2014, safe to use.
- guarantees to delivers good random data up to 256 bytes.
- fall back to /dev/urandom as long the buffer is correct.

Patch by David CARLIER

Reviewers: kubamracek, vitalybuka

Reviewed By: vitalybuka

Subscribers: cryptoad, llvm-commits, #sanitizers

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

llvm-svn: 329633

6 years ago[MemorySSA] Remove redundant assert; NFC
George Burgess IV [Mon, 9 Apr 2018 22:45:14 +0000 (22:45 +0000)]
[MemorySSA] Remove redundant assert; NFC

The `if (!Def && !Use) return nullptr;` right above this assert sort of
defeats the purpose.

llvm-svn: 329632

6 years agolibFuzzer, OpenBSD support
Vitaly Buka [Mon, 9 Apr 2018 22:38:26 +0000 (22:38 +0000)]
libFuzzer, OpenBSD support

Summary:
- Enabling libfuzzer on OpenBSD
- OpenBSD can t support asan, msan ... the tests can t be run.

Patch by David CARLIER

Reviewers: eugenis, phosek, vitalybuka

Reviewed By: vitalybuka

Subscribers: srhines, mgorny, krytarowski, llvm-commits, #sanitizers

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

llvm-svn: 329631

6 years ago[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
Eugene Zelenko [Mon, 9 Apr 2018 22:14:10 +0000 (22:14 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).

llvm-svn: 329630

6 years ago[CFI] Disable CFI checks for __cxa_decrement_exception_refcount
Vlad Tsyrklevich [Mon, 9 Apr 2018 22:11:28 +0000 (22:11 +0000)]
[CFI] Disable CFI checks for __cxa_decrement_exception_refcount

Summary:
exception_header->exceptionDestructor is a void(*)(void*) function
pointer; however, it can point to destructors like std::
exception::~exception that don't match that type signature.

Reviewers: pcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: kcc, christof, cfe-commits

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

llvm-svn: 329629

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Mon, 9 Apr 2018 21:54:38 +0000 (21:54 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 329628

6 years agoRevert "[ObjC++] Never pass structs that transitively contain __weak fields in"
Akira Hatanaka [Mon, 9 Apr 2018 21:47:58 +0000 (21:47 +0000)]
Revert "[ObjC++] Never pass structs that transitively contain __weak fields in"

This reverts commit r329617. It broke a windows bot.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16372/steps/test/logs/stdio

llvm-svn: 329627

6 years ago[X86] Added missing AAD/AAM immediate schedule tests
Simon Pilgrim [Mon, 9 Apr 2018 21:46:57 +0000 (21:46 +0000)]
[X86] Added missing AAD/AAM immediate schedule tests

Added some more TODOs for missing instructions

llvm-svn: 329626

6 years ago[globalisel][legalizerinfo] Add support for the Lower action in getActionDefinitionsB...
Daniel Sanders [Mon, 9 Apr 2018 21:10:09 +0000 (21:10 +0000)]
[globalisel][legalizerinfo] Add support for the Lower action in getActionDefinitionsBuilder() and use it in AArch64.

Lower is slightly odd. It often doesn't change the type but the lowerings
do use the new type to decide what code to create. Treat it like a mutation
but provide convenience functions that re-use the existing type.

Re-uses the existing tests:
test/CodeGen/AArch64/GlobalISel/legalize-rem.mir
test/CodeGen/AArch64/GlobalISel//legalize-mul.mir
test/CodeGen/AArch64/GlobalISel//legalize-cmpxchg-with-success.mir

llvm-svn: 329623

6 years agoFix printing of stack id in MachineFrameInfo
Matt Arsenault [Mon, 9 Apr 2018 21:04:30 +0000 (21:04 +0000)]
Fix printing of stack id in MachineFrameInfo

uint8_t is printed as a char, so it needs to be
casted to do the right thing.

llvm-svn: 329622

6 years ago[MemorySSAUpdater] Mark Phi users of a node being moved as non-optimize
Zhaoshi Zheng [Mon, 9 Apr 2018 20:55:37 +0000 (20:55 +0000)]
[MemorySSAUpdater] Mark Phi users of a node being moved as non-optimize

Fix PR36484, as suggested:

<quote>
during moves, mark the direct users of the erased things that were phis as "not to be optimized"
<quote>

llvm-svn: 329621

6 years agoAMDGPU: Remove max_scratch_backing_memory_byte_size from kernel header
Konstantin Zhuravlyov [Mon, 9 Apr 2018 20:47:22 +0000 (20:47 +0000)]
AMDGPU: Remove max_scratch_backing_memory_byte_size from kernel header

1. Remove max_scratch_backing_memory_byte_size from kernel header
2. Make it a reserved field
3. Ignore it while parsing assembly for backwards compatibility
4. Bump up minor version of kernel header

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

llvm-svn: 329620

6 years ago[test] [NFC] cleanup aligned_storage test
Casey Carter [Mon, 9 Apr 2018 20:41:45 +0000 (20:41 +0000)]
[test] [NFC] cleanup aligned_storage test

* `s/"" )/"")/g`
* Don't redundantly test triviality for `TEST_STD_VER > 17`

llvm-svn: 329618

6 years ago[ObjC++] Never pass structs that transitively contain __weak fields in
Akira Hatanaka [Mon, 9 Apr 2018 20:39:47 +0000 (20:39 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.

This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.

rdar://problem/39194693

llvm-svn: 329617

6 years ago[X86] Don't use Lower512IntUnary to split bitcasts with v32i16/v64i8 types on targets...
Craig Topper [Mon, 9 Apr 2018 20:37:14 +0000 (20:37 +0000)]
[X86] Don't use Lower512IntUnary to split bitcasts with v32i16/v64i8 types on targets without AVX512BW.

LowerIntUnary as its name says has an assert for integer types. But for the bitcast case one side might be an FP type.

Rather than making sure the function really works for fp types and renaming it. Just do really basic splitting directly. The LowerIntUnary has the advantage that it can peek through BUILD_VECTOR because every other call is during Lowering. But these calls are during legalization and will be followed by a DAG combine round.

Revert some change to LowerVectorIntUnary that were originally made just to make these two calls work even in pure integer cases.

This was found purely by compiling the avx512f-builtins.c test from clang so I've copied over the offending function from that.

llvm-svn: 329616

6 years agoshadowcallstack: Make runtime tests compatible with aarch64.
Peter Collingbourne [Mon, 9 Apr 2018 20:18:10 +0000 (20:18 +0000)]
shadowcallstack: Make runtime tests compatible with aarch64.

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

llvm-svn: 329614

6 years ago[Debuginfo][COFF] Minimal serialization support for precompiled types records
Alexandre Ganea [Mon, 9 Apr 2018 20:17:56 +0000 (20:17 +0000)]
[Debuginfo][COFF] Minimal serialization support for precompiled types records

This change adds support for the LF_PRECOMP and LF_ENDPRECOMP records required
to read/write Microsoft precompiled types .objs.
See https://en.wikipedia.org/wiki/Precompiled_header#Microsoft_Visual_C_and_C++

This also adds handling for the .debug$P section, which is actually a .debug$T
section in disguise, found only in precompiled .objs.

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

llvm-svn: 329613

6 years agoasan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address
Vitaly Buka [Mon, 9 Apr 2018 20:10:29 +0000 (20:10 +0000)]
asan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address

Summary:
Right now to disable -fsanitize=kernel-address instrumentation, one needs to use no_sanitize("kernel-address"). Make either no_sanitize("address") or no_sanitize("kernel-address")  disable both ASan and KASan instrumentation. Also remove redundant test.

Patch by Andrey Konovalov

Reviewers: eugenis, kcc, glider, dvyukov, vitalybuka

Reviewed By: eugenis, vitalybuka

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

llvm-svn: 329612

6 years agoAArch64: Allow offsets to be folded into addresses with ELF.
Peter Collingbourne [Mon, 9 Apr 2018 19:59:57 +0000 (19:59 +0000)]
AArch64: Allow offsets to be folded into addresses with ELF.

This is a code size win in code that takes offseted addresses
frequently, such as C++ constructors that typically need to compute
an offseted address of a vtable. It reduces the size of Chromium for
Android's .text section by 46KB, or 56KB with ThinLTO (which exposes
more opportunities to use a direct access rather than a GOT access).

Because the addend range is limited in COFF and Mach-O, this is
enabled for ELF only.

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

llvm-svn: 329611

6 years agoRevert "AMDGPU: enable 128-bit for local addr space under an option"
Alex Shlyapnikov [Mon, 9 Apr 2018 19:47:38 +0000 (19:47 +0000)]
Revert "AMDGPU: enable 128-bit for local addr space under an option"

This reverts commit r329591.

It breaks various bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/16516
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17374
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/15992
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11251
...

llvm-svn: 329610

6 years agoCOFF: Remove dead code. NFCI.
Peter Collingbourne [Mon, 9 Apr 2018 19:46:00 +0000 (19:46 +0000)]
COFF: Remove dead code. NFCI.

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

llvm-svn: 329609

6 years agoRevert "[ObjC] Make C++ triviality type traits available to non-trivial C"
Akira Hatanaka [Mon, 9 Apr 2018 19:39:27 +0000 (19:39 +0000)]
Revert "[ObjC] Make C++ triviality type traits available to non-trivial C"

This reverts commit r329289.

It was decided that we shouldn't expose the __has_* traits to C since
they are deprecated and useless.

See the discussion here:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180402/thread.html#223921

llvm-svn: 329608

6 years ago[WebAssembly] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Mon, 9 Apr 2018 19:38:31 +0000 (19:38 +0000)]
[WebAssembly] Change std::sort to llvm::sort in response to r327219

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

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

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: sunfish, RKSimon

Reviewed By: sunfish

Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits

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

llvm-svn: 329607

6 years ago[sanitizer] Reverting rCRT329595
Kostya Kortchinsky [Mon, 9 Apr 2018 19:18:50 +0000 (19:18 +0000)]
[sanitizer] Reverting rCRT329595

Summary:
Even this version seems to mess with Android somehow. Reverting for now while
I figure out what's up.

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

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

llvm-svn: 329606

6 years ago[X86] Emit native IR for pmuldq/pmuludq builtins.
Craig Topper [Mon, 9 Apr 2018 19:17:54 +0000 (19:17 +0000)]
[X86] Emit native IR for pmuldq/pmuludq builtins.

I believe all the pieces are now in place in the backend to make this work correctly. We can either mask the input to 32 bits for pmuludg or shl/ashr for pmuldq and use a regular mul instruction. The backend should combine this to PMULUDQ/PMULDQ and then SimplifyDemandedBits will remove the and/shifts.

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

llvm-svn: 329605

6 years ago[X86] Remove GCCBuiltin name from pmuldq/pmuludq intrinsics so clang can custom lower...
Craig Topper [Mon, 9 Apr 2018 19:17:38 +0000 (19:17 +0000)]
[X86] Remove GCCBuiltin name from pmuldq/pmuludq intrinsics so clang can custom lower to native IR. Update fast-isel intrinsic tests for clang's new codegen.

In somes cases fast-isel fails to remove the and/shifts and uses blends or conditional moves.

But once masking gets involved, fast-isel aborts on the mask portion and we DAG combine more thorougly.

llvm-svn: 329604

6 years ago[SLP] Additional tests for reorder reuse vectorization, NFC.
Alexey Bataev [Mon, 9 Apr 2018 19:02:34 +0000 (19:02 +0000)]
[SLP] Additional tests for reorder reuse vectorization, NFC.

llvm-svn: 329603

6 years agoFix type mismatch between MachineMemOperand constructor and accessors. NFC
Daniel Sanders [Mon, 9 Apr 2018 18:42:19 +0000 (18:42 +0000)]
Fix type mismatch between MachineMemOperand constructor and accessors. NFC

This allows MachineMemOperand::getSize()'s result to be fed directly into
MachineMemOperand::MachineMemOperand() without a narrowing type conversion
warning.

llvm-svn: 329602

6 years ago[demangler] Support for fold expressions.
Erik Pilkington [Mon, 9 Apr 2018 18:33:01 +0000 (18:33 +0000)]
[demangler] Support for fold expressions.

llvm-svn: 329601

6 years ago[demangler] Support for <data-member-prefix>.
Erik Pilkington [Mon, 9 Apr 2018 18:32:25 +0000 (18:32 +0000)]
[demangler] Support for <data-member-prefix>.

llvm-svn: 329600

6 years ago[demangler] Support for partially substituted sizeof....
Erik Pilkington [Mon, 9 Apr 2018 18:31:50 +0000 (18:31 +0000)]
[demangler] Support for partially substituted sizeof....

llvm-svn: 329599

6 years agoAdded support for LTO options: sample_profile, new_pass_manager and debug_pass_manager
Rumeet Dhindsa [Mon, 9 Apr 2018 17:56:07 +0000 (17:56 +0000)]
Added support for LTO options: sample_profile, new_pass_manager and debug_pass_manager

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

llvm-svn: 329598

6 years agoFix compilation error caused by tgmath.h.
Tatyana Krasnukha [Mon, 9 Apr 2018 17:32:56 +0000 (17:32 +0000)]
Fix compilation error caused by tgmath.h.

On CentOS calling functions from <tgmath.h> produces multiple errors "'void*' is not a pointer-to-object type".

llvm-svn: 329597

6 years ago[GISel] Refactor MachineIRBuilder to allow transformations while
Aditya Nandakumar [Mon, 9 Apr 2018 17:30:56 +0000 (17:30 +0000)]
[GISel] Refactor MachineIRBuilder to allow transformations while
building.

https://reviews.llvm.org/D45067

This change attempts to do two things:
1) It separates out the state that is stored in the
MachineIRBuilder(InsertionPt, MF, MRI, InsertFunction etc) into a
separate object called MachineIRBuilderState.
2) Add the ability to constant fold operations while building instructions
(optionally). MachineIRBuilder is now refactored into a MachineIRBuilderBase
which contains lots of non foldable build methods and their implementation.
Instructions which can be constant folded/transformed are now in a class
called FoldableInstructionBuilder which uses CRTP to use the implementation
of the derived class for buildBinaryOps. Additionally buildInstr in the derived
class can be used to implement other kinds of transformations.

Also because of separation of state, given a MachineIRBuilder in an API,
if one wishes to use another MachineIRBuilder, a new one can be
constructed from the state locally. For eg,

void doFoo(MachineIRBuilder &B) {
  MyCustomBuilder CustomB(B.getState());
  // Use CustomB for building.
}

reviewed by : aemerson

llvm-svn: 329596

6 years ago[sanitizer] Allow BackgroundThread to not depend on StackDepot
Kostya Kortchinsky [Mon, 9 Apr 2018 17:25:57 +0000 (17:25 +0000)]
[sanitizer] Allow BackgroundThread to not depend on StackDepot

Summary:
Still pursuing the ultimate goal of splitting the Symbolizer code from
RTSanitizerCommon core, allow `BackgroundThread` to work even when not linked
with `sanitizer_stackdepot.cc`. There is no reason this function should pull in
the whole `StackDepot` if symbolization is not supported.

Currently this has no functional change as the depot is always linked anyway.

Reviewers: alekseyshl

Reviewed By: alekseyshl

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

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

llvm-svn: 329595

6 years ago[cmake] Include LLVMTestingSupport when doing stand-alone build
Michal Gorny [Mon, 9 Apr 2018 17:08:14 +0000 (17:08 +0000)]
[cmake] Include LLVMTestingSupport when doing stand-alone build

Explicitly include and build lib/Testing/Support from LLVM sources when
doing a stand-alone build. This is necessary since clangd tests started
to depend on LLVMTestingSupport library which is neither installed
by LLVM, nor built by clang itself.

Since completely separate build of clang-tools-extra is not supported,
this relies on variables set by clang CMakeLists.

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

llvm-svn: 329594

6 years ago[X86] Revert the SLM part of r328914.
Craig Topper [Mon, 9 Apr 2018 17:07:40 +0000 (17:07 +0000)]
[X86] Revert the SLM part of r328914.

While it appears to be correct information based on Intel's optimization manual and Agner's data, it causes perf regressions on a couple of the benchmarks in our internal list.

llvm-svn: 329593

6 years ago[llvm-mca] Fix MCACommentConsumer
Fangrui Song [Mon, 9 Apr 2018 17:06:57 +0000 (17:06 +0000)]
[llvm-mca] Fix MCACommentConsumer

llvm-svn: 329592

6 years agoAMDGPU: enable 128-bit for local addr space under an option
Marek Olsak [Mon, 9 Apr 2018 16:56:32 +0000 (16:56 +0000)]
AMDGPU: enable 128-bit for local addr space under an option

Author: Samuel Pitoiset

ds_read_b128 and ds_write_b128 have been recently enabled
under the amdgpu-ds128 option because the performance benefit
is unclear.

Though, using 128-bit loads/stores for the local address space
appears to introduce regressions in tessellation shaders. Not
sure what is broken, but as ds_read_b128/ds_write_b128 are not
enabled by default, just introduce a global option and enable
128-bit only if requested (until it's fixed/used correctly).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105464
llvm-svn: 329591

6 years ago[llvm-mca] Add the ability to mark regions of code for analysis (PR36875)
Andrea Di Biagio [Mon, 9 Apr 2018 16:39:52 +0000 (16:39 +0000)]
[llvm-mca] Add the ability to mark regions of code for analysis (PR36875)

This patch teaches llvm-mca how to parse code comments in search for special
"markers" used to select regions of code.

Example:

# LLVM-MCA-BEGIN My Code Region
  ....
# LLVM-MCA-END

The MCAsmLexer now delegates to an object of class MCACommentParser (i.e. an
AsmCommentConsumer) the parsing of code comments to search for begin/end code
region markers.

A comment starting with substring "LLVM-MCA-BEGIN" marks the beginning of a new
region of code.  A comment starting with substring "LLVM-MCA-END" marks the end
of the last region.

This implementation doesn't allow regions to overlap. Each region can have a
optional description; internally, each region is identified by a range of source
code locations (SMLoc).

MCInst objects are added to a region R only if the source location for the
MCInst is in the range of locations specified by R.

By default, the tool allocates an implicit "Default" code region which contains
every source location.  See new tests llvm-mca-marker-*.s for a few examples.

A new Backend object is created for every region. So, the analysis is conducted
on every parsed code region.  The final report is the union of the reports
generated for every code region.  Note that empty regions are skipped.

Special "[#] Code Region - ..." strings are used in the report to mark the
portion which is specific to a code region only. For example, see
llvm-mca-markers-5.s.

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

llvm-svn: 329590

6 years agoAMDGPU: Initialize GlobalISel passes
Tom Stellard [Mon, 9 Apr 2018 16:09:13 +0000 (16:09 +0000)]
AMDGPU: Initialize GlobalISel passes

Summary:
This fixes AMDGPU GlobalISel test failures when enabling the AMDGPU
target without any other targets that use GlobalISel.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 329588

6 years ago[X86][SSE] Add floating point add/mul strict (ordered) vector.reduce tests (PR36732)
Simon Pilgrim [Mon, 9 Apr 2018 16:01:44 +0000 (16:01 +0000)]
[X86][SSE] Add floating point add/mul strict (ordered) vector.reduce tests (PR36732)

llvm-svn: 329587

6 years ago[ASan] NFC: make use of a new ErrorBase ctor
Alex Shlyapnikov [Mon, 9 Apr 2018 16:00:10 +0000 (16:00 +0000)]
[ASan] NFC: make use of a new ErrorBase ctor

Summary:
Minor style changes to complement D44404:
- make use of a new ErrorBase ctor
- de-duplicate a comment about VS2013 support

Reviewers: eugenis

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

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

llvm-svn: 329586

6 years agoSupport generic expansion of ordered vector reduction (PR36732)
Simon Pilgrim [Mon, 9 Apr 2018 15:44:20 +0000 (15:44 +0000)]
Support generic expansion of ordered vector reduction (PR36732)

Without the fast math flags, the llvm.experimental.vector.reduce.fadd/fmul intrinsic expansions must be expanded in order.

This patch scalarizes the reduction, applying the accumulator at the start of the sequence: ((((Acc + Scl[0]) + Scl[1]) + Scl[2]) + ) ... + Scl[NumElts-1]

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

llvm-svn: 329585

6 years ago[CUDA] Revert defining __CUDA_ARCH__ for amdgcn targets
Yaxun Liu [Mon, 9 Apr 2018 15:43:01 +0000 (15:43 +0000)]
[CUDA] Revert defining __CUDA_ARCH__ for amdgcn targets

amdgcn targets only support HIP, which does not define __CUDA_ARCH__.

this is a partial unroll of r329232 / D45277.

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

llvm-svn: 329584

6 years ago[clangd] Bump v0.0.6 for vscode-clangd.
Haojian Wu [Mon, 9 Apr 2018 15:37:09 +0000 (15:37 +0000)]
[clangd] Bump v0.0.6 for vscode-clangd.

llvm-svn: 329583