OSDN Git Service

android-x86/external-llvm.git
5 years agoFix typo in comment. NFC
Diana Picus [Mon, 26 Nov 2018 11:06:53 +0000 (11:06 +0000)]
Fix typo in comment. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347544 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Prevent parallel macs for unsigned values
Sam Parker [Mon, 26 Nov 2018 10:22:55 +0000 (10:22 +0000)]
[ARM] Prevent parallel macs for unsigned values

Both zext and sext are currently allowed during the search for narrow
sequences and sexts operands are later added to the mac candidates.
But operands of muls are also added, without checking whether they're
sext or zext, which means we can generate a signed smlad when we
shouldn't.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347542 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[TTI] Reduction costs only need to include a single extract element cost"
Fedor Sergeev [Mon, 26 Nov 2018 10:17:27 +0000 (10:17 +0000)]
Revert "[TTI] Reduction costs only need to include a single extract element cost"

This reverts commit r346970.
It was causing PR39774, a crash in slp-vectorizer on a rather simple loop
with just a bunch of 'and's in the body.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347541 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction"
Kang Zhang [Mon, 26 Nov 2018 07:15:31 +0000 (07:15 +0000)]
Revert "[PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction"

This reverts commits r347532. Forget add the option
-mtriple powerpc64-unknown-linux-gnu. So other platform is error except
for PowerPC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347534 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test cases to show bad type legalization of fptosi/fptosui v16f32->v16i8...
Craig Topper [Mon, 26 Nov 2018 06:50:19 +0000 (06:50 +0000)]
[X86] Add test cases to show bad type legalization of fptosi/fptosui v16f32->v16i8 and v8f64->v8i16 on pre-AVX512 targets.

When splitting the v16f32/v8f64 result type, type legalization will try to promote the integer result type before a concat and an explicit truncate. But for the fptoui test case this is particularly bad since fptoui isn't supported on X86 until AVX512. We could use an fptosi since the result range would fit in a signed 32-bit value, but the generic type legalization doesn't do that transformation when splitting. It does do this when promoting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347533 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction
Kang Zhang [Mon, 26 Nov 2018 06:03:25 +0000 (06:03 +0000)]
[PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction

Summary:
There are 4 instructions which have Inconsistent ImmMustBeMultipleOf in the
function PPCInstrInfo::instrHasImmForm, they are LFS, LFD, STFS, STFD.
These four instructions should set the ImmMustBeMultipleOf to 1 instead of 4.

Reviewed By: nemanjai

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347532 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status...
Argyrios Kyrtzidis [Mon, 26 Nov 2018 00:03:39 +0000 (00:03 +0000)]
[Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status on unix platforms

Summary:
getLastAccessedTime() and getLastModificationTime() provided times in nanoseconds but with only 1 second resolution, even when the underlying file system could provide more precise times than that.
These changes add sub-second precision for unix platforms that support improved precision.

Also add some comments to make sure people are aware that the resolution of times can vary across different file systems.

Reviewers: labath, zturner, aaron.ballman, kristina

Reviewed By: aaron.ballman, kristina

Subscribers: lebedev.ri, mgorny, kristina, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347530 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC)
Florian Hahn [Sun, 25 Nov 2018 19:38:02 +0000 (19:38 +0000)]
[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347528 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] limit transform for select-of-fp-constants
Sanjay Patel [Sun, 25 Nov 2018 17:27:02 +0000 (17:27 +0000)]
[x86] limit transform for select-of-fp-constants

This should likely be adjusted to limit this transform
further, but these diffs should be clear wins.

If we have blendv/conditional move, then we should assume
those are cheap ops. The loads become independent of the
compare, so those can be speculated before we need to use
the values in the blend/mov.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347526 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add tests for select-of-fp-constants; NFC
Sanjay Patel [Sun, 25 Nov 2018 16:54:43 +0000 (16:54 +0000)]
[x86] add tests for select-of-fp-constants; NFC

There are many options here depending on subtarget,
but we are uniformly relying on a transform that was
driven by performance for a 32-bit SSE2 target in 2009.

Note: The same motivation was apparently used to do this
transform for *all* targets, so non-x86 may want to look
at this too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347525 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IPSCCP] Use input operand instead of OriginalOp for ssa_copy.
Florian Hahn [Sun, 25 Nov 2018 16:32:02 +0000 (16:32 +0000)]
[IPSCCP] Use input operand instead of OriginalOp for ssa_copy.

OriginalOp of a Predicate refers to the original IR value,
before renaming. While solving in IPSCCP, we have to use
the operand of the ssa_copy instead, to avoid missing
updates for nested conditions on the same IR value.

Fixes PR39772.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347524 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] move constant or splat functions to common location
Sanjay Patel [Sun, 25 Nov 2018 16:09:32 +0000 (16:09 +0000)]
[SelectionDAG] move constant or splat functions to common location

rL347502 moved the null sibling, so we should group all of these
together. I'm not sure why these aren't methods of the SDValue
class itself, but that's another patch if that's possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347523 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Add support for instructions with a variadic number of operands.
Andrea Di Biagio [Sun, 25 Nov 2018 12:46:24 +0000 (12:46 +0000)]
[llvm-mca] Add support for instructions with a variadic number of operands.

By default, llvm-mca conservatively assumes that a register operand from the
variadic sequence is both a register read and a register write.  That is because
MCInstrDesc doesn't describe extra variadic operands; we don't have enough
dataflow information to tell which register operands from the variadic sequence
is a definition, and which is a use instead.

However, if a variadic instruction is flagged 'mayStore' (but not 'mayLoad'),
and it has no 'unmodeledSideEffects', then llvm-mca (very) optimistically
assumes that any register operand in the variadic sequence is a register read
only. Conversely, if a variadic instruction is marked as 'mayLoad' (but not
'mayStore'), and it has no 'unmodeledSideEffects', then llvm-mca optimistically
assumes that any extra register operand is a register definition only.
These assumptions work quite well for variadic load/store multiple instructions
defined by the ARM backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347522 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoadd Kang Zhang(shkzhang@cn.ibm.com) to the CREDITS.TXT
Kang Zhang [Sun, 25 Nov 2018 02:56:49 +0000 (02:56 +0000)]
add Kang Zhang(shkzhang@cn.ibm.com) to the CREDITS.TXT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347521 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Synchronize a macro in getAvailableFeatures in Host.cpp with the same macro...
Craig Topper [Sat, 24 Nov 2018 20:26:11 +0000 (20:26 +0000)]
[X86] Synchronize a macro in getAvailableFeatures in Host.cpp with the same macro in compiler-rt to fix a negative shift amount warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347518 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Determine demanded and known bits for funnel shifts
Nikita Popov [Sat, 24 Nov 2018 19:00:45 +0000 (19:00 +0000)]
[InstCombine] Determine demanded and known bits for funnel shifts

