Commit Graph

270982 Commits

Author SHA1 Message Date
Tobias Grosser 3575afd739 [DeLICM] Move some functions to isl++ [NFC]
llvm-svn: 312475
2017-09-04 10:05:25 +00:00
Ayman Musa 5defce3986 [X86] Replace -mcpu option with -mattr in LIT tests added in https://reviews.llvm.org/rL312442
llvm-svn: 312474
2017-09-04 09:31:32 +00:00
Igor Breger 2661ae48c7 [GlobalISel][X86] G_PHI support.
llvm-svn: 312473
2017-09-04 09:06:45 +00:00
Zvi Rackover 9a087a357a LoopVectorize: MaxVF should not be larger than the loop trip count
Summary:
Improve how MaxVF is computed while taking into account that MaxVF should not be larger than the loop's trip count.

Other than saving on compile-time by pruning the possible MaxVF candidates, this patch fixes pr34438 which exposed the following flow:
1. Short trip count identified -> Don't bail out, set OptForSize:=True to avoid tail-loop and runtime checks.
2. Compute MaxVF returned 16 on a target supporting AVX512.
3. OptForSize -> choose VF:=MaxVF.
4. Bail out because TripCount = 8, VF = 16, TripCount % VF !=0 means we need a tail loop.

With this patch step 2. will choose MaxVF=8 based on TripCount.

Reviewers: Ayal, dorit, mkuper, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

llvm-svn: 312472
2017-09-04 08:35:13 +00:00
Sam Parker 7cd826a321 [LoopUnroll][DebugInfo] Don't add metadata to unrolled remainder loop
Debug information can be, and was, corrupted when the runtime
remainder loop was fully unrolled. This is because a !null node can
be created instead of a unique one describing the loop. In this case,
the original node gets incorrectly updated with the NewLoopID
metadata.

In the case when the remainder loop is going to be quickly fully
unrolled, there isn't the need to add loop metadata for it anyway.

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

llvm-svn: 312471
2017-09-04 08:12:16 +00:00
Craig Topper 69e22789e1 [X86] Remove duplicate FMA patterns from the isel table.
This reorders some patterns to get tablegen to detect them as duplicates. Tablegen only detects duplicates when creating variants for commutable operations. It does not detect duplicates between the patterns as written in the td file. So we need to ensure all the FMA patterns in the td file are unique.

This also uses null_frag to remove some other unneeded patterns.

llvm-svn: 312470
2017-09-04 07:35:05 +00:00
Craig Topper af0b992b04 [X86] Mark the FMA nodes as commutable so tablegen will auto generate the patterns.
This uses the capability introduced in r312464 to make SDNode patterns commutable on the first two operands.

This allows us to remove some of the extra FMA patterns that have to put loads and mask operands in different places to cover all cases. This even includes patterns that were missing to support match a load in the first operand with FMA4. Non-broadcast loads with masking for AVX512.

I believe this is causing us to generate some duplicate patterns because tablegen's isomorphism checks don't catch isomorphism between the patterns as written in the td. It only detects isomorphism in the commuted variants it tries to create. The the unmasked 231 and 132 memory forms are isomorphic as written in the td file so we end up keeping both. I think we precommute the 132 pattern to fix this.

We also need a follow up patch to go back to the legacy FMA3 instructions and add patterns to the 231 and 132 forms which we currently don't have.

llvm-svn: 312469
2017-09-04 06:59:50 +00:00
Raphael Isemann 561f0de6d9 [analyzer] Increase minimum complexity filter of the CloneChecker.
Summary:
So far we used a value of 10 which was useful for testing but produces many false-positives in real programs. The usual suspicious clones we find seem to be at around a complexity value of 70 and for normal clone-reporting everything above 50 seems to be a valid normal clone for users, so let's just go with 50 for now and set this as the new default value.

This patch also explicitly sets the complexity value for the regression tests as they serve more of a regression testing/debugging purpose and shouldn't really be reported by default in real programs. I'll add more tests that reflect actual found bugs that then need to pass with the default setting in the future.

Reviewers: NoQ

Subscribers: cfe-commits, javed.absar, xazax.hun, v.g.vassilev

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

llvm-svn: 312468
2017-09-04 05:56:36 +00:00
Richard Smith dd8b5337e9 Implement Itanium name mangling support for C++ Modules TS.
This follows the scheme agreed with Nathan Sidwell, which can be found here:

  https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile

This will be proposed to the itanium-cxx-abi list once we have some experience
with how well it works; the ABI for this TS should be considered unstable until
it is part of the Itanium C++ ABI.

llvm-svn: 312467
2017-09-04 05:37:53 +00:00
Dean Michael Berris ebc1659016 [XRay][CodeGen] Use PIC-friendly code in XRay sleds and remove synthetic references in .text
Summary:
This is a re-roll of D36615 which uses PLT relocations in the back-end
to the call to __xray_CustomEvent() when building in -fPIC and
-fxray-instrument mode.

