Nico Weber [Tue, 17 Jul 2018 14:20:02 +0000 (14:20 +0000)]
Remove superfluous ; to fix -Wpedantic warning from gcc
llvm-svn: 337285
Simon Marchi [Tue, 17 Jul 2018 14:13:05 +0000 (14:13 +0000)]
[Tooling] Add operator== to CompileCommand
Summary:
It does the obvious thing of comparing all fields. This will be needed
for a clangd patch I have in the pipeline.
Subscribers: dblaikie, ilya-biryukov, ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D49265
llvm-svn: 337284
Florian Hahn [Tue, 17 Jul 2018 14:04:59 +0000 (14:04 +0000)]
[IPSCCP] Run Solve each time we resolved an undef in a function.
Once we resolved an undef in a function we can run Solve, which could
lead to finding a constant return value for the function, which in turn
could turn undefs into constants in other functions that call it, before
resolving undefs there.
Computationally the amount of work we are doing stays the same, just the
order we process things is slightly different and potentially there are
a few less undefs to resolve.
We are still relying on the order of functions in the IR, which means
depending on the order, we are able to resolve the optimal undef first
or not. For example, if @test1 comes before @testf, we find the constant
return value of @testf too late and we cannot use it while solving
@test1.
This on its own does not lead to more constants removed in the
test-suite, probably because currently we have to be very lucky to visit
applicable functions in the right order.
Maybe we manage to come up with a better way of resolving undefs in more
'profitable' functions first.
Reviewers: efriedma, mssimpso, davide
Reviewed By: efriedma, davide
Differential Revision: https://reviews.llvm.org/D49385
llvm-svn: 337283
Sander de Smalen [Tue, 17 Jul 2018 13:58:46 +0000 (13:58 +0000)]
[AArch64][SVE] Asm: FP fused multiply-add/subtract instructions.
This patch adds support for the following instructions:
FMLA mul-add, writing addend (Zda = Zda + Zn * Zm)
FNMLA negated mul-add, writing addend (Zda = -Zda + -Zn * Zm)
FMLS mul-sub, writing addend (Zda = Zda + -Zn * Zm)
FNMLS negated mul-sub, writing addend (Zda = -Zda + Zn * Zm)
FMAD mul-add, writing multiplicant (Zdn = Za + Zdn * Zm)
FNMAD negated mul-add, writing multiplicant (Zdn = -Za + -Zdn * Zm)
FMSB mul-sub, writing multiplicant (Zdn = Za + -Zdn * Zm)
FNMSB negated mul-sub, writing multiplicant (Zdn = -Za + Zdn * Zm)
llvm-svn: 337282
George Rimar [Tue, 17 Jul 2018 13:56:23 +0000 (13:56 +0000)]
[ELF] - Remove dead code from EhFrameSection::addCie. NFC.
Code was dead because caller of the addCie() already
checks that ID is equal to 0:
https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L431
llvm-svn: 337281
Simon Pilgrim [Tue, 17 Jul 2018 13:43:33 +0000 (13:43 +0000)]
[SLPVectorizer] Don't attempt horizontal reduction on pointer types (PR38191)
TTI::getMinMaxReductionCost typically can't handle pointer types - until this is changed its better to limit horizontal reduction to integer/float vector types only.
llvm-svn: 337280
Benjamin Kramer [Tue, 17 Jul 2018 13:17:01 +0000 (13:17 +0000)]
Revert "[Sema] Reword warning for constant captures that are not required"
This reverts commit r337152. This applies to non-constants too. The real
explanation is that the capture is not ODR-used, but putting that into
the warning message seems ... worse.
llvm-svn: 337278
Joerg Sonnenberger [Tue, 17 Jul 2018 13:13:34 +0000 (13:13 +0000)]
Always use __mcount on NetBSD. Some platforms don't provide _mcount.
llvm-svn: 337277
George Rimar [Tue, 17 Jul 2018 13:13:08 +0000 (13:13 +0000)]
[ELF] - Eliminate dead code. NFC.
Code was dead because at the moment of BssSection creation
it can never have a parent. Also, code simply does not
make sence as alignment adjastment happens when
BssSection is added to its parent later.
llvm-svn: 337276
Gabor Marton [Tue, 17 Jul 2018 12:39:27 +0000 (12:39 +0000)]
[ASTImporter] Fix poisonous structural equivalence cache
Summary:
Implementation functions call into the member functions of
ASTStructuralEquivalence, thus they can falsely alter the DeclsToCheck state
(they add decls). This results that some leaf declarations can be stated as
inequivalent as a side effect of one inequivalent element in the DeclsToCheck
list. And since we store the non-equivalencies, any (otherwise independent)
decls will be rendered as non-equivalent. Solution: I tried to clearly
separate the implementation functions (the static ones) and the public
interface. From now on, the implementation functions do not call any public
member functions, only other implementation functions.
Reviewers: a.sidorin, a_sidorin, r.stahl
Subscribers: rnkovacs, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D49300
llvm-svn: 337275
Joerg Sonnenberger [Tue, 17 Jul 2018 12:38:57 +0000 (12:38 +0000)]
For NetBSD, unwind data is emitted by default, so also enable frame
pointer optimisation by default when using optimisation.
llvm-svn: 337274
Tim Renouf [Tue, 17 Jul 2018 12:38:39 +0000 (12:38 +0000)]
More fixes for subreg join failure in RegCoalescer
Summary:
Part of the adjustCopiesBackFrom method wasn't correctly dealing with SubRange
intervals when updating.
2 changes. The first to ensure that bogus SubRange Segments aren't propagated when
encountering Segments of the form [1234r, 1234d:0) when preparing to merge value
numbers. These can be removed in this case.
The second forces a shrinkToUses call if SubRanges end on the copy index
(instead of just the parent register).
V2: Addressed review comments, plus MIR test instead of ll test
Subscribers: MatzeB, qcolombet, nhaehnle
Differential Revision: https://reviews.llvm.org/D40308
Change-Id: I1d2b2b4beea802fce11da01edf71feb2064aab05
llvm-svn: 337273
Sander de Smalen [Tue, 17 Jul 2018 12:36:08 +0000 (12:36 +0000)]
[AArch64][SVE] Asm: Support for predicated FP operations (FP immediate)
This patch completes support for the following floating point
instructions that take FP immediates:
FADD* (addition)
FSUB (subtract)
FSUBR (subtract reverse form)
FMUL* (multiplication)
FMAX* (maximum)
FMAXNM (maximum number)
FMIN (maximum)
FMINNM (maximum number)
All operations are predicated and take a FP immediate operand,
e.g.
fadd z0.h, p0/m, z0.h, #0.5
fmin z0.s, p0/m, z0.s, #1.0
^___________^ (tied)
* Instructions added in a previous patch.
llvm-svn: 337272
Joerg Sonnenberger [Tue, 17 Jul 2018 12:33:19 +0000 (12:33 +0000)]
By popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64
to long for consistency with other 64bit platforms.
llvm-svn: 337271
Chen Zheng [Tue, 17 Jul 2018 12:31:54 +0000 (12:31 +0000)]
[NFC][testcases] add testcases for folding srem whose operands are negatived.
Finish same optimization for add instruction in D49216 and sdiv instruction in
D49382. This patch is for srem instruction.
llvm-svn: 337270
Joerg Sonnenberger [Tue, 17 Jul 2018 12:30:34 +0000 (12:30 +0000)]
Don't assert that a size_t fits into 64bit.
Avoids tautological compare warnings on 32bit platforms.
llvm-svn: 337269
George Rimar [Tue, 17 Jul 2018 12:14:48 +0000 (12:14 +0000)]
[ELF] - Add test for checking unknown -color-diagnostics arguments.
This covers a following line with the test:
https://github.com/llvm-mirror/lld/blob/master/ELF/DriverUtils.cpp#L73
llvm-svn: 337268
Gabor Marton [Tue, 17 Jul 2018 12:06:36 +0000 (12:06 +0000)]
[ASTImporter] Fix import of unnamed structs
Summary:
D48773 simplified ASTImporter nicely, but it introduced a new error: Unnamed
structs are not imported correctly, if they appear in a recursive context.
This patch provides a fix for structural equivalency.
Reviewers: a.sidorin, a_sidorin, balazske, gerazo
Subscribers: rnkovacs, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D49296
llvm-svn: 337267
George Rimar [Tue, 17 Jul 2018 12:04:23 +0000 (12:04 +0000)]
[ELF] - Add a test for --no-warn-symbol-ordering.
Mentioned flag was never tested together with
--call-graph-ordering-file. And the following line
was uncovered:
https://github.com/llvm-mirror/lld/blob/master/ELF/Symbols.cpp#L248
llvm-svn: 337266
George Rimar [Tue, 17 Jul 2018 11:35:28 +0000 (11:35 +0000)]
[ELF] - Simplify Symbol::getSize(). NFC.
There are following symbols currently available:
DefinedKind, SharedKind, UndefinedKind, LazyArchiveKind, LazyObjectKind.
Our code calls getSize() only for first two and there
seems to be no reason to return 0 for the rest.
llvm-svn: 337265
whitequark [Tue, 17 Jul 2018 11:13:58 +0000 (11:13 +0000)]
[LLVM-C] Fix name mangling on AggressiveInstCombine
Similarly to rL336736, at least one more C API function does not
properly get declared as extern "C" due to a missing header, causing
name mangling and linking errors.
This patch fixes calls to LLVMAddAggressiveInstCombinerPass().
Differential Revision: https://reviews.llvm.org/D49416
Reviewed By: whitequark
llvm-svn: 337264
whitequark [Tue, 17 Jul 2018 10:57:39 +0000 (10:57 +0000)]
[LLVM-C] Add target triple normalization to the C API.
rL333307 was introduced to remove automatic target triple
normalization when calling sys::getDefaultTargetTriple(), arguing
that users of the latter already called Triple::normalize()
if necessary. However, users of the C API currently have no way of
doing target triple normalization.
This patch introduces an LLVMNormalizeTargetTriple function to
the C API which wraps Triple::normalize() and can be used on
the result of LLVMGetDefaultTargetTriple to achieve the same effect.
Differential Revision: https://reviews.llvm.org/D49414
Reviewed By: whitequark
llvm-svn: 337263
Benjamin Kramer [Tue, 17 Jul 2018 10:30:56 +0000 (10:30 +0000)]
[llvm-objcopy] Run not with any python, but the python configured in lit.
llvm-svn: 337262
Jonas Devlieghere [Tue, 17 Jul 2018 10:04:19 +0000 (10:04 +0000)]
Move pretty stack trace printer into driver.
We used to have a pretty stack trace printer in SystemInitializerCommon.
This was disabled on Apple because we didn't want the library to be
setting signal handlers, as this was causing issues when loaded into
Xcode. However, I think it's useful to have this for the LLDB driver, so
I moved it up to use the PrettyStackTraceProgram in the driver's main.
Differential revision: https://reviews.llvm.org/D49377
llvm-svn: 337261
Balazs Keri [Tue, 17 Jul 2018 09:52:41 +0000 (09:52 +0000)]
[ASTImporter] Import described template (if any) of function.
Summary:
When a function is imported, check if it has a described template.
The name lookup is corrected to find the templated entity in this case.
The described template of the function is imported too.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D49235
llvm-svn: 337260
Sander de Smalen [Tue, 17 Jul 2018 09:48:57 +0000 (09:48 +0000)]
[AArch64][SVE] Asm: Support for predicated FP operations.
This patch adds support for the following floating point
instructions:
FABD (absolute difference)
FADD (addition)
FSUB (subtract)
FSUBR (subtract reverse form)
FDIV (divide)
FDIVR (divide reverse form)
FMAX (maximum)
FMAXNM (maximum number)
FMIN (minimum)
FMINNM (minimum number)
FSCALE (adjust exponent)
FMULX (multiply extended)
All operations are predicated and binary form, e.g.
fadd z0.h, p0/m, z0.h, z1.h
^___________^ (tied)
Supporting 16, 32 and 64-bit FP elements.
llvm-svn: 337259
Simon Pilgrim [Tue, 17 Jul 2018 09:45:35 +0000 (09:45 +0000)]
[DAGCombiner] Call SimplifyDemandedVectorElts from EXTRACT_VECTOR_ELT
If we are only extracting vector elements via EXTRACT_VECTOR_ELT(s) we may be able to use SimplifyDemandedVectorElts to avoid unnecessary vector ops.
Differential Revision: https://reviews.llvm.org/D49262
llvm-svn: 337258
Simon Pilgrim [Tue, 17 Jul 2018 09:39:55 +0000 (09:39 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
llvm-svn: 337257
George Rimar [Tue, 17 Jul 2018 09:37:53 +0000 (09:37 +0000)]
[ELF] - Check we able to report function symbols that encloses a location in error messages.
InputSectionBase::getLocation() have the following block of the code which
is uncovered by our test cases:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputSection.cpp#L238
Patch adds a test to trigger this branch.
llvm-svn: 337256
Florian Hahn [Tue, 17 Jul 2018 09:23:31 +0000 (09:23 +0000)]
Temporarily revert r337226 "Restructure checking for, and warning on, lifetime extension."
This change breaks on ARM because pointers to clang::InitializedEntity are only
4 byte aligned and do not have 3 bits to store values. A possible solution
would be to change the fields in clang::InitializedEntity to enforce a bigger
alignment requirement.
The error message is
llvm/include/llvm/ADT/PointerIntPair.h:132:3: error: static_assert failed "PointerIntPair with integer size too large for pointer"
static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
include/llvm/ADT/PointerIntPair.h:73:13: note: in instantiation of template class 'llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> >' requested here
Value = Info::updateInt(Info::updatePointer(0, PtrVal),
llvm/include/llvm/ADT/PointerIntPair.h:51:5: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::setPointerAndInt' requested here
setPointerAndInt(PtrVal, IntVal);
^
llvm/tools/clang/lib/Sema/SemaInit.cpp:6237:12: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::PointerIntPair' requested here
return {Entity, LK_Extended};
Full log here:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/1330
http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/1394
llvm-svn: 337255
George Rimar [Tue, 17 Jul 2018 09:10:16 +0000 (09:10 +0000)]
[ELF] - Fix BB. 'Filecheck' -> 'FileCheck'.
llvm-svn: 337254
Sander de Smalen [Tue, 17 Jul 2018 08:52:45 +0000 (08:52 +0000)]
[AArch64][SVE] Asm: Support for SPLICE instruction.
The SPLICE instruction splices two vectors into one vector using a
predicate. It copies the active elements from the first vector, and
then fills the remaining elements with the low-numbered elements from
the second vector.
The instruction has the following form, e.g.
splice z0.b, p0, z0.b, z1.b
for 8-bit elements. It also supports 16, 32 and
64-bit elements.
llvm-svn: 337253
George Rimar [Tue, 17 Jul 2018 08:42:42 +0000 (08:42 +0000)]
[ELF] - Check we are able to report zlib decompressor errors.
This test case adds a check for the following line of the code:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputSection.cpp#L194
llvm-svn: 337252
Sander de Smalen [Tue, 17 Jul 2018 08:39:48 +0000 (08:39 +0000)]
[AArch64][SVE] Asm: Support for EXT instruction.
This patch adds an instruction that allows extracting
a vector from a pair of vectors, given an immediate index
that describes the element position to extract from.
The instruction has the following assembly:
ext z0.b, z0.b, z1.b, #imm
where #imm is an immediate between 0 and 255.
llvm-svn: 337251
George Rimar [Tue, 17 Jul 2018 08:04:27 +0000 (08:04 +0000)]
[ELF] - Check we are able to report errors when DW_AT_decl_file is invalid.
We did not try to support this intentionally but have
an error handling and reporting logic that can take care
of that and hence needs a test.
llvm-svn: 337250
Roman Lebedev [Tue, 17 Jul 2018 07:12:08 +0000 (07:12 +0000)]
Harden/relax clang/test/CodeGen/opt-record-MIR.c test
Summary:
If the build path is short, `Line` field can end up fitting on the same line as `File`,
but the `{{.*}}` would consume it. Keeping in mind rL293149, i think we can fix it,
while keeping it working when there are and there are not any quotations.
At least this fixes this test for me.
Reviewers: anemet, aaron.ballman, hfinkel
Reviewed By: anemet
Subscribers: cfe-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D49348
llvm-svn: 337249
Tobias Grosser [Tue, 17 Jul 2018 07:08:06 +0000 (07:08 +0000)]
[DependenceInfo] Use isl++ to replace foreach_set with for loop
llvm-svn: 337248
Tobias Grosser [Tue, 17 Jul 2018 07:08:01 +0000 (07:08 +0000)]
[IslNodeBuilder] Use isl++ to replace foreach_set with for loop
llvm-svn: 337247
Tobias Grosser [Tue, 17 Jul 2018 06:41:20 +0000 (06:41 +0000)]
[ScopInfo] Replace isl foreach calls with for loops
llvm-svn: 337246
Tobias Grosser [Tue, 17 Jul 2018 06:33:41 +0000 (06:33 +0000)]
[ZoneAlgo] Replace isl foreach calls with for loops
llvm-svn: 337245
Tobias Grosser [Tue, 17 Jul 2018 06:33:37 +0000 (06:33 +0000)]
[FlattenSchedule] Replace isl foreach calls with for loops
llvm-svn: 337244
Tobias Grosser [Tue, 17 Jul 2018 06:33:34 +0000 (06:33 +0000)]
[MaximalStaticExpansion] Replace isl foreach calls with for loops
llvm-svn: 337243
Tobias Grosser [Tue, 17 Jul 2018 06:33:31 +0000 (06:33 +0000)]
[ForwardOpTree] Replace isl foreach calls with for loops
llvm-svn: 337242
Tobias Grosser [Tue, 17 Jul 2018 06:33:26 +0000 (06:33 +0000)]
[Simplify] Replace isl foreach calls with for loops
llvm-svn: 337241
Craig Topper [Tue, 17 Jul 2018 06:24:16 +0000 (06:24 +0000)]
[X86] Properly qualify some MOVSS/MOVSD patterns with OptSize.
These are integer versions of patterns that I already fixed for floating point.
llvm-svn: 337240
Tobias Grosser [Tue, 17 Jul 2018 06:16:58 +0000 (06:16 +0000)]
[FlattenAlgo] Replace more isl foreach calls with for loops
This time we replace for loops where the return isl::stat::error has
been used to carry status information.
There are still two uses of foreach remaining as we do not have a
corresponding for implementation for pw_aff functions.
llvm-svn: 337239
Tobias Grosser [Tue, 17 Jul 2018 06:11:53 +0000 (06:11 +0000)]
[FlattenAlgo] Replace some isl foreach calls with for loops
Replace foreach calls which only return 'ok' with for loops.
llvm-svn: 337238
Tobias Grosser [Tue, 17 Jul 2018 06:08:04 +0000 (06:08 +0000)]
[unittest/DeLICM] Replace isl foreach calls with for loops
llvm-svn: 337237
Daniel Cederman [Tue, 17 Jul 2018 05:49:33 +0000 (05:49 +0000)]
[Sparc] Do not depend on icc for ta 1
The ta instruction will always trap, regardless of the value
of the integer condition codes. TRAPri is marked as using icc,
so we cannot use a pattern for TRAPri to implement ta 1, as
verify-machineinstrs can complain that icc is not defined.
Instead we implement ta 1 the same way as ta 5.
llvm-svn: 337236
Eric Fiselier [Tue, 17 Jul 2018 05:48:48 +0000 (05:48 +0000)]
Address "always inline function is not always inlinable" warning with GCC.
When an always_inline function is used prior to the functions definition,
the compiler may not be able to inline it as requested by the attribute.
GCC flags the `basic_string(CharT const*)` function as one such example.
This patch supresses the warning, and the problem, by moving the
definition of the string constructor to the inline declaration.
This ensures the body is available when it is first ODR used.
llvm-svn: 337235
Craig Topper [Tue, 17 Jul 2018 05:48:48 +0000 (05:48 +0000)]
[X86] Add full set of patterns for turning ceil/floor/trunc/rint/nearbyint into rndscale with loads, broadcast, and masking.
This amounts to pretty ridiculous number of patterns. Ideally we'd canonicalize the X86ISD::VRNDSCALE earlier to reuse those patterns. I briefly looked into doing that, but some strict FP operations could still get converted to rint and nearbyint during isel. It's probably still worthwhile to look into. This patch is meant as a starting point to work from.
llvm-svn: 337234
Craig Topper [Tue, 17 Jul 2018 05:48:46 +0000 (05:48 +0000)]
[X86] Add test cases for selecting floor/ceil/trunc/rint/nearbyint to rndscale with masking, loading, and broadcasting.
llvm-svn: 337233
Jacob Bandes-Storch [Tue, 17 Jul 2018 04:56:22 +0000 (04:56 +0000)]
[Driver] Add -fno-digraphs
Summary: Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to `-fno-operator-names` which disables alternative names for C++ operators.
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: rsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D48266
llvm-svn: 337232
Artem Dergachev [Tue, 17 Jul 2018 01:39:25 +0000 (01:39 +0000)]
[analyzer] Fix size_t in tests.
Should fix a buildbot. No functional change intended.
llvm-svn: 337231
Chen Zheng [Tue, 17 Jul 2018 01:04:41 +0000 (01:04 +0000)]
[testcases] move testcases to right place - NFC
Differential Revision: https://reviews.llvm.org/D49409
llvm-svn: 337230
Artem Dergachev [Tue, 17 Jul 2018 00:57:57 +0000 (00:57 +0000)]
[CFG] [analyzer] Allow elidable copies to have more than one arguments.
Copy-constructors and move-constructors may have default arguments. It is
incorrect to assert that they only have one argument, i.e. the reference to the
object being copied or moved. Remove the assertion.
Differential Revision: https://reviews.llvm.org/D49215
llvm-svn: 337229
Artem Dergachev [Tue, 17 Jul 2018 00:42:35 +0000 (00:42 +0000)]
[analyzer] pr37802: Fix symbolic-pointer-to-boolean casts during load.
The canonical representation of pointer &SymRegion{$x} casted to boolean is
"$x != 0", not "$x". Assertion added in r337227 catches that.
Differential Revision: https://reviews.llvm.org/D48232
llvm-svn: 337228
Artem Dergachev [Tue, 17 Jul 2018 00:22:27 +0000 (00:22 +0000)]
[analyzer] Assert that nonloc::SymbolVal always wraps a non-Loc-type symbol.
In the current SVal hierarchy there are multiple ways of representing certain
values but few are actually used and expected to be seen by the code.
In particular, a value of a symbolic pointer is always represented by a
loc::MemRegionVal that wraps a SymbolicRegion that wraps the pointer symbol
and never by a nonloc::SymbolVal that wraps that symbol directly.
Assert the aforementioned fact. Fix one minor violation of it.
Differential Revision: https://reviews.llvm.org/D48205
llvm-svn: 337227
Richard Smith [Tue, 17 Jul 2018 00:11:41 +0000 (00:11 +0000)]
Restructure checking for, and warning on, lifetime extension.
This change implements C++ DR1696, which makes initialization of a
reference member of a class from a temporary object ill-formed. The
standard wording here is imprecise, but we interpret it as meaning that
any time a mem-initializer would result in lifetime extension, the
program is ill-formed.
llvm-svn: 337226
Matt Davis [Mon, 16 Jul 2018 23:50:53 +0000 (23:50 +0000)]
[llvm-mca][docs] Add notes about cycle and resource callbacks. NFC.
llvm-svn: 337225
Matt Morehouse [Mon, 16 Jul 2018 23:22:54 +0000 (23:22 +0000)]
[libFuzzer] Avoid STL in MSan test.
Summary:
STL can cause MSan false positives if lib[std]c++ isn't instrumented
with MSan.
Reviewers: kcc
Reviewed By: kcc
Subscribers: Dor1s, llvm-commits
Differential Revision: https://reviews.llvm.org/D49404
llvm-svn: 337224
Craig Topper [Mon, 16 Jul 2018 23:10:58 +0000 (23:10 +0000)]
[X86] Add a missing FMA3 scalar intrinsic pattern.
This allows us to use 231 form to fold an insertelement on the add input to the fma. There is technically no software intrinsic that can use this until AVX512F, but it can be manually built up from other intrinsics.
llvm-svn: 337223
Sam Clegg [Mon, 16 Jul 2018 23:09:29 +0000 (23:09 +0000)]
[WebAssembly] Remove ELF file support.
This support was partial and temporary. Now that we have
wasm object file support its no longer needed.
Differential Revision: https://reviews.llvm.org/D48744
llvm-svn: 337222
Sanjay Patel [Mon, 16 Jul 2018 22:59:31 +0000 (22:59 +0000)]
[Intrinsics] define funnel shift IR intrinsics + DAG builder support
As discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2018-May/123292.html
http://lists.llvm.org/pipermail/llvm-dev/2018-July/124400.html
We want to add rotate intrinsics because the IR expansion of that pattern is 4+ instructions,
and we can lose pieces of the pattern before it gets to the backend. Generalizing the operation
by allowing 2 different input values (plus the 3rd shift/rotate amount) gives us a "funnel shift"
operation which may also be a single hardware instruction.
Initially, I thought we needed to define new DAG nodes for these ops, and I spent time working
on that (much larger patch), but then I concluded that we don't need it. At least as a first
step, we have all of the backend support necessary to match these ops...because it was required.
And shepherding these through the IR optimizer is the primary concern, so the IR intrinsics are
likely all that we'll ever need.
There was also a question about converting the intrinsics to the existing ROTL/ROTR DAG nodes
(along with improving the oversized shift documentation). Again, I don't think that's strictly
necessary (as the test results here prove). That can be an efficiency improvement as a small
follow-up patch.
So all we're left with is documentation, definition of the IR intrinsics, and DAG builder support.
Differential Revision: https://reviews.llvm.org/D49242
llvm-svn: 337221
Puyan Lotfi [Mon, 16 Jul 2018 22:17:05 +0000 (22:17 +0000)]
[NFC][llvm-objcopy] Make helper functions static
Anywhere in tools/llvm-objcopy where functions or classes are not referenced
outside of a given file, we change things to make the function or class static
or put inside an anonymous namespace.
llvm-svn: 337220
Matt Davis [Mon, 16 Jul 2018 21:42:58 +0000 (21:42 +0000)]
[llvm-mca][docs] Initial description of mca internals. NFC
This patch introduces a brief description of the components of MCA. The main
focus is on Views. This is a work in progress, and more descriptions will be
introduced later. I want to flesh-out the Views section more and provide a
detailed description of eventing in MCA. Eventually a brief code example of a
View should accompany the description.
Also, we should consider moving the MCA internals guide elsewhere at some point.
llvm-svn: 337219
Zachary Turner [Mon, 16 Jul 2018 21:34:25 +0000 (21:34 +0000)]
Add missing includes.
llvm-svn: 337218
Zachary Turner [Mon, 16 Jul 2018 21:24:03 +0000 (21:24 +0000)]
[LLVMDemangle] Move some utility classes to header files.
In a followup I'm looking to add a Microsoft demangler. Doing
so needs a lot of the same utility classes and feature test
macros which are already implemented in ItaniumDemangle.cpp.
So move all of these things into header files so that they
can be re-used by a new demangler.
Differential Revision: https://reviews.llvm.org/D49399
llvm-svn: 337217
Reka Kovacs [Mon, 16 Jul 2018 20:47:45 +0000 (20:47 +0000)]
[analyzer] Make checkEndFunction() give access to the return statement.
Differential Revision: https://reviews.llvm.org/D49387
llvm-svn: 337215
George Karpenkov [Mon, 16 Jul 2018 20:42:37 +0000 (20:42 +0000)]
[ASTMatchers] Quickfix for tests.
llvm-svn: 337214
George Karpenkov [Mon, 16 Jul 2018 20:33:25 +0000 (20:33 +0000)]
[analyzer] Bugfix for an overly eager suppression for null pointer return from macros.
Only suppress those cases where the null which came from the macro is
relevant to the bug, and was not overwritten in between.
rdar://
41497323
Differential Revision: https://reviews.llvm.org/D48856
llvm-svn: 337213
George Karpenkov [Mon, 16 Jul 2018 20:32:57 +0000 (20:32 +0000)]
[analyzer] Fix GCDAntipatternChecker to only fire when the semaphore is initialized to zero
Initializing a semaphore with a different constant most likely signals a different intent
rdar://
41802552
Differential Revision: https://reviews.llvm.org/D48911
llvm-svn: 337212
George Karpenkov [Mon, 16 Jul 2018 20:32:32 +0000 (20:32 +0000)]
[analyzer] Provide a symmetric method for generating a PathDiagnosticLocation from Decl
Differential Revision: https://reviews.llvm.org/D49166
llvm-svn: 337211
Yunlian Jiang [Mon, 16 Jul 2018 20:28:48 +0000 (20:28 +0000)]
remove temporal file directory before testing in thinlto-debug-fission.ll
Summary:
This removes the %T/dwo directory before calling ld.lld in ELF/lto/thinlto-debug-fission.ll so that
files aren't left over from previous runs.
Reviewers: espindola, pcc
Reviewed By: pcc
Subscribers: inglorion, emaste, arichardson, eraman, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D49390
llvm-svn: 337210
George Karpenkov [Mon, 16 Jul 2018 20:22:12 +0000 (20:22 +0000)]
[ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage` for ObjCMessageExpr
Differential Revision: https://reviews.llvm.org/D49333
llvm-svn: 337209
Roman Lebedev [Mon, 16 Jul 2018 20:10:46 +0000 (20:10 +0000)]
[NFC][InstCombine] Fine-tune 'check for [no] signed truncation' tests
We are using i8 for these tests, and shifting by 4,
which is exactly the half of i8.
But as it is seen from the proofs https://rise4fun.com/Alive/mgu
KeptBits = bitwidth(%x) - MaskedBits,
so with using shifts by 4, we are not really testing that
we actually properly handle the other cases with shifts not by half...
llvm-svn: 337208
Alexey Bataev [Mon, 16 Jul 2018 20:05:25 +0000 (20:05 +0000)]
[OPENMP] Fix checks for declare target link entries.
If the declare target link entries are created but not used, the
compiler will produce an error message. Patch improves handling of such
situations + improves checks for possibly lost declare target variables.
llvm-svn: 337207
Max Moroz [Mon, 16 Jul 2018 20:05:18 +0000 (20:05 +0000)]
Revert r337194 (https://reviews.llvm.org/D48891) due to compilation errors.
llvm-svn: 337206
Eric Fiselier [Mon, 16 Jul 2018 20:01:59 +0000 (20:01 +0000)]
Fix PR38160 - init_priority attribute not supported by GCC on Apple.
This patch guards the use of __attribute__((init_priority(101)))
within memory_resource.cpp when building with compilers that don't
support it. Specifically GCC on Apple platforms, and MSVC.
llvm-svn: 337205
Jake Ehrlich [Mon, 16 Jul 2018 19:48:52 +0000 (19:48 +0000)]
[llvm-objcopy] Add support for large indexes
This patch is an update of an older patch that never landed
(see here: https://reviews.llvm.org/D42516)
Recently various users have run into this issue and it just 100%
has to be solved at this point. The main difference in this patch
is that I use gunzip instead of unzip which should hopefully allow
tests to pass. Please review this as if it is a new patch however.
I found some issues along the way and made some minor modifications.
The binary used in this patch for testing (a zip file to make it small)
can be found here:
https://drive.google.com/file/d/1UjsnTO9edLttZibbr-2T1bJl92KEQFAO/view?usp=sharing
Differential Revision: https://reviews.llvm.org/D49206
llvm-svn: 337204
Alex Lorenz [Mon, 16 Jul 2018 19:41:49 +0000 (19:41 +0000)]
[cmake][libFuzzer] fixup r337193 to ensure msan/dfsan are not added
to test deps for libfuzzer when they're not supported by the platform
llvm-svn: 337203
Alex Langford [Mon, 16 Jul 2018 19:19:56 +0000 (19:19 +0000)]
[CMake] Give lldb tools functional install targets when building LLDB.framework
Summary:
This change makes the install targets for lldb tools functional when
building for the framework.
I am currently working on the install rules for lldb-framework and this will
let me make `install-lldb-framework` rely on `install-lldb-argdumper` for
instance. This is especially important for `install-lldb-framework-stripped`. It
is much better for `install-lldb-framework-stripped` to rely on
`install-lldb-argdumper-stripped` than to copy and strip lldb-argdumper
manually.
Differential Revision: https://reviews.llvm.org/D49038
llvm-svn: 337202
Tobias Grosser [Mon, 16 Jul 2018 19:04:16 +0000 (19:04 +0000)]
[ScopInfo] Replace isl foreach calls with for loops
After Philip added support for range-based for loops to our C++
bindings, we now convert another bunch of foreach calls to range-for loops.
This improves general readability of the code.
llvm-svn: 337201
Fangrui Song [Mon, 16 Jul 2018 18:51:40 +0000 (18:51 +0000)]
[CodeGen] Fix inconsistent declaration parameter name
llvm-svn: 337200
Petr Hosek [Mon, 16 Jul 2018 18:48:20 +0000 (18:48 +0000)]
[CMake] Use cxx-headers as a depedency for C++ headers
We no longer pass CLANG_DEFAULT_CXX_STDLIB to the runtimes build
as it was causing issues so we can no longer use this variable. We
instead use cxx-headers as a dependency whenever this is available
since both XRay and libFuzzer are built as static libraries so this
is sufficient.
Differential Revision: https://reviews.llvm.org/D49346
llvm-svn: 337199
Farhana Aleen [Mon, 16 Jul 2018 18:19:59 +0000 (18:19 +0000)]
[AMDGPU] [AMDGPU] Support a fdot2 pattern.
Summary: Optimize fma((float)S0.x, (float)S1.x fma((float)S0.y, (float)S1.y, z))
-> fdot2((v2f16)S0, (v2f16)S1, (float)z)
Author: FarhanaAleen
Reviewed By: rampitec, b-sumner
Subscribers: AMDGPU
Differential Revision: https://reviews.llvm.org/D49146
llvm-svn: 337198
Alexey Bataev [Mon, 16 Jul 2018 18:12:18 +0000 (18:12 +0000)]
[OPENMP] Fix syntactic errors in error messages.
Fixed spelling of the offloading error messages.
llvm-svn: 337196
Yunlian Jiang [Mon, 16 Jul 2018 17:55:48 +0000 (17:55 +0000)]
Support option -plugin-opt=dwo_dir=
Summary:
This adds support to option -plugin-opt=dwo_dir=${DIR}. This option is used to specify the directory to store the .dwo files when LTO and debug fission is used
at the same time.
Reviewers: ruiu, espindola, pcc
Reviewed By: pcc
Subscribers: eraman, dexonsmith, mehdi_amini, emaste, arichardson, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D47904
llvm-svn: 337195
Max Moroz [Mon, 16 Jul 2018 17:50:46 +0000 (17:50 +0000)]
[libFuzzer] Mutation tracking and logging implemented.
Summary:
Code now exists to track number of mutations that are used in fuzzing in total
and ones that produce new coverage. The stats are currently being dumped to the
command line.
Patch by Kodé Williams (@kodewilliams).
Reviewers: metzman, Dor1s, morehouse, kcc
Reviewed By: Dor1s, morehouse, kcc
Subscribers: delcypher, kubamracek, kcc, morehouse, llvm-commits, #sanitizers, mgorny
Differential Revision: https://reviews.llvm.org/D48054
llvm-svn: 337194
Matt Morehouse [Mon, 16 Jul 2018 17:37:15 +0000 (17:37 +0000)]
[libFuzzer] Add msan and dfsan to test deps.
Required now that we have tests using MSan and DFSan.
llvm-svn: 337193
Mandeep Singh Grang [Mon, 16 Jul 2018 17:26:37 +0000 (17:26 +0000)]
[llvm] Change 2 instances of std::sort to llvm::sort
llvm-svn: 337192
Alexey Bataev [Mon, 16 Jul 2018 16:49:20 +0000 (16:49 +0000)]
[OPENMP, NVPTX] Globalize only captured variables.
Sometimes we can try to globalize non-variable declarations, which may
lead to compiler crash.
llvm-svn: 337191
Roman Lebedev [Mon, 16 Jul 2018 16:45:42 +0000 (16:45 +0000)]
[InstCombine] Fold 'check for [no] signed truncation' pattern
Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]
As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
https://rise4fun.com/Alive/gBf
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.
Proofs for this transform: https://rise4fun.com/Alive/mgu
This transform is surprisingly frustrating.
This does not deal with non-splat shift amounts, or with undef shift amounts.
I've outlined what i think the solution should be:
```
// Potential handling of non-splats: for each element:
// * if both are undef, replace with constant 0.
// Because (1<<0) is OK and is 1, and ((1<<0)>>1) is also OK and is 0.
// * if both are not undef, and are different, bailout.
// * else, only one is undef, then pick the non-undef one.
```
The DAGCombine will reverse this transform, see
https://reviews.llvm.org/D49266
Reviewers: spatel, craig.topper
Reviewed By: spatel
Subscribers: JDevlieghere, rkruppe, llvm-commits
Differential Revision: https://reviews.llvm.org/D49320
llvm-svn: 337190
Raphael Isemann [Mon, 16 Jul 2018 16:38:30 +0000 (16:38 +0000)]
Fix some crashes and deadlocks in FormatAnsiTerminalCodes
Summary:
This patch fixes a few problems with the FormatAnsiTerminalCodes function:
* It does an infinite loop on an unknown color value.
* It crashes when the color value is at the end of the string.
* It deletes the first character behind the color token.
Also added a few tests that reproduce those problems (and test some other corner cases).
Reviewers: davide, labath
Reviewed By: labath
Subscribers: labath, lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D49307
llvm-svn: 337189
Pavel Labath [Mon, 16 Jul 2018 16:18:52 +0000 (16:18 +0000)]
Fix typo in find-basic-function test
Wrong FileCheck header meant that we were not matching what we should.
This allows us to get rid of the -allow-deprecated-dag-overlap flag in
the test.
llvm-svn: 337188
Max Moroz [Mon, 16 Jul 2018 16:01:31 +0000 (16:01 +0000)]
[libFuzzer] Implement stat::stability_rate based on the percentage of unstable edges.
Summary:
Created a -print_unstable_stats flag.
When -print_unstable_stats=1, we run it 2 more times on interesting inputs poisoning unstable edges in an array.
On program termination, we run PrintUnstableStats() which will print a line with a stability percentage like AFL does.
Patch by Kyungtak Woo (@kevinwkt).
Reviewers: metzman, Dor1s, kcc, morehouse
Reviewed By: metzman, Dor1s, morehouse
Subscribers: delcypher, llvm-commits, #sanitizers, kcc, morehouse, Dor1s
Differential Revision: https://reviews.llvm.org/D49212
llvm-svn: 337187
Wei Mi [Mon, 16 Jul 2018 15:42:20 +0000 (15:42 +0000)]
[RegAlloc] Skip global splitting if the live range is huge and its spill is
trivially rematerializable.
We run into a case where machineLICM hoists a large number of live ranges
outside of a big loop because it thinks those live ranges are trivially
rematerializable. In regalloc, global splitting is tried out first for those
live ranges before they are spilled and rematerialized. Because the global
splitting algorithm is quadratic, increasing a lot of global splitting
candidates causes huge compile time increase (50s to 1400s on my local
machine when compiling a module).
However, we think for live ranges which are very large and are trivially
rematerialiable, it is better to just skip global splitting so as to save
compile time with little chance of sacrificing performance. We uses the
segment size of live range to indirectly evaluate whether the global
splitting of the live range can introduce high cost, and use an option
as a knob to adjust the size limit threshold.
Differential Revision: https://reviews.llvm.org/D49353
llvm-svn: 337186
Teresa Johnson [Mon, 16 Jul 2018 15:30:36 +0000 (15:30 +0000)]
Restore "[ThinLTO] Ensure we always select the same function copy to import"
This reverts commit r337082, restoring r337051, since the LLVM side
patch has been restored.
llvm-svn: 337185
Teresa Johnson [Mon, 16 Jul 2018 15:30:27 +0000 (15:30 +0000)]
Restore "[ThinLTO] Ensure we always select the same function copy to import"
This reverts commit r337081, therefore restoring r337050 (and fix in
r337059), with test fix for bot failure described after the original
description below.
In order to always import the same copy of a linkonce function,
even when encountering it with different thresholds (a higher one then a
lower one), keep track of the summary we decided to import.
This ensures that the backend only gets a single definition to import
for each GUID, so that it doesn't need to choose one.
Move the largest threshold the GUID was considered for import into the
current module out of the ImportMap (which is part of a larger map
maintained across the whole index), and into a new map just maintained
for the current module we are computing imports for. This saves some
memory since we no longer have the thresholds maintained across the
whole index (and throughout the in-process backends when doing a normal
non-distributed ThinLTO build), at the cost of some additional
information being maintained for each invocation of ComputeImportForModule
(the selected summary pointer for each import).
There is an additional map lookup for each callee being considered for
importing, however, this was able to subsume a map lookup in the
Worklist iteration that invokes computeImportForFunction. We also are
able to avoid calling selectCallee if we already failed to import at the
same or higher threshold.
I compared the run time and peak memory for the SPEC2006 471.omnetpp
benchmark (running in-process ThinLTO backends), as well as for a large
internal benchmark with a distributed ThinLTO build (so just looking at
the thin link time/memory). Across a number of runs with and without
this change there was no significant change in the time and memory.
(I tried a few other variations of the change but they also didn't
improve time or peak memory).
The new commit removes a test that no longer makes sense
(Transforms/FunctionImport/hotness_based_import2.ll), as exposed by the
reverse-iteration bot. The test depends on the order of processing the
summary call edges, and actually depended on the old problematic
behavior of selecting more than one summary for a given GUID when
encountered with different thresholds. There was no guarantee even
before that we would eventually pick the linkonce copy with the hottest
call edges, it just happened to work with the test and the old code, and
there was no guarantee that we would end up importing the selected
version of the copy that had the hottest call edges (since the backend
would effectively import only one of the selected copies).
Reviewers: davidxl
Subscribers: mehdi_amini, inglorion, llvm-commits
Differential Revision: https://reviews.llvm.org/D48670
llvm-svn: 337184
George Rimar [Mon, 16 Jul 2018 15:29:35 +0000 (15:29 +0000)]
[ELF] - Eliminate ObjFile<ELFT>::getLineInfo. NFC.
Flow is the same, but a bit shorter after this change.
llvm-svn: 337183