Support funnel shifts in InstCombine demanded bits simplification.
If the shift amount is constant, we can determine both the demanded
bits of the operands, as well as the known bits of the result.

If one of the operands has no demanded bits, it will be replaced
by undef and the funnel shift will be simplified into a simple shift
due to the simplifications added in D54778.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347515 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once.
Andrea Di Biagio [Sat, 24 Nov 2018 18:40:45 +0000 (18:40 +0000)]
[llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347514 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert unapproved commit
Joel Jones [Sat, 24 Nov 2018 07:26:55 +0000 (07:26 +0000)]
Revert unapproved commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347511 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Enable libm vectorized functions via SLEEF
Joel Jones [Sat, 24 Nov 2018 06:41:39 +0000 (06:41 +0000)]
[AArch64] Enable libm vectorized functions via SLEEF

This changeset is modeled after Intel's submission for SVML. It enables
trigonometry functions vectorization via SLEEF: http://sleef.org/.

 * A new vectorization library enum is added to TargetLibraryInfo.h: SLEEF.
 * A new option is added to TargetLibraryInfoImpl - ClVectorLibrary: SLEEF.
 * A comprehensive test case is included in this changeset.
 * In a separate changeset (for clang), a new vectorization library argument is
   added to -fveclib: -fveclib=SLEEF.

Trigonometry functions that are vectorized by sleef:

acos
asin
atan
atanh
cos
cosh
exp
exp2
exp10
lgamma
log10
log2
log
sin
sinh
sqrt
tan
tanh
tgamma

Patch by Stefan Teleman
Differential Revision: https://reviews.llvm.org/D53927

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347510 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Add dependency from ARMAsmParser to ARMAsmPrinter after r347494
Fangrui Song [Fri, 23 Nov 2018 23:43:46 +0000 (23:43 +0000)]
[ARM] Add dependency from ARMAsmParser to ARMAsmPrinter after r347494

This fixes -DBUILD_SHARED_LIBS=on

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347506 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Simplify funnel shift with zero/undef operand to shift
Nikita Popov [Fri, 23 Nov 2018 22:45:08 +0000 (22:45 +0000)]
[InstCombine] Simplify funnel shift with zero/undef operand to shift

The following simplifications are implemented:

 * `fshl(X, 0, C) -> shl X, C%BW`
 * `fshl(X, undef, C) -> shl X, C%BW` (assuming undef = 0)
 * `fshl(0, X, C) -> lshr X, BW-C%BW`
 * `fshl(undef, X, C) -> lshr X, BW-C%BW` (assuming undef = 0)
 * `fshr(X, 0, C) -> shl X, (BW-C%BW)`
 * `fshr(X, undef, C) -> shl X, BW-C%BW` (assuming undef = 0)
 * `fshr(0, X, C) -> lshr X, C%BW`
 * `fshr(undef, X, C) -> lshr, X, C%BW` (assuming undef = 0)

The simplification is only performed if the shift amount C is constant,
because we can explicitly compute C%BW and BW-C%BW in this case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347505 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TableGen] Emit more variant transitions
Evandro Menezes [Fri, 23 Nov 2018 21:17:33 +0000 (21:17 +0000)]
[TableGen] Emit more variant transitions

`llvm-mca` relies on the predicates to be based on `MCSchedPredicate` in order
to resolve the scheduling for variant instructions.  Otherwise, it aborts
the building of the instruction model early.

However, the scheduling model emitter in `TableGen` gives up too soon, unless
all processors use only such predicates.

In order to allow more processors to be used with `llvm-mca`, this patch
emits scheduling transitions if any processor uses these predicates.  The
transition emitted for the processors using legacy predicates is the one
specified with `NoSchedPred`, which is based on `MCSchedPredicate`.

Preferably, `llvm-mca` should instead assume a reasonable default when a
variant transition is not based on `MCSchedPredicate` for a given processor.
This issue should be revisited in the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347504 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Refactor some of the logic in InstrBuilder, and add a verifyOperands method.
Andrea Di Biagio [Fri, 23 Nov 2018 20:26:57 +0000 (20:26 +0000)]
[llvm-mca] Refactor some of the logic in InstrBuilder, and add a verifyOperands method.

With this change, InstrBuilder emits an error if the MCInst sequence contains an
instruction with a variadic opcode, and a non-zero number of variadic operands.

Currently we don't know how to correctly analyze variadic opcodes. The problem
with variadic operands is that there is no information for them in the opcode
descriptor (i.e. MCInstrDesc). That means, we don't know which variadic operands
are defs, and which are uses.

In future, we could try to conservatively assume that any extra register
operands is both a register use and a register definition.

This patch fixes a subtle bug in the evaluation of read/write operands for ARM
VLD1 with implicit index update. Added test vld1-index-update.s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347503 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAG] consolidate shift simplifications
Sanjay Patel [Fri, 23 Nov 2018 20:05:12 +0000 (20:05 +0000)]
[DAG] consolidate shift simplifications

...and use them to avoid creating obviously undef values as
discussed in the post-commit thread for r347478.

The diffs in vector div/rem show that we were missing real
optimizations by creating bogus shift nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347502 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] make test immune to oversized shift simplification
Sanjay Patel [Fri, 23 Nov 2018 19:45:29 +0000 (19:45 +0000)]
[x86] make test immune to oversized shift simplification