Reviewers: pcc, djasper, bkramer

Subscribers: sdardis, javed.absar, llvm-commits

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

llvm-svn: 312466
2017-09-04 05:34:58 +00:00
Craig Topper 98a9628b09 [TableGen] Teach tablegen to allow SDNPCommutable nodes with more than 2 operands.
Summary:
Tablegen already supports commutable instrinsics with more than 2 operands. There it just assumes the first two operands are commutable.

I plan to use this to improve the generation of FMA patterns in the X86 backend.

Reviewers: aymanmus, zvi, RKSimon, spatel, arsenm

Reviewed By: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 312464
2017-09-04 03:44:33 +00:00
Craig Topper 76f44015e7 [X86] Add a combine to recognize when we have two insert subvectors that together write the whole vector, but the starting vector isn't undef.
In this case we should replace the starting vector with undef.

llvm-svn: 312462
2017-09-04 01:13:36 +00:00
Craig Topper 959fc08f3a [X86] Remove some unnecessary curly braces and blank line. NFC
llvm-svn: 312461
2017-09-04 01:13:34 +00:00
Craig Topper bc13af84f2 [X86] Add a combine to turn (insert_subvector zero, (insert_subvector zero, X, Idx), Idx) into an insert of X into the larger zero vector.
llvm-svn: 312460
2017-09-03 22:25:52 +00:00
Craig Topper fcf6bc5503 [X86] Add more patterns to use moves to zero the upper portions of a vector register that I missed in r312450.
llvm-svn: 312459
2017-09-03 22:25:50 +00:00
Craig Topper 788fbe08db [X86] Combine inserting a vector of zeros into a vector of zeros just the larger vector.
llvm-svn: 312458
2017-09-03 22:25:49 +00:00
Davide Italiano d8f067539b [UUID] Reimplement comparison operators more canonically. NFCI.
llvm-svn: 312457
2017-09-03 20:53:24 +00:00
Tobias Grosser d6e0679c4e [ForwardOp] Remove read accesses for all instructions that have been moved
Before this patch, OpTree did not consider forwarding an operand tree consisting
of only single LoadInst as useful. The motivation was that, like an access to a
read-only variable, it would just replace one MemoryAccess by another. However,
in contrast to read-only accesses, this would replace a scalar access by an
array access, which is something worth doing.

In addition, leaving scalar MemoryAccess is problematic in that VirtualUse
prioritizes inter-Stmt use over intra-Stmt. It was possible that the same LLVM
value has a MemoryAccess for accessing the remote Stmt's LoadInst as well as
having the same LoadInst in its own instruction list (due to being forwarded
from another operand tree).

With this patch we ensure that if a LoadInst is forwarded is any operand tree,
also the operand tree containing just the LoadInst is forwarded as well, which
effectively removes the scalar MemoryAccess such that only the array access
remains, not both.

Thanks Michael for the detailed explanation.

Reviewers: Meinersbur, bellu, singam-sanjay, gareevroman

Subscribers: hfinkel, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 312456
2017-09-03 19:52:15 +00:00
Tobias Grosser 701d943d12 [IslAst] Do not assert in case of empty min/max alias locations
In certain situations, the context in the isl_ast_build could result for the
min/max locations of our alias sets to become empty, which would cause an
internal error in isl, which is then unable to derive a value for these
expressions. Check these conditions before code generating expressions and
instead assume that alias check succeeded. This is valid, as the corresponding
memory accesses will not be executed under any valid context.

This fixed llvm.org/PR34432. Thanks to Qirun Zhang for reporting.

llvm-svn: 312455
2017-09-03 19:47:19 +00:00
Davide Italiano 45188dd9ae [Interpreter] Simplify else after return. NFCI.
llvm-svn: 312454
2017-09-03 19:27:56 +00:00
Davide Italiano e08ea3a154 [Core/Value] Remove dead code that hasn't been touched in years. NFC.
llvm-svn: 312453
2017-09-03 19:24:58 +00:00
Tobias Grosser 6b1e461329 [IslAst] Move buildCondition to isl++
llvm-svn: 312452
2017-09-03 18:31:44 +00:00
Tobias Grosser 99ccf05694 [ScopHelper] Do not crash on unreachable blocks
This resolves llvm.org/PR34433. Thanks to Zhendong Su for reporting.

llvm-svn: 312451
2017-09-03 18:01:22 +00:00
Craig Topper 8ee36ffb54 [X86] Add patterns to turn an insert into lower subvector of a zero vector into a move instruction which will implicitly zero the upper elements.
Ideally we'd be able to emit the SUBREG_TO_REG without the explicit register->register move, but we'd need to be sure the producing operation would select something that guaranteed the upper bits were already zeroed.

