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.
llvm-svn: 347534
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.
llvm-svn: 347533
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
llvm-svn: 347532
Bill Wendling [Mon, 26 Nov 2018 02:10:53 +0000 (02:10 +0000)]
A "constexpr" is evaluated in a constant context. Make sure this is reflected
if a __builtin_constant_p() is a part of a constexpr.
llvm-svn: 347531
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
llvm-svn: 347530
Fangrui Song [Sun, 25 Nov 2018 20:57:05 +0000 (20:57 +0000)]
[CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC
Use range-based for loops
Use XStr.compare(YStr) < 0
Format misaligned code
llvm-svn: 347529
Florian Hahn [Sun, 25 Nov 2018 19:38:02 +0000 (19:38 +0000)]
[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC)
llvm-svn: 347528
Sanjay Patel [Sun, 25 Nov 2018 17:53:16 +0000 (17:53 +0000)]
[CodeGen] translate MS rotate builtins to LLVM funnel-shift intrinsics
This was originally part of:
D50924
and should resolve PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387
...but it was reverted because some bots using a gcc host compiler
would crash for unknown reasons with this included in the patch.
Trying again now to see if that's still a problem.
llvm-svn: 347527
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.
llvm-svn: 347526
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.
llvm-svn: 347525
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.
llvm-svn: 347524
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.
llvm-svn: 347523
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.
llvm-svn: 347522
Kang Zhang [Sun, 25 Nov 2018 02:56:49 +0000 (02:56 +0000)]
add Kang Zhang(shkzhang@cn.ibm.com) to the CREDITS.TXT
llvm-svn: 347521
Alexander Kornienko [Sun, 25 Nov 2018 02:41:01 +0000 (02:41 +0000)]
A bit of AST matcher cleanup, NFC.
Removed the uses of the allOf() matcher inside node matchers that are implicit
allOf(). Replaced uses of allOf() with the explicit node matcher where it makes
matchers more readable. Replace anyOf(hasName(), hasName(), ...) with the more
efficient and readable hasAnyName().
llvm-svn: 347520
Benjamin Kramer [Sat, 24 Nov 2018 20:57:03 +0000 (20:57 +0000)]
[X86][compiler-rt] Add missing semicolon
llvm-svn: 347519
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.
llvm-svn: 347518
Craig Topper [Sat, 24 Nov 2018 20:25:45 +0000 (20:25 +0000)]
[X86] Make conversion of feature bits into a mask explicitly unsigned by using 1U instead of 1.
llvm-svn: 347517
Craig Topper [Sat, 24 Nov 2018 20:14:03 +0000 (20:14 +0000)]
[X86][compiler-rt] Attempt to fix a warning about a shift amount being negative in a macro expansion.
llvm-svn: 347516
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
llvm-svn: 347515
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.
llvm-svn: 347514
Kristof Umann [Sat, 24 Nov 2018 12:24:27 +0000 (12:24 +0000)]
[analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker
This checker implements a solution to the "INT50-CPP. Do not cast to an
out-of-range enumeration value" rule [1].
It lands in alpha for now, and a number of followup patches are planned in order
to enable it by default.
[1] https://www.securecoding.cert.org/confluence/display/cplusplus/INT50-CPP.+Do+not+cast+to+an+out-of-range+enumeration+value
Patch by: Endre Fülöp and Alexander Zaitsev!
Differential Revision: https://reviews.llvm.org/D33672
llvm-svn: 347513
Bill Wendling [Sat, 24 Nov 2018 10:45:55 +0000 (10:45 +0000)]
isEvaluatable() implies a constant context.
Assume that we're in a constant context if we're asking if the expression can
be compiled into a constant initializer. This fixes the issue where a
__builtin_constant_p() in a compound literal was diagnosed as not being
constant, even though it's always possible to convert the builtin into a
constant.
llvm-svn: 347512
Joel Jones [Sat, 24 Nov 2018 07:26:55 +0000 (07:26 +0000)]
Revert unapproved commit
llvm-svn: 347511
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
llvm-svn: 347510
Marc-Andre Laperle [Sat, 24 Nov 2018 02:53:17 +0000 (02:53 +0000)]
[clangd] Add 'Switch header/source' command in clangd-vscode
Summary:
Alt+o is used on Windows/Linux and Option+Cmd+o on macOS.
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
Reviewers: hokein, ilya-biryukov, ioeric
Reviewed By: ioeric
Subscribers: sammccall, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54781
llvm-svn: 347509
Fangrui Song [Sat, 24 Nov 2018 00:41:13 +0000 (00:41 +0000)]
[CodeComplete] Delete unused variable in rC342449
llvm-svn: 347508
Fangrui Song [Sat, 24 Nov 2018 00:14:31 +0000 (00:14 +0000)]
[CodeComplete] Format SemaCodeComplete.cpp and improve code consistency
There are some mis-indented places and missing spaces here and there. Just format the whole file.
Also, newer code (from 2014 onwards) in this file prefers const auto *X = dyn_cast to not repeat the Decl type name. Make other occurrences consistent.
Remove two anonymous namespaces that are not very necessary: 1) a typedef 2) a local function (should use static)
llvm-svn: 347507
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
llvm-svn: 347506
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
llvm-svn: 347505
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
llvm-svn: 347504
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
llvm-svn: 347503
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.
llvm-svn: 347502
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.
llvm-svn: 347501
Luke Cheeseman [Fri, 23 Nov 2018 17:13:47 +0000 (17:13 +0000)]
Revert r347491 as it's llvm counterpart breaks buildbots
llvm-svn: 347500
Luke Cheeseman [Fri, 23 Nov 2018 17:13:06 +0000 (17:13 +0000)]
Revert r347490 as it breaks address sanitizer builds
llvm-svn: 347499
Ilya Biryukov [Fri, 23 Nov 2018 15:21:19 +0000 (15:21 +0000)]
[clangd] Add support for hierarchical documentSymbol
Reviewers: ioeric, sammccall, simark
Reviewed By: sammccall
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D52311
llvm-svn: 347498
George Rimar [Fri, 23 Nov 2018 15:13:26 +0000 (15:13 +0000)]
[LLD][ELF] - Simplify. NFCI.
This makes getRISCVPCRelHi20 to be static local helper,
and rotates the 'if' condition.
llvm-svn: 347497
Benjamin Kramer [Fri, 23 Nov 2018 15:02:33 +0000 (15:02 +0000)]
Remove the optional dependency from libclang to clang-tidy/include-fixer
clangd does a better job on both of these, so don't slow down everyone's build
for a poorly working libclang feature.
llvm-svn: 347496
Alexander Kornienko [Fri, 23 Nov 2018 14:30:14 +0000 (14:30 +0000)]
[clang-tidy] Ignore matches in template instantiations (cert-dcl21-cpp)
The test fails with a local modification to
clang-tidy/ClangTidyDiagnosticConsumer.cpp to include fixes into the key when
deduplicating the warnings.
llvm-svn: 347495
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
llvm-svn: 347494
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.
llvm-svn: 347493
Eugene Leviant [Fri, 23 Nov 2018 11:28:58 +0000 (11:28 +0000)]
Attempt to fix buildbot after r347489
llvm-svn: 347492
Luke Cheeseman [Fri, 23 Nov 2018 11:03:00 +0000 (11:03 +0000)]
Revert r343342 together with LLVM commit 347490.
llvm-svn: 347491
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.
llvm-svn: 347490
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
llvm-svn: 347489
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
llvm-svn: 347488
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
llvm-svn: 347487
Max Kazantsev [Fri, 23 Nov 2018 09:14:53 +0000 (09:14 +0000)]
Disable LoopSimplifyCFG terminator folding by default
llvm-svn: 347486
George Rimar [Fri, 23 Nov 2018 07:59:28 +0000 (07:59 +0000)]
[LLD][ELF] - Fix mistype. NFC.
llvm-svn: 347485
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
llvm-svn: 347484
Max Kazantsev [Fri, 23 Nov 2018 05:21:53 +0000 (05:21 +0000)]
[NFC] Add verification flags to tests
llvm-svn: 347483
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.
llvm-svn: 347482
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.
llvm-svn: 347481
Bill Wendling [Thu, 22 Nov 2018 22:58:06 +0000 (22:58 +0000)]
A __builtin_constant_p() returns 0 with a function type.
llvm-svn: 347480
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.
llvm-svn: 347479
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
llvm-svn: 347478
Louis Dionne [Thu, 22 Nov 2018 19:10:28 +0000 (19:10 +0000)]
[NFC] Fix typo in comment
llvm-svn: 347477
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.
llvm-svn: 347476
Louis Dionne [Thu, 22 Nov 2018 17:43:22 +0000 (17:43 +0000)]
[libcxx] Reintroduce UNSUPPORTED annotation for strstreambuf overflow test
This is a revert of r347421, except I'm using the with_system_cxx_lib
lit feature instead of availability to mark the test as unsupported
(because the problem is a bug in the dylib itself). In r347421, I said
I wasn't able to reproduce the issue and that's why I was removing it:
this was because I ran lit slightly wrong. The problem mentioned really
exists.
llvm-svn: 347475
Ilya Biryukov [Thu, 22 Nov 2018 17:27:08 +0000 (17:27 +0000)]
[clangd] Cleanup: make the diags callback global in TUScheduler
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54760
llvm-svn: 347474
Louis Dionne [Thu, 22 Nov 2018 16:38:03 +0000 (16:38 +0000)]
[libcxx] Add XFAIL for test on OS X 10.12 to 10.14
llvm-svn: 347473
Ilya Biryukov [Thu, 22 Nov 2018 16:20:12 +0000 (16:20 +0000)]
[clangd] Cleanup error consumption code. NFC
- Remove reimplementations of llvm::consumeError.
- Simplify test code by using EXPECT_ERROR where it fits.
llvm-svn: 347472
Louis Dionne [Thu, 22 Nov 2018 16:10:49 +0000 (16:10 +0000)]
[NFC][libcxx] Print human-friendly command line when lit test fails
We used to print a Python list corresponding to the command. It is more
useful to print the joined string so it can be copy/pasted directly when
a test fails.
llvm-svn: 347471
Alexander Kornienko [Thu, 22 Nov 2018 16:10:18 +0000 (16:10 +0000)]
[clang-tidy] Ignore template instantiations in modernize-use-using
The test I'm adding passes without the change due to the deduplication logic in
ClangTidyDiagnosticConsumer::take(). However this bug manifests in our internal
integration with clang-tidy.
I've verified the fix by locally changing LessClangTidyError to consider
replacements.
llvm-svn: 347470
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%.
llvm-svn: 347469
Ilya Biryukov [Thu, 22 Nov 2018 15:39:54 +0000 (15:39 +0000)]
[clangd] Cleanup: make diagnostics callbacks from TUScheduler non-racy
Summary:
Previously, removeDoc followed by an addDoc to TUScheduler resulted in
racy diagnostic responses, i.e. the old dianostics could be delivered
to the client after the new ones by TUScheduler.
To workaround this, we tracked a version number in ClangdServer and
discarded stale diagnostics. After this commit, the TUScheduler will
stop delivering diagnostics for removed files and the workaround in
ClangdServer is not required anymore.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54829
llvm-svn: 347468
Eric Liu [Thu, 22 Nov 2018 15:02:05 +0000 (15:02 +0000)]
[clangd] Cleanup: stop passing around list of supported URI schemes.
Summary:
Instead of passing around a list of supported URI schemes in clangd, we
expose an interface to convert a path to URI using any compatible scheme
that has been registered. It favors customized schemes and falls
back to "file" when no other scheme works.
Changes in this patch are:
- URI::create(AbsPath, URISchemes) -> URI::create(AbsPath). The new API finds a
compatible scheme from the registry.
- Remove URISchemes option everywhere (ClangdServer, SymbolCollecter, FileIndex etc).
- Unit tests will use "unittest" by default.
- Move "test" scheme from ClangdLSPServer to ClangdMain.cpp, and only
register the test scheme when lit-test or enable-lit-scheme is set.
(The new flag is added to make lit protocol.test work; I wonder if there
is alternative here.)
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54800
llvm-svn: 347467
Eric Liu [Thu, 22 Nov 2018 14:59:22 +0000 (14:59 +0000)]
[clangd] Cleanup: use index file instead of header in workspace symbols lit test.
Summary:
The full path of the input header depends on the execution environment
and may result in different behavior (e.g. when different URI schemes are used).
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54833
llvm-svn: 347466
Krasimir Georgiev [Thu, 22 Nov 2018 14:49:55 +0000 (14:49 +0000)]
[clang-format] Do not treat asm clobber [ as ObjCExpr, refined
Summary:
r346756 refined clang-format to not treat the `[` in `asm (...: [] ..)` as an
ObjCExpr. However that's not enough, as we might have a comma-separated list of
such clobbers as in the newly added test.
This updates the detection to instead look at the Line's first token being `asm`
and not mark `[`-s as ObjCExprs in this case.
Reviewers: djasper, benhamilton
Reviewed By: djasper, benhamilton
Subscribers: benhamilton, cfe-commits
Differential Revision: https://reviews.llvm.org/D54795
llvm-svn: 347465
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).
llvm-svn: 347464
Clement Courbet [Thu, 22 Nov 2018 14:26:33 +0000 (14:26 +0000)]
Revert rL347462 "[ASTMatchers] Add hasSideEffect() matcher."
Breaks some buildbots.
llvm-svn: 347463
Clement Courbet [Thu, 22 Nov 2018 14:00:56 +0000 (14:00 +0000)]
[ASTMatchers] Add hasSideEffect() matcher.
Summary: Exposes Expr::HasSideEffects.
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54830
llvm-svn: 347462
Louis Dionne [Thu, 22 Nov 2018 13:40:56 +0000 (13:40 +0000)]
[libcxx] Remove incorrect XFAIL on macos 10.12
llvm-svn: 347461
Benjamin Kramer [Thu, 22 Nov 2018 12:54:25 +0000 (12:54 +0000)]
[clangd] Fix use-after-scope in unit test
The scheduler holds a reference to `Proceed`, so it has to be destroyed
after the scheduler. Found by asan.
llvm-svn: 347460
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
llvm-svn: 347459
Max Kazantsev [Thu, 22 Nov 2018 12:43:27 +0000 (12:43 +0000)]
[NFC] Assert that all blocks staying in loop are live
llvm-svn: 347458
Max Kazantsev [Thu, 22 Nov 2018 12:33:41 +0000 (12:33 +0000)]
[NFC] Ensure deterministic order of dead exit blocks
llvm-svn: 347457
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.
llvm-svn: 347456
George Rimar [Thu, 22 Nov 2018 11:40:08 +0000 (11:40 +0000)]
[ELF] - Make SymbolTable::addDefined return Defined.
Now it returns Symbol. This should be NFC that
avoids doing cast at the caller's sides.
Differential revision: https://reviews.llvm.org/D54627
llvm-svn: 347455
Max Kazantsev [Thu, 22 Nov 2018 10:48:30 +0000 (10:48 +0000)]
[NFC] Simplify code by using standard exit blocks collection
llvm-svn: 347454
Clement Courbet [Thu, 22 Nov 2018 10:44:36 +0000 (10:44 +0000)]
[ASTMatchers] Re-generate ast matchers doc after rL346455.
llvm-svn: 347453
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
llvm-svn: 347452
David Carlier [Thu, 22 Nov 2018 10:31:01 +0000 (10:31 +0000)]
Unbreak FreeBSD build.
M lib/sanitizer_common/sanitizer_platform_limits_posix.cc
llvm-svn: 347451
Sam McCall [Thu, 22 Nov 2018 10:22:16 +0000 (10:22 +0000)]
[clangd] Respect task cancellation in TUScheduler.
Summary:
- Reads are never executed if canceled before ready-to run.
In practice, we finalize cancelled reads eagerly and out-of-order.
- Cancelled reads don't prevent prior updates from being elided, as they don't
actually depend on the result of the update.
- Updates are downgraded from WantDiagnostics::Yes to WantDiagnostics::Auto when
cancelled, which allows them to be elided when all dependent reads are
cancelled and there are subsequent writes. (e.g. when the queue is backed up
with cancelled requests).
The queue operations aren't optimal (we scan the whole queue for cancelled
tasks every time the scheduler runs, and check cancellation twice in the end).
However I believe these costs are still trivial in practice (compared to any
AST operation) and the logic can be cleanly separated from the rest of the
scheduler.
Reviewers: ilya-biryukov
Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54746
llvm-svn: 347450
Haojian Wu [Thu, 22 Nov 2018 10:14:55 +0000 (10:14 +0000)]
Move the llvm lit test dependencies to clang-tools-extra.
Summary: Part of revert r343473
Reviewers: mgorny
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54798
llvm-svn: 347449
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
llvm-svn: 347448
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.
llvm-svn: 347447
Bill Wendling [Thu, 22 Nov 2018 09:31:08 +0000 (09:31 +0000)]
The result of is.constant() is unsigned.
llvm-svn: 347446
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
llvm-svn: 347445
Petr Hosek [Thu, 22 Nov 2018 02:36:47 +0000 (02:36 +0000)]
[Driver] Support XRay on Fuchsia
This enables support for XRay in Fuchsia Clang driver.
Differential Revision: https://reviews.llvm.org/D52160
llvm-svn: 347444
Petr Hosek [Thu, 22 Nov 2018 02:00:44 +0000 (02:00 +0000)]
[XRay] Support for Fuchsia
This extends XRay to support Fuchsia.
Differential Revision: https://reviews.llvm.org/D52162
llvm-svn: 347443
Peter Collingbourne [Thu, 22 Nov 2018 00:47:37 +0000 (00:47 +0000)]
tsan: Update measurements in check_analyze.sh.
These changed as a result of r347379. Unfortunately there was a
regression; filed PR39748 to track it.
Differential Revision: https://reviews.llvm.org/D54821
llvm-svn: 347442
Fangrui Song [Thu, 22 Nov 2018 00:44:17 +0000 (00:44 +0000)]
[llvm-size] Use empty() and range-based for loop. NFC
llvm-svn: 347441
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.
llvm-svn: 347440
Peter Collingbourne [Thu, 22 Nov 2018 00:00:26 +0000 (00:00 +0000)]
tsan: Correct the name of an executable.
llvm-svn: 347439
Sanjay Patel [Wed, 21 Nov 2018 23:39:19 +0000 (23:39 +0000)]
[x86] use FileCheck to verify output; NFC
llvm-svn: 347438
Evandro Menezes [Wed, 21 Nov 2018 23:36:40 +0000 (23:36 +0000)]
[llvm-mca] Add test case (NFC)
Fix previous commit r347434.
llvm-svn: 347437
Peter Collingbourne [Wed, 21 Nov 2018 23:04:39 +0000 (23:04 +0000)]
Add a ubsan blacklist entry for libstdc++ 8.0.1.
llvm-svn: 347436
Louis Dionne [Wed, 21 Nov 2018 23:00:45 +0000 (23:00 +0000)]
[libcxx] Improve error message when an invalid directory is provided as use_system_cxx_lib
llvm-svn: 347435