I'm not sure if this actually preserves the original intent
of this test, but if we leave it as-is, the -1 (oversized)
shift should be folded to undef and allow deleting half
of the output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347501 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r347490 as it breaks address sanitizer builds
Luke Cheeseman [Fri, 23 Nov 2018 17:13:06 +0000 (17:13 +0000)]
Revert r347490 as it breaks address sanitizer builds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347499 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][AsmParser] Improve debug printing of parsed asm operands
Oliver Stannard [Fri, 23 Nov 2018 14:27:21 +0000 (14:27 +0000)]
[ARM][AsmParser] Improve debug printing of parsed asm operands

In ARMOperand::print:
- Print human-readable register names, instead of numbers.
- Print the correct names for IT condition masks (these were in the wrong order
  before).
- Print all parts of memory operands, not just the base register.

This makes the output of llvm-mc -show-inst-operands more readable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347494 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca][View] Improved Retire Control Unit Statistics.
Andrea Di Biagio [Fri, 23 Nov 2018 12:12:57 +0000 (12:12 +0000)]
[llvm-mca][View] Improved Retire Control Unit Statistics.

RetireControlUnitStatistics now reports extra information about the ROB and the
avg/maximum number of entries consumed over the entire simulation.

Example:
  Retire Control Unit - number of cycles where we saw N instructions retired:
  [# retired], [# cycles]
   0,           109  (17.9%)
   1,           102  (16.7%)
   2,           399  (65.4%)

  Total ROB Entries:                64
  Max Used ROB Entries:             35  ( 54.7% )
  Average Used ROB Entries per cy:  32  ( 50.0% )

Documentation in llvm/docs/CommandGuide/llvmn-mca.rst has been updated to
reflect this change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347493 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAttempt to fix buildbot after r347489
Eugene Leviant [Fri, 23 Nov 2018 11:28:58 +0000 (11:28 +0000)]
Attempt to fix buildbot after r347489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347492 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r343341
Luke Cheeseman [Fri, 23 Nov 2018 11:01:47 +0000 (11:01 +0000)]
Revert r343341

- Cannot reproduce the build failure locally and the build logs have
  been deleted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347490 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Assembly representation of ReadOnly attribute
Eugene Leviant [Fri, 23 Nov 2018 10:54:51 +0000 (10:54 +0000)]
[ThinLTO] Assembly representation of ReadOnly attribute

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347489 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Add test that demonstrates buggy behavior on term folding of LoopSimplifyCFG
Max Kazantsev [Fri, 23 Nov 2018 10:34:22 +0000 (10:34 +0000)]
[NFC] Add test that demonstrates buggy behavior on term folding of LoopSimplifyCFG

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347488 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][NFC] codegen tests cleanup: remove dangling check prefixes
Sjoerd Meijer [Fri, 23 Nov 2018 10:08:39 +0000 (10:08 +0000)]
[ARM][NFC] codegen tests cleanup: remove dangling check prefixes

I am working on making FileCheck stricter (in D54769 and D53710) so that it
issues diagnostics when there's something wrong with tests.

This is a cleanup for dangling prefixes in the ARM codegen tests, e.g.:

--check-prefixes=A,B

where A occurs in the check file, but B doesn't. This can be innocent if A does
all the required checking, but can also be a bug in that test if it results in
the test actually not checking anything (if A for example only checks a common
label). Test CodeGen/ARM/smml.ll is such an example.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347487 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDisable LoopSimplifyCFG terminator folding by default
Max Kazantsev [Fri, 23 Nov 2018 09:14:53 +0000 (09:14 +0000)]
Disable LoopSimplifyCFG terminator folding by default

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347486 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopSimplifyCFG] Don't delete LCSSA Phis
Max Kazantsev [Fri, 23 Nov 2018 07:56:47 +0000 (07:56 +0000)]
[LoopSimplifyCFG] Don't delete LCSSA Phis

When removing edges, we also update Phi inputs and may end up removing
a Phi if it has only one input. We should not do it for edges that leave the current
loop because these Phis are LCSSA Phis and need to be preserved.

Thanks @dmgreen for finding this!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347484 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Add verification flags to tests
Max Kazantsev [Fri, 23 Nov 2018 05:21:53 +0000 (05:21 +0000)]
[NFC] Add verification flags to tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347483 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LegalizeVectorTypes] Don't use SplitVecOp_TruncateHelper if we're heading towards...
Craig Topper [Fri, 23 Nov 2018 02:32:13 +0000 (02:32 +0000)]
[LegalizeVectorTypes] Don't use SplitVecOp_TruncateHelper if we're heading towards scalarizing the type.

This code takes a truncate, fp_to_int, or int_to_fp with a legal result type and an input type that needs to be split and enlarges the elements in the result type before doing the split. Then inserts a follow up truncate or fp_round after concatenating the two halves back together.

But if the input type of the original op is being split on its way to ultimately being scalarized we're just going to end up building a vector from scalars and then truncating or rounding it in the vector register. Seems kind of silly to enlarge the result element type of the operation only to end up with scalar code and then building a vector with large elements only to make the elements smaller again in the vector register. Seems better to just try to get away producing smaller result types in the scalarized code.

The X86 test case that changes is a pretty contrived test case that exists because of a bug we used to have in our AVG matching code. I think the code is better now, but its not realistic anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347482 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Object] Also treat STB_GNU_UNIQUE symbols as exported to other DSO
Fangrui Song [Fri, 23 Nov 2018 01:33:19 +0000 (01:33 +0000)]
[Object] Also treat STB_GNU_UNIQUE symbols as exported to other DSO

All of STB_GLOBAL/STB_WEAK/STB_GNU_UNIQUE are treated as export symbols, see:

glibc/elf/dl-lookup.c:do_lookup_x
musl/ldso/dynlink.c OK_BINDS

Though ld.so does not read binding, the currently used STV_DEFAULT or STV_PROTECTED is a good emulation of linker behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347481 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LegalizeVectorTypes] Have SplitVecOp_TruncateHelper fall back to SplitVecOp_UnaryOp...
Craig Topper [Thu, 22 Nov 2018 22:56:52 +0000 (22:56 +0000)]
[LegalizeVectorTypes] Have SplitVecOp_TruncateHelper fall back to SplitVecOp_UnaryOp if splitting the output type would be a legal type.

SplitVecOp_TruncateHelper tries to introduce a multilevel truncate to avoid scalarization. But if splitting the result type would still be a legal type we don't need to do that.