llvm-svn: 312450
2017-09-03 17:52:25 +00:00
Craig Topper fa82efb50a [X86] Add VBLENDPS/VPBLENDD to the execution domain fixing tables.
llvm-svn: 312449
2017-09-03 17:52:23 +00:00
Craig Topper bb6506d251 [X86] Canonicalize (concat_vectors X, zero) -> (insert_subvector zero, X, 0).
In a future patch, I plan to teach isel to use a small vector move with implicit zeroing of the upper elements when it sees the (insert_subvector zero, X, 0) pattern.

llvm-svn: 312448
2017-09-03 17:52:19 +00:00
Hal Finkel c9fac9e151 [CodeGen] Treat all vector fields as mayalias
Because it is common to treat vector types as an array of their elements, or
even some other type that's not the element type, and thus index into them, we
can't use struct-path TBAA for these accesses. Even though we already treat all
vector types as equivalent to 'char', we were using field-offset information
for them with TBAA, and this renders undefined the intra-value indexing we
intend to allow. Note that, although 'char' is universally aliasing, with path
TBAA, we can still differentiate between access to s.a and s.b in
  struct { char a, b; } s;. We can't use this capability as-is for vector types.

Fixes PR33967.

llvm-svn: 312447
2017-09-03 17:18:25 +00:00
Michael Kruse 7954a221f3 [ForwardOpTree] Fix typos. NFC.
llvm-svn: 312446
2017-09-03 16:09:38 +00:00
Sanjay Patel 661beccdd9 [InstCombine] add tests for fcmp ord/uno canonicalization; NFC
Currently, we canonicalize some cases to use 0.0, but we miss others.

llvm-svn: 312445
2017-09-03 15:35:10 +00:00
Jatin Bhateja 2c3bbe4435 Test commit access in clang.
Differential Revision: https://reviews.llvm.org/D37426

llvm-svn: 312444
2017-09-03 15:29:38 +00:00
Ayman Musa 2927ea0b19 [X86] Add -mtriple option to LIT tests added in https://reviews.llvm.org/rL312442
llvm-svn: 312443
2017-09-03 15:06:26 +00:00
Ayman Musa ef8f61bce6 [X86][AVX512] Add simple tests for all AVX512 shuffle instructions.
Throughout an effort to strongly check the behavior of CodeGen with the IR shufflevector instruction we generated many tests while predicting the best X86 sequence that may be generated.

This is a subset of the generated tests that we think may add value to our X86 set of tests.

Some of the checks are not optimal and will be changed after fixing:
1. PR34394
2. PR34382
3. PR34380
4. PR34359

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

llvm-svn: 312442
2017-09-03 13:53:44 +00:00
Yaxun Liu 29a5ee358e [OpenCL] Do not use vararg in emitted functions for enqueue_kernel
Not all targets support vararg (e.g. amdgpu). Instead of using vararg in the emitted functions for enqueue_kernel,
this patch creates a temporary array of size_t, stores the size arguments in the temporary array
and passes it to the emitted functions for enqueue_kernel.

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

llvm-svn: 312441
2017-09-03 13:52:24 +00:00
Raphael Isemann 785e8161ad [analyzer] MinComplexityConstraint now early exits and only does one macro stack lookup
Summary:
This patch contains performance improvements for the `MinComplexityConstraint`. It reduces the constraint time when running on the SQLite codebase by around 43% (from 0.085s down to 0.049s).

The patch is essentially doing two things:

* It introduces a possibility for the complexity value to early exit when reaching the limit we were checking for. This means that once we noticed that the current clone is larger than the limit the user has set, we instantly exit and no longer traverse the tree or do further expensive lookups in the macro stack.

* It also removes half of the macro stack lookups we do so far. Previously we always checked the start and the end location of a Stmt for macros, which was only a middle way between checking all locations of the Stmt and just checking one location. In practice I rarely found cases where it really matters if we check start/end or just the start of a statement as code with lots of macros that somehow just produce half a statement are very rare.

Reviewers: NoQ

Subscribers: cfe-commits, xazax.hun, v.g.vassilev

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

llvm-svn: 312440
2017-09-03 13:45:33 +00:00
Ayman Musa ac12849d32 [X86] Add RUN line for LIT test committed in "rL312438: [X86] Fix crash on assert of non-simple type after type-legalization.".
llvm-svn: 312439
2017-09-03 10:44:18 +00:00
Ayman Musa 44cde94935 [X86] Fix crash on assert of non-simple type after type-legalization
The function combineShuffleToVectorExtend in DAGCombine might generate an illegal typed node after "legalize types" phase, causing assertion on non-simple type to fail afterwards.

Adding a type check in case the combine is running after the type legalize pass.

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

llvm-svn: 312438
2017-09-03 09:09:16 +00:00
Daniel Jasper 7b85a19b9a clang-format: Fix formatting of for loops with multiple increments.
This fixes llvm.org/PR34366.