The comment block at the top of the function implied that this was already implemented. I looked back through the history and it doesn't look to have ever been checked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347479 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] form 'not' ops ahead of shifts (PR39657)
Sanjay Patel [Thu, 22 Nov 2018 19:24:10 +0000 (19:24 +0000)]
[DAGCombiner] form 'not' ops ahead of shifts (PR39657)

We fail to canonicalize IR this way (prefer 'not' ops to arbitrary 'xor'),
but that would not matter without this patch because DAGCombiner was
reversing that transform. I think we need this transform in the backend
regardless of what happens in IR to catch cases where the shift-xor
is formed late from GEP or other ops.

https://rise4fun.com/Alive/NC1

  Name: shl
  Pre: (-1 << C2) == C1
  %shl = shl i8 %x, C2
  %r = xor i8 %shl, C1
  =>
  %not = xor i8 %x, -1
  %r = shl i8 %not, C2

  Name: shr
  Pre: (-1 u>> C2) == C1
  %sh = lshr i8 %x, C2
  %r = xor i8 %sh, C1
  =>
  %not = xor i8 %x, -1
  %r = lshr i8 %not, C2

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347478 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReland test/MC/Mips/reloc-directive-label-offset.s
Vladimir Stefanovic [Thu, 22 Nov 2018 18:18:58 +0000 (18:18 +0000)]
Reland test/MC/Mips/reloc-directive-label-offset.s

The test was reverted because it failed on
llvm-clang-x86_64-expensive-checks-win builder, and that was because
-DEXPENSIVE_CHECKS adds randomness to llvm::sort(), affecting the order of
relocation table entries.
Modified the test to not have two relocations at the same offset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347476 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] LSUnit: use a SmallSet to model load/store queues. NFCI
Andrea Di Biagio [Thu, 22 Nov 2018 15:47:44 +0000 (15:47 +0000)]
[llvm-mca] LSUnit: use a SmallSet to model load/store queues. NFCI

Also, try to minimize the number of queries to the memory queues to speedup the
analysis.

On average, this change gives a small 2% speedup. For memcpy-like kernels, the
speedup is up to 5.5%.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347469 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Use a SmallVector instead of std::vector to track register reads/writes...
Andrea Di Biagio [Thu, 22 Nov 2018 14:48:53 +0000 (14:48 +0000)]
[llvm-mca] Use a SmallVector instead of std::vector to track register reads/writes. NFCI

This avoids a heap allocation most of the times.
This patch gives a small but consistent 3% speedup on a release build (up to ~5%
on a debug build).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347464 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Fix an invalid memory read introduced by r346487.
Andrea Di Biagio [Thu, 22 Nov 2018 12:48:57 +0000 (12:48 +0000)]
[llvm-mca] Fix an invalid memory read introduced by r346487.

This patch fixes an invalid memory read introduced by r346487.
Before this patch, partial register write had to query the latency of the
dependent full register write by calling a method on the full write descriptor.
However, if the full write is from an already retired instruction, chances are
that the EntryStage already reclaimed its memory.
In some parial register write tests, valgrind was reporting an invalid
memory read.

This change fixes the invalid memory access problem. Writes are now responsible
for tracking dependent partial register writes, and notify them in the event of
instruction issued.
That means, partial register writes no longer need to query their associated
full write to check when they are ready to execute.

Added test X86/BtVer2/partial-reg-update-7.s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347459 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Assert that all blocks staying in loop are live
Max Kazantsev [Thu, 22 Nov 2018 12:43:27 +0000 (12:43 +0000)]
[NFC] Assert that all blocks staying in loop are live

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347458 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Ensure deterministic order of dead exit blocks
Max Kazantsev [Thu, 22 Nov 2018 12:33:41 +0000 (12:33 +0000)]
[NFC] Ensure deterministic order of dead exit blocks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347457 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Fix SelectionDAG infinite loop for v1i64 SCALAR_TO_VECTOR
John Brawn [Thu, 22 Nov 2018 11:45:23 +0000 (11:45 +0000)]
[AArch64] Fix SelectionDAG infinite loop for v1i64 SCALAR_TO_VECTOR

A consequence of r347274 is that SCALAR_TO_VECTOR can be converted into
BUILD_VECTOR by SimplifyDemandedBits, but LowerBUILD_VECTOR can turn
BUILD_VECTOR into SCALAR_TO_VECTOR so we get an infinite loop.

Fix this by making LowerBUILD_VECTOR not do this transformation for those
vectors that would get transformed back, i.e. BUILD_VECTOR of a single-element
constant vector. Doing that means we get a DUP, which we then need to recognise
in ISel as a copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347456 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Simplify code by using standard exit blocks collection
Max Kazantsev [Thu, 22 Nov 2018 10:48:30 +0000 (10:48 +0000)]
[NFC] Simplify code by using standard exit blocks collection

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347454 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TI removal] Leverage the fact that TerminatorInst is gone to create
Chandler Carruth [Thu, 22 Nov 2018 10:31:35 +0000 (10:31 +0000)]
[TI removal] Leverage the fact that TerminatorInst is gone to create
a normal base class that provides all common "call" functionality.

This merges two complex CRTP mixins for the common "call" logic and
common operand bundle logic into a single, normal base class of
`CallInst` and `InvokeInst`. Going forward, users can typically
`dyn_cast<CallBase>` and use the resulting API. No more need for the
`CallSite` wrapper. I'm planning to migrate current usage of the wrapper
to directly use the base class and then it can be removed, but those are
simpler and much more incremental steps. The big change is to introduce
this abstraction into the type system.

I've tried to do some basic simplifications of the APIs that I couldn't
really help but touch as part of this:
- I've tried to organize the attribute API and bundle API into groups to
  make understanding the API of `CallBase` easier. Without this,
  I wasn't able to navigate the API sanely for all of the ways I needed
  to modify it.
- I've added what seem like more clear and consistent APIs for getting
  at the called operand. These ended up being especially useful to
  consolidate the *numerous* duplicated code paths trying to do this.
- I've largely reworked the organization and implementation of the APIs
  for computing the argument operands as they needed to change to work
  with the new subclass approach.

To minimize any cost associated with this abstraction, I've moved the
operand layout in memory to store the called operand last. This makes
its position relative to the end of the operand array the same,
regardless of the subclass. It should make it much cheaper to reference
from the `CallBase` abstraction, and this is likely one of the most
frequent things to query.

We do still pay one abstraction penalty here: we have to branch to
determine whether there are 0 or 2 extra operands when computing the end
of the argument operand sequence. However, that seems both rare and
should optimize well. I've implemented this in a way specifically
designed to allow it to optimize fairly well. If this shows up in
profiles, we can add overrides of the relevant methods to the subclasses
that bypass this penalty. It seems very unlikely that this will be an
issue as the code was *already* dealing with an ever present abstraction
of whether or not there are operand bundles, so this isn't the first
branch to go into the computation.

I've tried to remove as much of the obvious vestigial API surface of the
old CRTP implementation as I could, but I suspect there is further
cleanup that should now be possible, especially around the operand
bundle APIs. I'm leaving all of that for future work in this patch as
enough things are changing here as-is.

One thing that made this harder for me to reason about and debug was the
pervasive use of unsigned values in subtraction and other arithmetic
computations. I had to debug more than one unintentional wrap. I've
switched a few of these to use `int` which seems substantially simpler,
but I've held back from doing this more broadly to avoid creating
confusing divergence within a single class's API.

I also worked to remove all of the magic numbers used to index into
operands, putting them behind named constants or putting them into
a single method with a comment and strictly using the method elsewhere.
This was necessary to be able to re-layout the operands as discussed
above.

Thanks to Ben for reviewing this (somewhat large and awkward) patch!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347452 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r343473 "Move llvm util dependencies from clang-tools-extra to add_lit_target."
Haojian Wu [Thu, 22 Nov 2018 10:14:24 +0000 (10:14 +0000)]
Revert r343473 "Move llvm util dependencies from clang-tools-extra to add_lit_target."

Summary:
It will cause test tools `FileCheck`, `count`, `not` being built blindly, these
dependencies should move back to clang-tools-extra.

Reviewers: mgorny

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347448 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM GlobalISel] Add test for BFC. NFCI
Diana Picus [Thu, 22 Nov 2018 09:54:14 +0000 (09:54 +0000)]
[ARM GlobalISel] Add test for BFC. NFCI

r334871 has made it possible for TableGen'erated code to select BFC, but
it has not added a test for it on the ARM side. Add it now to make sure
we don't introduce regressions if we ever change anything about that
rule.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347447 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SystemZTTIImpl] Give correct cost values for vector bswap intrinsics.
Jonas Paulsson [Thu, 22 Nov 2018 07:17:29 +0000 (07:17 +0000)]
[SystemZTTIImpl]  Give correct cost values for vector bswap intrinsics.

Implement getIntrinsicInstrCost() and return costs reflecting that bswap can
be done with a vperm per vector register.

Review: Ulrich Weigand
https://reviews.llvm.org/D54789

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347445 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-size] Use empty() and range-based for loop. NFC
Fangrui Song [Thu, 22 Nov 2018 00:44:17 +0000 (00:44 +0000)]
[llvm-size] Use empty() and range-based for loop. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347441 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Add test case (NFC)
Evandro Menezes [Thu, 22 Nov 2018 00:38:36 +0000 (00:38 +0000)]
[llvm-mca] Add test case (NFC)

Add test case that will serve as the base for D54820.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347440 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] use FileCheck to verify output; NFC
Sanjay Patel [Wed, 21 Nov 2018 23:39:19 +0000 (23:39 +0000)]
[x86] use FileCheck to verify output; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347438 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Add test case (NFC)
Evandro Menezes [Wed, 21 Nov 2018 23:36:40 +0000 (23:36 +0000)]
[llvm-mca] Add test case (NFC)

Fix previous commit r347434.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347437 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd a ubsan blacklist entry for libstdc++ 8.0.1.
Peter Collingbourne [Wed, 21 Nov 2018 23:04:39 +0000 (23:04 +0000)]
Add a ubsan blacklist entry for libstdc++ 8.0.1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347436 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Add test case (NFC)
Evandro Menezes [Wed, 21 Nov 2018 22:57:46 +0000 (22:57 +0000)]
[llvm-mca] Add test case (NFC)

Add test case that will serve as the base for D54777.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347434 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemoving test/MC/Mips/reloc-directive-label-offset.s temporarily
Vladimir Stefanovic [Wed, 21 Nov 2018 22:08:34 +0000 (22:08 +0000)]
Removing test/MC/Mips/reloc-directive-label-offset.s temporarily

This test is failing on llvm-clang-x86_64-expensive-checks-win builder.
Removing it until I get it fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347433 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PM] correcting return value for new-pass-manager version of Scalarizer
Fedor Sergeev [Wed, 21 Nov 2018 22:01:19 +0000 (22:01 +0000)]
[PM] correcting return value for new-pass-manager version of Scalarizer

Obvious mistake missed during D54695 review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347432 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mingw] Use unmangled name after the $ in the section name
Reid Kleckner [Wed, 21 Nov 2018 22:01:10 +0000 (22:01 +0000)]
[mingw] Use unmangled name after the $ in the section name

GCC does it this way, and we have to be consistent. This includes
stdcall and fastcall functions with suffixes. I confirmed that a
fastcall function named "foo" ends up in ".text$foo", not
".text$@foo@8".

Based on a patch by Andrew Yohn!

Fixes PR39218.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347431 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC][NFC] Split PPCMCCodeEmitter into header and cpp file.
Stefan Pintilie [Wed, 21 Nov 2018 21:23:50 +0000 (21:23 +0000)]
[PowerPC][NFC] Split PPCMCCodeEmitter into header and cpp file.

This is further cleanup for PPCMCCodeEmitter. The class had been contained
within the cpp file alone. Now it has been split up between a header file and
a cpp file which allows other classes to make use of the functions in this class
if required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347428 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] refactor select-of-FP-constants transform
Sanjay Patel [Wed, 21 Nov 2018 20:54:47 +0000 (20:54 +0000)]
[DAGCombiner] refactor select-of-FP-constants transform

This transform needs to be limited.