llvm-svn: 312437
2017-09-03 08:56:24 +00:00
Saleem Abdulrasool 6c3ed7b654 Driver; extract target specific option application (NFC)
Extract the target specific option application.  This is a huge switch
which was inlined into the `ConstructJob` option which adds a large
amount of code to the already large function.  Extract it to simply
reduce the line count.  NFC

llvm-svn: 312436
2017-09-03 04:47:00 +00:00
Saleem Abdulrasool 9934eabaf9 Driver: extract debugging related options (NFC)
Out-of-line the logic for selecting the debug information handling.
This is still split across the new function and partially inline in the
job construction.  This is needed since the split portion attempts to
record the "-cc1" arguments.  This needs to be the very last item to
ensure that all the flags are recorded.  NFC.

llvm-svn: 312435
2017-09-03 04:46:59 +00:00
Saleem Abdulrasool fb302caa36 Driver: move `-mfpmath` into FP Options (NFC)
Move the `-mfpmath` handling with the rest of the floating point
optimization flags.

llvm-svn: 312434
2017-09-03 04:46:57 +00:00
Hal Finkel faea89735c Add llvm-isel-fuzzer to test/CMakeLists.txt
Tests were added that depend on llvm-isel-fuzzer in r312427, so the tests
should depend on the tool.

llvm-svn: 312433
2017-09-03 03:00:27 +00:00
Craig Topper fe96ff7398 [X86] Add output register to BTC/BTR/BTS instructions.
llvm-svn: 312432
2017-09-03 01:46:26 +00:00
Ed Maste a64594da50 Add test case for attach-by-pid from different cwd
This was failing on FreeBSD prior to r312430.
Patch by Vignesh Balu.

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

llvm-svn: 312431
2017-09-03 01:44:35 +00:00
Ed Maste 207184f345 FreeBSD: attach to pid from different cwd
attach by pid worked when running from the directory from which the
target was launched, but failed from a different directory. Use the
kern.proc.pathname sysctl to locate the target, falling back to the
original case of the target's argv[0] if that fails. Based on a patch
from Vignesh Balu.

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

llvm-svn: 312430
2017-09-03 01:41:31 +00:00
Lang Hames 8a6bab78f6 [ORC] Add an Error return to the JITCompileCallbackManager::grow method.
Calling grow may result in an error if, for example, this is a callback
manager for a remote target. We need to be able to return this error to the
callee.

llvm-svn: 312429
2017-09-03 00:50:42 +00:00
Keith Wyss 1eb03d4277 Revert "[XRay][tools] Function call stack based analysis tooling for XRay traces"
This reverts commit 204a65e0702847a1880336372ad7abd1df414b44.

Double ref qualifier failed bots.

llvm-svn: 312428
2017-09-03 00:40:13 +00:00
Justin Bogner 5de2f817b3 llvm-isel-fuzzer: Add some basic tests
llvm-svn: 312427
2017-09-03 00:37:39 +00:00
Keith Wyss 4c12c7827e [XRay][tools] Function call stack based analysis tooling for XRay traces
This change introduces a subcommand to the llvm-xray tool called
"stacks" which allows for analysing XRay traces provided as inputs and
accounting time to stacks instead of just individual functions. This
gives us a more precise view of where in a program the latency is
actually attributed.

The tool uses a trie data structure to keep track of the caller-callee
relationships as we process the XRay traces. In particular, we keep
track of the function call stack as we enter functions. While we're
doing this we're adding nodes in a trie and indicating a "calls"
relatinship between the caller (current top of the stack) and the callee
(the new top of the stack). When we push function ids onto the stack, we
keep track of the timestamp (TSC) for the enter event.

When exiting functions, we are able to account the duration by getting
the difference between the timestamp of the exit event and the
corresponding entry event in the stack. This works even if we somehow
miss the exit events for intermediary functions (i.e. if the exit event
is not cleanly associated with the enter event at the top of the stack).

The output of the tool currently provides just the top N leaf functions
that contribute the most latency, and the top N stacks that have the
most frequency. In the future we can provide more sophisticated query
mechanisms and potentially an export to database feature to make offline
analysis of the stack traces possible with existing tools.

llvm-svn: 312426
2017-09-03 00:03:47 +00:00
Justin Bogner 7f28d732d2 Move some CLI utils out of llvm-isel-fuzzer and into the library
FuzzMutate might not be the best place for these, but it makes more
sense than an entirely new library for now. This will make setting up
fuzz targets with consistent CLI handling easier.

llvm-svn: 312425
2017-09-02 23:43:04 +00:00
Don Hinton 4cfdc8a04c Fix buildbot failures for new test that requires the X86 target be built.
llvm-svn: 312424
2017-09-02 22:56:58 +00:00