We are converting to a constant pool load very early, and we
are turning loads that are independent of the select condition
(and therefore speculatable) into a dependent non-speculatable
load.

We may also be transferring a condition code from an FP register
to integer to create that dependent load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347424 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC][NFC] Minor Code Cleaup for PPCMCCodeEmitter.
Stefan Pintilie [Wed, 21 Nov 2018 20:47:59 +0000 (20:47 +0000)]
[PowerPC][NFC] Minor Code Cleaup for PPCMCCodeEmitter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347422 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLVM] Allow modulemap installation
Eric Fiselier [Wed, 21 Nov 2018 20:46:50 +0000 (20:46 +0000)]
[LLVM] Allow modulemap installation

Summary:
Currently we can't install the modulemaps provided by LLVM, since they are not structured to support headers generated as part of the build (ex. `llvm/IR/Attributes.gen`).
This patch restructures the module maps in order to support installation.

Modules containing generated headers are defined in the new `module.extern.modulemap` file, and are referenced from the main `module.modulemap` using `extern module`. There are two versions of the `module.extern.modulemap` file; one used when building and another, `module.install.modulemap`, which is re-named during installation.

Users can opt-into module map installation using `-DLLVM_INSTALL_MODULEMAPS=ON`.  The default value is `OFF` due to llvm.org/PR31905.

Reviewers: rsmith, mehdi_amini, bruno, EricWF

Reviewed By: EricWF

Subscribers: tschuett, chapuni, mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347420 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Add tests for funnel shift with zero operand; NFC
Nikita Popov [Wed, 21 Nov 2018 20:34:11 +0000 (20:34 +0000)]
[InstCombine] Add tests for funnel shift with zero operand; NFC

These are additional baseline tests for D54778.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347414 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] reduce code duplication; NFC
Sanjay Patel [Wed, 21 Nov 2018 20:00:32 +0000 (20:00 +0000)]
[DAGCombiner] reduce code duplication; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347410 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MergeFuncs] Generate alias instead of thunk if possible
Nikita Popov [Wed, 21 Nov 2018 19:37:19 +0000 (19:37 +0000)]
[MergeFuncs] Generate alias instead of thunk if possible

The MergeFunctions pass was originally intended to emit aliases
instead of thunks where possible (unnamed_addr). However, for a
long time this functionality was behind a flag hardcoded to false,
bitrotted and was eventually removed in r309313.

Originally the functionality was first disabled in r108417 due to
lack of support for aliases in Mach-O. I believe that this is no
longer the case nowadays, but not really familiar with this area.

In the interest of being conservative, this patch reintroduces the
aliasing functionality behind a default disabled -mergefunc-use-aliases
flag.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347407 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add tests for select-of-FP-constants; NFC
Sanjay Patel [Wed, 21 Nov 2018 19:14:38 +0000 (19:14 +0000)]
[x86] add tests for select-of-FP-constants; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347406 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] fix predicate for avoiding vblendv
Sanjay Patel [Wed, 21 Nov 2018 18:02:50 +0000 (18:02 +0000)]
[x86] fix predicate for avoiding vblendv

It only makes sense to produce the logic ops when 1 of the
constants is +0.0. Otherwise, go with vblendv to reduce code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347403 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add test for FP select with constant; NFC
Sanjay Patel [Wed, 21 Nov 2018 17:47:18 +0000 (17:47 +0000)]
[x86] add test for FP select with constant; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347401 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips][mc] Add basic support for R_MIPS_JALR/R_MICROMIPS_JALR
Vladimir Stefanovic [Wed, 21 Nov 2018 16:38:34 +0000 (16:38 +0000)]
[mips][mc] Add basic support for R_MIPS_JALR/R_MICROMIPS_JALR

R_MIPS_JALR/R_MICROMIPS_JALR can now be parsed in .s files and emitted to .o.
They are still not generated with JALR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347398 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MC] Support labels as offsets in .reloc directive
Vladimir Stefanovic [Wed, 21 Nov 2018 16:28:39 +0000 (16:28 +0000)]
[MC] Support labels as offsets in .reloc directive

Currently, expressions like

  .reloc 1f, R_MIPS_JALR, foo
  1: nop

are not allowed, ie. an offset in .reloc can only be absolute value.
This patch adds support for labels as offsets.
If offset is a forward declared label, MCObjectStreamer keeps the fixup locally
and adds it to the fixups vector after the label (and its offset) is defined.
label+number is not supported yet.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347397 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add checks for asm to test; NFC
Sanjay Patel [Wed, 21 Nov 2018 15:26:35 +0000 (15:26 +0000)]
[x86] add checks for asm to test; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347394 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetLowering] SimplifyDemandedBits - only reduce known bits for integer constants
Simon Pilgrim [Wed, 21 Nov 2018 14:26:19 +0000 (14:26 +0000)]
[TargetLowering] SimplifyDemandedBits - only reduce known bits for integer constants

Avoids fuzzing crash found by Mikael Holmén.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347393 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PM] Port Scalarizer to the new pass manager.
Mikael Holmen [Wed, 21 Nov 2018 14:00:17 +0000 (14:00 +0000)]
[PM] Port Scalarizer to the new pass manager.

Patch by: markus (Markus Lavin)

Reviewers: chandlerc, fedor.sergeev

Reviewed By: fedor.sergeev

Subscribers: llvm-commits, Ka-Ka, bjope

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347392 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[nios2] Add missing Nios2CodeGen -> Nios2AsmPrinter linkage
Michal Gorny [Wed, 21 Nov 2018 11:25:01 +0000 (11:25 +0000)]
[nios2] Add missing Nios2CodeGen -> Nios2AsmPrinter linkage

Add missing linkage from Nios2CodeGen library to Nios2AsmPrinter
library.  The missing dependency causes shared-lib build to fail with
the following reason:

  lib/Target/Nios2/CMakeFiles/LLVMNios2CodeGen.dir/Nios2AsmPrinter.cpp.o: In function `(anonymous namespace)::Nios2AsmPrinter::PrintAsmMemoryOperand(llvm::MachineInstr const*, unsigned int, unsigned int, char const*, llvm::raw_ostream&)':
  Nios2AsmPrinter.cpp:(.text._ZN12_GLOBAL__N_115Nios2AsmPrinter21PrintAsmMemoryOperandEPKN4llvm12MachineInstrEjjPKcRNS1_11raw_ostreamE+0x2b): undefined reference to `llvm::Nios2InstPrinter::getRegisterName(unsigned int)'
  lib/Target/Nios2/CMakeFiles/LLVMNios2CodeGen.dir/Nios2AsmPrinter.cpp.o: In function `(anonymous namespace)::Nios2AsmPrinter::PrintAsmOperand(llvm::MachineInstr const*, unsigned int, unsigned int, char const*, llvm::raw_ostream&)':
  Nios2AsmPrinter.cpp:(.text._ZN12_GLOBAL__N_115Nios2AsmPrinter15PrintAsmOperandEPKN4llvm12MachineInstrEjjPKcRNS1_11raw_ostreamE+0x97): undefined reference to `llvm::Nios2InstPrinter::getRegisterName(unsigned int)'
  collect2: error: ld returned 1 exit status

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347387 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] Remove BROADCAST if we only need the 0'th element
Simon Pilgrim [Wed, 21 Nov 2018 11:00:09 +0000 (11:00 +0000)]
[X86][AVX] Remove BROADCAST if we only need the 0'th element

We don't catch this with target shuffle simplification if the src/dst types are different.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347386 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit: Delete trailing space in comment
Nikita Popov [Wed, 21 Nov 2018 10:57:22 +0000 (10:57 +0000)]
Test commit: Delete trailing space in comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347385 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] More complex tests for LoopSimplifyCFG
Max Kazantsev [Wed, 21 Nov 2018 09:55:09 +0000 (09:55 +0000)]
[NFC] More complex tests for LoopSimplifyCFG

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347384 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Add some sophisticated tests on LoopSimplifyCFG
Max Kazantsev [Wed, 21 Nov 2018 07:22:06 +0000 (07:22 +0000)]
[NFC] Add some sophisticated tests on LoopSimplifyCFG

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347381 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] In getScalarMaskingNode, replace scalar_to_vector with a bitcast to v8i1 and...
Craig Topper [Wed, 21 Nov 2018 07:01:22 +0000 (07:01 +0000)]
[X86] In getScalarMaskingNode, replace scalar_to_vector with a bitcast to v8i1 and an extract_subvector to convert i8 to v1i1.

The bitcast can be nicely merged with any i8 loads that exist for argument passing in 32 mode for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347380 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LVI] run transfer function for binary operator even when the RHS isn't a constant
John Regehr [Wed, 21 Nov 2018 05:24:12 +0000 (05:24 +0000)]
[LVI] run transfer function for binary operator even when the RHS isn't a constant

LVI was symbolically executing binary operators only when the RHS was
constant, missing the case where we have a ConstantRange for the RHS,
but not an actual constant. Tested using check-all and by
bootstrapping. Compile time is not impacted measurably.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347379 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Do not use vectors to codegen bswap with Altivec turned off
Nemanja Ivanovic [Wed, 21 Nov 2018 02:53:50 +0000 (02:53 +0000)]
[PowerPC] Do not use vectors to codegen bswap with Altivec turned off

We have efficient codegen on P9 for lowering bswap that involves moving
the value into a vector reg and moving it back. However, the check under
which we custom lowered it did not adequately reflect the actual requirements.
It required only that the subtarget be an implementation of ISA 3.0 since all
compliant implementations have to provide the vector instructions.
However, the kernel builds have a valid use case for -mno-altivec -mcpu=pwr9
(i.e. don't emit vector code, don't have to save vector regs for context
switch). So we should require the correct features for this lowering.
Fixes https://bugs.llvm.org/show_bug.cgi?id=39334

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347376 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Correct 256 vpmovzx/vpmovsx isel patterns to check HasAVX2 instead of HasAVX...
Craig Topper [Wed, 21 Nov 2018 01:39:38 +0000 (01:39 +0000)]
[X86] Correct 256 vpmovzx/vpmovsx isel patterns to check HasAVX2 instead of HasAVX to prevent fast-isel from using them incorrectly.

These are AVX2 instructions, but have been incorrectly marked in tablegen for a while. This wasn't a problem until r346784 switched the patterns to use target independent ISD opcodes. This made the patterns visible to fast isel.

Fixes PR39733

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347375 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add a copy of avx512-trunc.ll with -x86-experimental-vector-widening-legalizati...
Craig Topper [Wed, 21 Nov 2018 01:39:35 +0000 (01:39 +0000)]
[X86] Add a copy of avx512-trunc.ll with -x86-experimental-vector-widening-legalization enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347374 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Add C++ Performance Benchmark to test-suite proposals.
Michael Kruse [Wed, 21 Nov 2018 00:34:02 +0000 (00:34 +0000)]
[docs] Add C++ Performance Benchmark to test-suite proposals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347369 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Emit a PACKUS instead of a VECTOR_SHUFFLE from LowerTRUNCATE for v16i16->v16i8.
Craig Topper [Tue, 20 Nov 2018 22:57:48 +0000 (22:57 +0000)]
[X86] Emit a PACKUS instead of a VECTOR_SHUFFLE from LowerTRUNCATE for v16i16->v16i8.

We can't guarantee that demanded bits passing through the vector shuffle won't cause the AND in front of this to be removed. This would prevent the PACKUS from being matched during shuffle lowering.

Unfortunately, this adds a packuswb to one of the vector-reduce-mul.ll tests since we were removing the shuffle via SimplifyDemandedVectorElts. We appear to have similar issues with vpmovwb on the same test case on other targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347361 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix pointer options mask. It was off by 1 bit.
Zachary Turner [Tue, 20 Nov 2018 22:53:40 +0000 (22:53 +0000)]
Fix pointer options mask.  It was off by 1 bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347359 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] look through bitcasts when trying to narrow vector binops
Sanjay Patel [Tue, 20 Nov 2018 22:26:35 +0000 (22:26 +0000)]
[DAGCombiner] look through bitcasts when trying to narrow vector binops

This is another step in vector narrowing - a follow-up to D53784
(and hoping to eventually squash potential regressions seen in
D51553).

The x86 test diffs are wins, but the AArch64 diff is probably not.
That problem already exists independent of this patch (see PR39722), but it
went unnoticed in the previous patch because there were no regression tests
that showed the possibility.

The x86 diff in i64-mem-copy.ll is close. Given the frequency throttling
concerns with using wider vector ops, an extra extract to reduce vector
width is the right trade-off at this level of codegen.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347356 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeView] Add support for ref-qualified member functions.
Zachary Turner [Tue, 20 Nov 2018 22:13:43 +0000 (22:13 +0000)]
[CodeView] Add support for ref-qualified member functions.

When you have a member function with a ref-qualifier, for example:

struct Foo {
  void Func() &;
  void Func2() &&;
};

clang-cl was not emitting this information. Doing so is a bit
awkward, because it's not a property of the LF_MFUNCTION type, which
is what you'd expect. Instead, it's a property of the this pointer
which is actually an LF_POINTER. This record has an attributes
bitmask on it, and our handling of this bitmask was all wrong. We
had some parts of the bitmask defined incorrectly, but importantly
for this bug, we didn't know about these extra 2 bits that represent
the ref qualifier at all.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347354 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeView] Mark this pointers as const.
Zachary Turner [Tue, 20 Nov 2018 22:13:23 +0000 (22:13 +0000)]
[CodeView] Mark this pointers as const.

This is for compatibility with MSVC, which also marks this pointers
as being const-qualified.

Fixes llvm.org/pr36526

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347353 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeView] RelocPtr points to little endian data.
Zachary Turner [Tue, 20 Nov 2018 21:30:11 +0000 (21:30 +0000)]
[CodeView] RelocPtr points to little endian data.

Don't use a uint32_t*, use a ulittle32_t* to make this correct
on big endian systems.

Patch by James Clarke
Differential Revision: https://reviews.llvm.org/D54421

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347349 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Emit a single shuffle for the v16i8->v4i32 step of a SIGN_EXTEND_VECTOR_INREG...
Craig Topper [Tue, 20 Nov 2018 21:21:52 +0000 (21:21 +0000)]
[X86] Emit a single shuffle for the v16i8->v4i32 step of a SIGN_EXTEND_VECTOR_INREG lowering on pre-sse4.1 targets.

Previously we emitted to separate shuffles, one for unpcklbw and one for unpcklwd. Instead emit a single shuffle equivalent to both of the original shuffles. Shuffle lowering seems able to handle it. This avoids a bitcast between the two shuffles which seems helpful to DAG combine.

Remove the custom type legalization for v8i8->v8i32. I had put that in to avoid some almost duplicate punpcklbw instructions I was seeing, but this lowering change seems to fix that. It also fixes some duplicate shuffles seen in vector-sext.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347348 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[unittests] Fix ExpandTilde test to match handling home dirs with trailing slash
Simon Atanasyan [Tue, 20 Nov 2018 21:13:51 +0000 (21:13 +0000)]
[unittests] Fix ExpandTilde test to match handling home dirs with trailing slash

The `expandTildeExpr` routine just replaces a tilde by a home dir path.
If the home dir has a trailing slash, the result of substitution will
contain double slashes. For example, `HOME=/foo/ ~/bar` gives `/foo//bar`.
That corresponds to (at least) Bash behaviour because the following
command `$HOME=/foo/ echo ~/bar` prints `/foo//bar`.

The `ExpandTilde` test constructs a path expected as the `fs::expand_tilde`
call result by calling `path::append` and the expected path has a single
slash. This patch fixes that and allows to pass the unittest on hosts where
the `HOME` is `/`.

Differential Revision: http://reviews.llvm.org/D54752

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347346 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSilence C4709 in MSVC because it is buggy.
Aaron Ballman [Tue, 20 Nov 2018 20:50:04 +0000 (20:50 +0000)]
Silence C4709 in MSVC because it is buggy.

The diagnostic will trigger on code that does not have any comma operator, but instead default-constructs an object with an explicitly defaulted constructor as the array index argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347345 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add tests for 8-bit multiply with constant; NFC
Sanjay Patel [Tue, 20 Nov 2018 19:45:53 +0000 (19:45 +0000)]
[x86] add tests for 8-bit multiply with constant; NFC

This is based on the existing file for 16-bit. We also already have 32-bit and 64-bit variants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347341 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] WebAssemblyLowerEmscriptenEHSjLj: use getter/setter for accessing tempRet0
Sam Clegg [Tue, 20 Nov 2018 19:25:07 +0000 (19:25 +0000)]
[WebAssembly] WebAssemblyLowerEmscriptenEHSjLj: use getter/setter for accessing tempRet0

Rather than assuming that `tempRet0` exists in linear memory only assume
the getter/setter functions exist.  This avoids conflicting with
binaryen which declares a wasm global for this purpose and defines it's
own getter and setter for that.

The other advantage of doing things this way is that it leaving
it up to the linker/finalizer to decide how to actually store this
temporary.  As it happens binaryen uses a wasm global which is more
appropriate since it is thread safe.

This also allows us to change the way this is stored in the future
(memory, TLS memory, wasm global) without modifying LLVM.

This is part of a 4 part change:
LLVM: https://reviews.llvm.org/D53240
fastcomp: https://github.com/kripken/emscripten-fastcomp/pull/237
emscripten: https://github.com/kripken/emscripten/pull/7358
binaryen: https://github.com/WebAssembly/binaryen/pull/1709

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347340 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[unittest] Skip W+X MappedMemoryTests when MPROTECT is enabled
Michal Gorny [Tue, 20 Nov 2018 18:38:11 +0000 (18:38 +0000)]
[unittest] Skip W+X MappedMemoryTests when MPROTECT is enabled

Skip all MappedMemoryTest variants that rely on memory pages being
mapped for MF_WRITE|MF_EXEC when MPROTECT is enabled on NetBSD.  W^X
protection causes all those mmap() calls to fail, causing the tests
to fail.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347337 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove -verify-machineinstrs=0 now that PR38391 is fixed.
Simon Pilgrim [Tue, 20 Nov 2018 18:08:56 +0000 (18:08 +0000)]
[X86] Remove -verify-machineinstrs=0 now that PR38391 is fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347335 91177308-0d34-0410-b5e6-96231b3b80d8