Andrea Di Biagio [Fri, 3 Aug 2018 12:44:56 +0000 (12:44 +0000)]
[llvm-mca][docs] Improve the CommandLine documentation.
This patch replaces all the remaining occurrences of string "MCA" with
":program:`llvm-mca`". Somehow I missed those strings when I committed r338394.
This patch also improves section "Instruction Dispatch".
llvm-svn: 338881
Nico Weber [Fri, 3 Aug 2018 12:21:54 +0000 (12:21 +0000)]
convert some tabs to spaces
llvm-svn: 338880
Tim Northover [Fri, 3 Aug 2018 12:19:22 +0000 (12:19 +0000)]
Revert "clang-format: [JS] don't break comments before any '{'"
This reverts commit r338837, it introduced an infinite loop on all bots.
llvm-svn: 338879
Jonas Devlieghere [Fri, 3 Aug 2018 12:01:43 +0000 (12:01 +0000)]
[DebugInfo/Verifier] Don't emit error for missing module in index
We don't expect module names to be present in the index. This patch adds
DW_TAG_module to the blacklist.
Differential revision: https://reviews.llvm.org/D50237
llvm-svn: 338878
Nico Weber [Fri, 3 Aug 2018 12:00:12 +0000 (12:00 +0000)]
lld-link: Fix subsystem inference for non-console apps on 32-bit, and fix entry point inference on 32-bit with /nodefaultlib
LinkerDriver::inferSubsystem() used to do Symtab->findUnderscore("WinMain"),
but WinMain is stdcall in 32-bit and is hence is called _WinMain@16. Instead,
Symtab->findMangle(mangle("WinMain")) needs to be called.
But since LinkerDriver::inferSubsystem() and LinkerDriver::findDefaultEntry()
both need to call this, introduce a common helper function for this and call it
from both places. (Also call it for "main" for consistency, even though
findUnderscore() is enough for main since that's __cdecl on 32-bit).
This also exposed a bug for /nodefaultlib entrypoint inference: The code here
called findMangle(Sym) instead of findMangle(mangle(Sym)), again doing the
wrong thing on 32-bit. Fix that too.
While here, make Driver::mangle() a static free function.
https://reviews.llvm.org/D50184
llvm-svn: 338877
Jonas Paulsson [Fri, 3 Aug 2018 10:43:05 +0000 (10:43 +0000)]
[SystemZ] Improve handling of instructions which expand to several groups
Some instructions expand to more than one decoder group.
This has been hitherto ignored, but is handled with this patch.
Review: Ulrich Weigand
https://reviews.llvm.org/D50187
llvm-svn: 338849
Max Kazantsev [Fri, 3 Aug 2018 10:41:51 +0000 (10:41 +0000)]
[NFC] Add missing comment
llvm-svn: 338848
Max Kazantsev [Fri, 3 Aug 2018 10:16:40 +0000 (10:16 +0000)]
[NFC] Move some methods into static functions
llvm-svn: 338843
Jeremy Morse [Fri, 3 Aug 2018 10:13:35 +0000 (10:13 +0000)]
[Windows FS] Allow moving files in TempFile::keep
In r338216 / D49860 TempFile::keep was extended to allow keeping across
filesystems. The aim on Windows was to have this happen in rename_internal
using the existing system API. However, to fix an issue and preserve the
idea of "renaming" not being a move, put Windows keep-across-filesystem in
TempFile::keep.
Differential Revision: https://reviews.llvm.org/D50048
llvm-svn: 338841
Krasimir Georgiev [Fri, 3 Aug 2018 10:04:58 +0000 (10:04 +0000)]
clang-format-diff: Make it work with python3 too
Summary: It is not necessary, but would be nice if the script run on python3 as well (as opposed to only python2, which is going to be deprecated https://pythonclock.org/)
Contributed by MarcoFalke!
Reviewers: krasimir
Reviewed By: krasimir
Subscribers: lebedev.ri, sammccall, cfe-commits
Differential Revision: https://reviews.llvm.org/D48098
llvm-svn: 338839
Simon Pilgrim [Fri, 3 Aug 2018 10:00:54 +0000 (10:00 +0000)]
[TargetLowering] Generalise BuildSDIV function
First step towards a BuildSDIV equivalent to D49248 for non-uniform vector support - this just pushes the splat detection down into TargetLowering::BuildSDIV where its still used.
Differential Revision: https://reviews.llvm.org/D50185
llvm-svn: 338838
Martin Probst [Fri, 3 Aug 2018 09:34:41 +0000 (09:34 +0000)]
clang-format: [JS] don't break comments before any '{'
Summary:
Previously, clang-format would avoid breaking before the first `{`
found, but then happily break before subsequent '{'s on the line. This
change fixes that by looking for the first location that has no opening
curly, if any.
Reviewers: krasimir
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50230
llvm-svn: 338837
Guillaume Chatelet [Fri, 3 Aug 2018 09:29:38 +0000 (09:29 +0000)]
[llvm-exegesis] Renaming classes and functions.
Summary: Functional No Op.
Reviewers: gchatelet
Subscribers: tschuett, courbet, llvm-commits
Differential Revision: https://reviews.llvm.org/D50231
llvm-svn: 338836
Sjoerd Meijer [Fri, 3 Aug 2018 09:24:29 +0000 (09:24 +0000)]
[ARM] FP16: support vector zip and unzip
This is addressing PR38404.
Differential Revision: https://reviews.llvm.org/D50186
llvm-svn: 338835
Dean Michael Berris [Fri, 3 Aug 2018 09:21:31 +0000 (09:21 +0000)]
[XRay][tools] Use Support/JSON.h in llvm-xray convert
Summary:
This change removes the ad-hoc implementation used by llvm-xray's
`convert` subcommand to generate JSON encoded catapult (AKA Chrome
Trace Viewer) trace output, to instead use the JSON encoder now in the
Support library.
Reviewers: kpw, zturner, eizan
Reviewed By: kpw
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50129
llvm-svn: 338834
Simon Pilgrim [Fri, 3 Aug 2018 09:20:02 +0000 (09:20 +0000)]
[X86] Add example of 'zero shift' guards on rotation patterns (PR34924)
Basic pattern that leaves an unnecessary select on a rotation by zero result. This variant is trivial - the more general case with a compare+branch to prevent execution of undefined shifts is more tricky.
llvm-svn: 338833
Eric Liu [Fri, 3 Aug 2018 09:16:07 +0000 (09:16 +0000)]
Fully qualify the renamed symbol if the shortened name is ambiguous.
Summary:
For example, when renaming `a::b::x::foo` to `y::foo` below, replacing
`x::foo()` with `y::foo()` can cause ambiguity. In such cases, we simply fully
qualify the name with leading `::`.
```
namespace a {
namespace b {
namespace x { void foo() {} }
namespace y { void foo() {} }
}
}
namespace a {
namespace b {
void f() { x::foo(); }
}
}
```
Reviewers: ilya-biryukov, hokein
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50189
llvm-svn: 338832
Karl-Johan Karlsson [Fri, 3 Aug 2018 09:13:15 +0000 (09:13 +0000)]
Fix unused variable warning in tablegen generated code
llvm-svn: 338831
Sjoerd Meijer [Fri, 3 Aug 2018 09:12:56 +0000 (09:12 +0000)]
[ARM] FP16: support VFMA
This is addressing PR38404.
llvm-svn: 338830
Dean Michael Berris [Fri, 3 Aug 2018 09:06:11 +0000 (09:06 +0000)]
[XRay] fixup: add one more missing std::move(...)
Follow up to D48370.
llvm-svn: 338829
Pavel Labath [Fri, 3 Aug 2018 08:47:22 +0000 (08:47 +0000)]
Revert "Add support for ARM and ARM64 breakpad generated minidump files"
This reverts commit r338734 (and subsequent fixups in r338772 and
r338746), because it breaks some minidump unit tests and introduces a
lot of compiler warnings.
llvm-svn: 338828
Dean Michael Berris [Fri, 3 Aug 2018 07:54:37 +0000 (07:54 +0000)]
[XRay] fixup: Add missing std::move(...)
Follow up to D48370.
llvm-svn: 338827
Dean Michael Berris [Fri, 3 Aug 2018 07:41:34 +0000 (07:41 +0000)]
[XRay] Fixup: remove 'noexcept' in defaulted move members
This is to appease stage1 builds using gcc.
Follow-up to D48370.
llvm-svn: 338826
Dean Michael Berris [Fri, 3 Aug 2018 07:18:39 +0000 (07:18 +0000)]
[XRay][llvm] Load XRay Profiles
Summary:
This change implements the profile loading functionality in LLVM to
support XRay's profiling mode in compiler-rt.
We introduce a type named `llvm::xray::Profile` which allows building a
profile representation. We can load an XRay profile from a file to build
Profile instances, or do it manually through the Profile type's API.
The intent is to get the `llvm-xray` tool to generate `Profile`
instances and use that as the common abstraction through which all
conversion and analysis can be done. In the future we can generate
`Profile` instances from `Trace` instances as well, through conversion
functions.
Some of the key operations supported by the `Profile` API are:
- Path interning (`Profile::internPath(...)`) which returns a unique path
identifier.
- Block appending (`Profile::addBlock(...)`) to add thread-associated
profile information.
- Path ID to Path lookup (`Profile::expandPath(...)`) to look up a
PathID and return the original interned path.
- Block iteration.
A 'Path' in this context represents the function call stack in
leaf-to-root order. This is represented as a path in an internally
managed prefix tree in the `Profile` instance. Having a handle (PathID)
to identify the unique Paths we encounter for a particular Profile
allows us to reduce the amount of memory required to associate profile
data to a particular Path.
This is the first of a series of patches to migrate the `llvm-stacks`
tool towards using a single profile representation.
Depends on D48653.
Reviewers: kpw, eizan
Reviewed By: kpw
Subscribers: mgorny, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D48370
llvm-svn: 338825
Craig Topper [Fri, 3 Aug 2018 07:01:10 +0000 (07:01 +0000)]
[X86] Remove all the vector NOP bitcast patterns. Use a few lines of code in the Select method in X86ISelDAGToDAG.cpp instead.
There are a lot of permutations of types here generating a lot of patterns in the isel table. It's more efficient to just ReplaceUses and RemoveDeadNode from the Select function.
The test changes are because we have a some shuffle patterns that have a bitcast as their root node. But the behavior is identical to another instruction whose pattern doesn't start with a bitcast. So this isn't a functional change.
llvm-svn: 338824
Hans Wennborg [Fri, 3 Aug 2018 07:00:08 +0000 (07:00 +0000)]
build_llvm_package.bat: Add OpenMP back
After r338721, it builds again.
llvm-svn: 338823
Chijun Sima [Fri, 3 Aug 2018 06:51:35 +0000 (06:51 +0000)]
[Dominators] Refine the logic of recalculate() in the DomTreeUpdater
Summary:
This patch refines the logic of `recalculate()` in the `DomTreeUpdater` in the following two aspects:
1. Previously, `recalculate()` tests whether there are pending updates/BBs awaiting deletion and then do recalculation under Lazy UpdateStrategy; and do recalculation immediately under Eager UpdateStrategy. (The former behavior is inherited from the `DeferredDominance` class). This is an inconsistency between two strategies and there is no obvious reason to do this. So the behavior is changed to always recalculate available trees when calling `recalculate()`.
2. Fix the issue of when DTU under Lazy UpdateStrategy holds nothing but with BBs awaiting deletion, after calling `recalculate()`, BBs awaiting deletion aren't flushed. An additional unittest is added to cover this case.
Reviewers: kuhar, dmgreen, brzycki, grosser, davide
Reviewed By: kuhar
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50173
llvm-svn: 338822
Craig Topper [Fri, 3 Aug 2018 06:12:56 +0000 (06:12 +0000)]
[X86] Support fp128 and/or/xor/load/store with VEX and EVEX encoded instructions.
Move all the patterns to X86InstrVecCompiler.td so we can keep SSE/AVX/AVX512 all in one place.
To save some patterns we'll use an existing DAG combine to convert f128 fand/for/fxor to integer when sse2 is enabled. This allows use to reuse all the existing patterns for v2i64.
I believe this now makes SHA instructions the only case where VEX/EVEX and legacy encoded instructions could be generated simultaneously.
llvm-svn: 338821
Michael Wu [Fri, 3 Aug 2018 05:55:40 +0000 (05:55 +0000)]
[libclang 8/8] Add support for the flag_enum attribute
Summary:
This adds support to libclang for reading the flag_enum attribute.
This also bumps CINDEX_VERSION_MINOR for this patch series.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49635
llvm-svn: 338820
Martin Storsjo [Fri, 3 Aug 2018 05:51:31 +0000 (05:51 +0000)]
[CMake] Allow building standalone without any llvm-config available
This is the same as libcxxabi/libcxx do.
Differential Revision: https://reviews.llvm.org/D50135
llvm-svn: 338819
Martin Storsjo [Fri, 3 Aug 2018 05:50:33 +0000 (05:50 +0000)]
[CMake] Allow building builtins standalone out of tree without any llvm-config available
This is the same as libcxxabi/libcxx do.
Differential Revision: https://reviews.llvm.org/D50134
llvm-svn: 338818
Hiroshi Inoue [Fri, 3 Aug 2018 05:39:48 +0000 (05:39 +0000)]
[InstSimplify] fold extracting from std::pair (2/2)
This is the second patch of the series which intends to enable jump threading for an inlined method whose return type is std::pair<int, bool> or std::pair<bool, int>.
The first patch is https://reviews.llvm.org/rL338485.
This patch handles code sequences that merges two values using `shl` and `or`, then extracts one value using `and`.
Differential Revision: https://reviews.llvm.org/D49981
llvm-svn: 338817
Michael Wu [Fri, 3 Aug 2018 05:38:29 +0000 (05:38 +0000)]
[libclang 7/8] Add support for getting property setter and getter names
Summary: This allows libclang to access the actual names of property setters and getters without needing to go through the indexer API. Usually default names are used, but the property can specify a different name.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49634
llvm-svn: 338816
Michael Wu [Fri, 3 Aug 2018 05:20:23 +0000 (05:20 +0000)]
[libclang 6/8] Add support for reading implicit attributes
Summary:
Having access to implicit attributes is sometimes useful so users of libclang don't have to duplicate some of the logic in sema.
This depends on D49081 since it also adds a CXTranslationUnit flag.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49631
llvm-svn: 338815
Chijun Sima [Fri, 3 Aug 2018 05:08:17 +0000 (05:08 +0000)]
[Dominators] Convert existing passes and utils to use the DomTreeUpdater class
Summary:
This patch is the second in a series of patches related to the [[ http://lists.llvm.org/pipermail/llvm-dev/2018-June/123883.html | RFC - A new dominator tree updater for LLVM ]].
It converts passes (e.g. adce/jump-threading) and various functions which currently accept DDT in local.cpp and BasicBlockUtils.cpp to use the new DomTreeUpdater class.
These converted functions in utils can accept DomTreeUpdater with either UpdateStrategy and can deal with both DT and PDT held by the DomTreeUpdater.
Reviewers: brzycki, kuhar, dmgreen, grosser, davide
Reviewed By: brzycki
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D48967
llvm-svn: 338814
Michael Wu [Fri, 3 Aug 2018 05:03:22 +0000 (05:03 +0000)]
[libclang 5/8] Add support for ObjC attributes without args
Summary:
This adds support to libclang for identifying ObjC related attributes that don't take arguments.
All attributes but NSObject and NSConsumed are tested.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49127
llvm-svn: 338813
Craig Topper [Fri, 3 Aug 2018 04:49:42 +0000 (04:49 +0000)]
[X86] When post-processing the DAG to remove zero extending moves for YMM/ZMM, make sure the producing instruction is VEX/XOP/EVEX encoded.
If the producing instruction is legacy encoded it doesn't implicitly zero the upper bits. This is important for the SHA instructions which don't have a VEX encoded version. We might also be able to hit this with the incomplete f128 support that hasn't been ported to VEX.
llvm-svn: 338812
Craig Topper [Fri, 3 Aug 2018 04:49:41 +0000 (04:49 +0000)]
[X86] Autogenerate complete checks. NFC
llvm-svn: 338811
Michael Kruse [Fri, 3 Aug 2018 04:42:52 +0000 (04:42 +0000)]
[CodeGen] Emit parallel_loop_access for each loop in the loop stack.
Summary:
Emit !llvm.mem.parallel_loop_access metadata for memory accesses even if the parallel loop is not the top on the loop stack.
Fixes llvm.org/PR37558.
Reviewers: ABataev, hfinkel, amusman, tyler.nowicki
Reviewed By: hfinkel
Subscribers: Meinersbur, hfinkel, cfe-commits
Differential Revision: https://reviews.llvm.org/D48808
llvm-svn: 338810
Michael Wu [Fri, 3 Aug 2018 04:38:04 +0000 (04:38 +0000)]
[libclang 4/8] Add the clang_Type_getNullability() API
Summary:
This patch adds a clang-c API for querying the nullability of an AttributedType.
The test here also tests D49081
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49082
llvm-svn: 338809
Michael Wu [Fri, 3 Aug 2018 04:21:25 +0000 (04:21 +0000)]
[libclang 3/8] Add support for AttributedType
Summary:
This patch adds support to the libclang API for identifying AttributedTypes in CXTypes and reading the modified type that the type points to. Currently AttributedTypes are skipped. This patch continues to skip AttributedTypes by default, but adds a parsing option to CXTranslationUnit to include AttributedTypes.
This patch depends on D49066 since it also adds a CXType.
Testing will be added in another patch which depends on this one.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49081
llvm-svn: 338808
Michael Wu [Fri, 3 Aug 2018 04:02:40 +0000 (04:02 +0000)]
[libclang 2/8] Add support for ObjCTypeParam
Summary:
This patch adds support to the libclang API for identifying ObjCTypeParams in CXTypes.
This patch depends on D49063 since both patches add new values to CXTypeKind.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49066
llvm-svn: 338807
Craig Topper [Fri, 3 Aug 2018 03:45:19 +0000 (03:45 +0000)]
[X86] Add R13D to the isInefficientLEAReg in FixupLEAs.
I'm assuming the R13 restriction extends to R13D. Guessing this restriction is related to the funny encoding of this register as base always requiring a displacement to be encoded.
llvm-svn: 338806
Yaxun Liu [Fri, 3 Aug 2018 03:18:56 +0000 (03:18 +0000)]
Sema: Fix explicit address space cast involving void pointers
Explicit cast of a void pointer to a pointer type in different address space is
incorrectly classified as bitcast, which causes invalid bitcast in codegen.
The patch fixes that by checking the address space of the source and destination
type and set the correct cast kind.
Differential Revision: https://reviews.llvm.org/D50003
llvm-svn: 338805
Michael Wu [Fri, 3 Aug 2018 03:03:20 +0000 (03:03 +0000)]
[libclang 1/8] Add support for ObjCObjectType
Summary: This patch adds support to the clang-c API for identifying ObjCObjects in CXTypes, enumerating type args and protocols on ObjCObjectTypes, and retrieving the base type of ObjCObjectTypes. Currently only ObjCInterfaceTypes are exposed, which do not have type args or protocols.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49063
llvm-svn: 338804
Marshall Clow [Fri, 3 Aug 2018 02:58:16 +0000 (02:58 +0000)]
Make my new test harness work w/c++03
llvm-svn: 338803
Craig Topper [Fri, 3 Aug 2018 01:28:12 +0000 (01:28 +0000)]
[X86] Autogenerate complete checks. NFC
llvm-svn: 338802
Nicolas Lesser [Fri, 3 Aug 2018 01:24:52 +0000 (01:24 +0000)]
Fold two cast plus a cast in a loop into a variable.
This avoids to recast `Record` multiple times.
llvm-svn: 338801
Michael Kruse [Fri, 3 Aug 2018 01:21:16 +0000 (01:21 +0000)]
Append new attributes to the end of an AttributeList.
Recommit of r335084 after revert in r335516.
... instead of prepending it at the beginning (the original behavior
since implemented in r122535 2010-12-23). This builds up an
AttributeList in the the order in which the attributes appear in the
source.
The reverse order caused nodes for attributes in the AST (e.g. LoopHint)
to be in the reverse order, and therefore printed in the wrong order in
-ast-dump. Some TODO comments mention this. The order was explicitly
reversed for enable_if attribute overload resolution and name mangling,
which is not necessary anymore with this patch.
The change unfortunately has some secondary effect, especially on
diagnostic output. In the simplest cases, the CHECK lines or expected
diagnostic were changed to the the new output. If the kind of
error/warning changed, the attributes' order was changed instead.
This unfortunately causes some 'previous occurrence here' hints to be
textually after the main marker. This typically happens when attributes
are merged, but are incompatible to each other. Interchanging the role
of the the main and note SourceLocation will also cause the case where
two different declaration's attributes (in contrast to multiple
attributes of the same declaration) are merged to be reverse. There is
no easy fix because sometimes previous attributes are merged into a new
declaration's attribute list, sometimes new attributes are added to a
previous declaration's attribute list. Since 'previous occurrence here'
pointing to locations after the main marker is not rare, I left the
markers as-is; it is only relevant when the attributes are declared in
the same declaration anyway.
Differential Revision: https://reviews.llvm.org/D48100
llvm-svn: 338800
Craig Topper [Fri, 3 Aug 2018 01:20:32 +0000 (01:20 +0000)]
[X86] Autogenerate complete checks. NFC
llvm-svn: 338799
Richard Smith [Fri, 3 Aug 2018 01:00:01 +0000 (01:00 +0000)]
[modules] Defer merging deduced return types.
We can't read a deduced return type until we are sure that the types referred
to by it are not in the middle of being loaded. So defer all reading of such
deduced return types until the end of the recursive deserialization step.
Also, when we load a function type that has a deduced return type, update all
other redeclarations of the function to have that deduced return type.
llvm-svn: 338798
Marshall Clow [Fri, 3 Aug 2018 00:47:12 +0000 (00:47 +0000)]
Update the changes to the array tests (that I committed yesterday) to use the test_comparison routines that I committed last week. NFC.
llvm-svn: 338797
Julie Hockett [Fri, 3 Aug 2018 00:40:11 +0000 (00:40 +0000)]
[clang-doc] Fix unique_ptr error on bots
Explicitly return the base unique_ptr type, as some of the older
compilers on the bots don't support full C++11.
Differential Revision: https://reviews.llvm.org/D50208
llvm-svn: 338796
Craig Topper [Fri, 3 Aug 2018 00:37:34 +0000 (00:37 +0000)]
[X86] Prevent promotion of i16 add/sub/and/or/xor to i32 if we can fold an atomic load and atomic store.
This makes them consistent with i8/i32/i64. Which still seems to be more aggressive on folding than icc, gcc, or MSVC.
llvm-svn: 338795
Philip Reames [Fri, 3 Aug 2018 00:21:56 +0000 (00:21 +0000)]
[LICM] Remove unneccessary safety check to increase sinking effectiveness
This one requires a bit of explaination. It's not every day you simply delete code to implement an optimization. :)
The transform in question is sinking an instruction from a loop to the uses in loop exiting blocks. We know (from LCSSA) that all of the uses outside the loop must be phi nodes, and after predecessor splitting, we know all phi users must have a single operand. Since the use must be strictly dominated by the def, we know from the definition of dominance/ssa that the exit block must execute along a (non-strict) subset of paths which reach the def. As a result, duplicating a potentially faulting instruction can not *introduce* a fault that didn't previously exist in the program.
The full story is that this patch builds on "rL338671: [LICM] Factor out fault legality from canHoistOrSinkInst [NFC]" which pulled this logic out of a common helper routine. As best I can tell, this check was originally added to the helper function for hoisting legality, later an incorrect fastpath for loads/calls was added, and then the bug was fixed by duplicating the fault safety check in the hoist path. This left the redundant check in the common code to pessimize sinking for no reason. I split it out in an NFC, and am not removing the unneccessary check. I wanted there to be something easy to revert in case I missed something.
Reviewed by: Anna Thomas (in person)
llvm-svn: 338794
Dave Lee [Fri, 3 Aug 2018 00:06:38 +0000 (00:06 +0000)]
objdump: Better handling of Mach-O universal binaries
Summary:
With Mach-O, there is a flag requirement discrepancy between working with
universal binaries and thin binaries. Many flags that don't require the `-macho`
flag (for example `-private-headers` and `-disassemble`) fail to work on
universal binaries unless `-macho` is given. When this happens, the error
message is unhelpful, stating:
The file was not recognized as a valid object file.
Which can lead to confusion.
This change allows generic flags to be used on universal binaries with and
without the `-macho` flag. This means flags that can be used for thin files can
be used consistently with fat files too.
To do this, the universal binary support within `ParseInputMachO()` is extracted
into a new function. This new function is called directly from `DumpInput()`
when the input binary is universal. Additionally the `-arch` flag validation in
`ParseInputMachO()` was extracted to be reused.
Reviewers: compnerd
Reviewed By: compnerd
Subscribers: keith, llvm-commits
Differential Revision: https://reviews.llvm.org/D48702
llvm-svn: 338792
Eli Friedman [Thu, 2 Aug 2018 23:54:16 +0000 (23:54 +0000)]
[GlobalMerge] Allow merging globals with explicit section markings.
At least on ELF, it's impossible to tell from the object file whether
two globals with the same section marking were merged: the merged global
uses "private" linkage to hide its symbol, and the aliases look like
regular symbols. I can't think of any other reason to disallow it.
(Of course, we can only merge globals in the same section.)
The weird alignment handling matches AsmPrinter; our alignment handling
for global variables should probably be refactored.
Differential Revision: https://reviews.llvm.org/D49822
llvm-svn: 338791
Tim Renouf [Thu, 2 Aug 2018 23:33:01 +0000 (23:33 +0000)]
[AMDGPU] Minor change to d16 buffer load implementation
Summary:
By not reconstructing the operand list of the SDNode, this change makes
it easier to add the forthcoming new tbuffer and buffer intrinsics.
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D49995
Change-Id: I0cb79ef0801532645d7dd954a6d7355139db7b38
llvm-svn: 338784
Tim Renouf [Thu, 2 Aug 2018 23:31:32 +0000 (23:31 +0000)]
[AMDGPU] Reworked SIFixWWMLiveness
Summary:
I encountered some problems with SIFixWWMLiveness when WWM is in a loop:
1. It sometimes gave invalid MIR where there is some control flow path
to the new implicit use of a register on EXIT_WWM that does not pass
through any def.
2. There were lots of false positives of registers that needed to have
an implicit use added to EXIT_WWM.
3. Adding an implicit use to EXIT_WWM (and adding an implicit def just
before the WWM code, which I tried in order to fix (1)) caused lots
of the values to be spilled and reloaded unnecessarily.
This commit is a rework of SIFixWWMLiveness, with the following changes:
1. Instead of considering any register with a def that can reach the WWM
code and a def that can be reached from the WWM code, it now
considers three specific cases that need to be handled.
2. A register that needs liveness over WWM to be synthesized now has it
done by adding itself as an implicit use to defs other than the
dominant one.
Also added the following fixmes:
FIXME: We should detect whether a register in one of the above
categories is already live at the WWM code before deciding to add the
implicit uses to synthesize its liveness.
FIXME: I believe this whole scheme may be flawed due to the possibility
of the register allocator doing live interval splitting.
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D46756
Change-Id: Ie7fba0ede0378849181df3f1a9a7a39ed1a94a94
llvm-svn: 338783
Craig Topper [Thu, 2 Aug 2018 23:30:38 +0000 (23:30 +0000)]
[X86] Allow 'atomic_store (neg/not atomic_load)' to isel to a RMW instruction.
There was a FIXMe in the td file about a type inference issue that was easy to fix.
llvm-svn: 338782
Craig Topper [Thu, 2 Aug 2018 23:30:31 +0000 (23:30 +0000)]
[X86] Add NEG and NOT test cases to atomic_mi.ll in preparation for fixing the FIXME in X86InstrCompiler.td to make these work for atomic load/store.
llvm-svn: 338781
Reka Kovacs [Thu, 2 Aug 2018 23:02:08 +0000 (23:02 +0000)]
[analyzer] Detect pointers escaped after ReturnStmt execution in MallocChecker.
Objects local to a function are destroyed right after the statement returning
(part of) them is executed in the analyzer. This patch enables MallocChecker to
warn in these cases.
Differential Revision: https://reviews.llvm.org/D49361
llvm-svn: 338780
Tim Renouf [Thu, 2 Aug 2018 22:53:57 +0000 (22:53 +0000)]
[AMDGPU] Avoid using divergent value in mubuf addr64 descriptor
Summary:
This fixes a problem where a load from global+idx generated incorrect
code on <=gfx7 when the index is divergent.
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D47383
Change-Id: Ib4d177d6254b1dd3f8ec0203fdddec94bd8bc5ed
llvm-svn: 338779
Zachary Turner [Thu, 2 Aug 2018 22:37:40 +0000 (22:37 +0000)]
[MS Demangler] Fix some tests that are no longer broken.
These were fixed with earlier patches, but had not yet been
re-enabled.
llvm-svn: 338778
Reka Kovacs [Thu, 2 Aug 2018 22:31:03 +0000 (22:31 +0000)]
[analyzer] Obtain a ReturnStmt from a CFGAutomaticObjDtor.
The CoreEngine only gives us a ReturnStmt if the last element in the
CFGBlock is a CFGStmt, otherwise the ReturnStmt is nullptr.
This patch adds support for the case when the last element is a
CFGAutomaticObjDtor, by returning its TriggerStmt as a ReturnStmt.
Differential Revision: https://reviews.llvm.org/D49811
llvm-svn: 338777
Max Moroz [Thu, 2 Aug 2018 22:30:03 +0000 (22:30 +0000)]
[libFuzzer] Initial implementation of weighted mutation leveraging during runtime.
Summary:
Added functions that calculate stats while fuzz targets are running and give
mutations weight based on how much new coverage they provide, and choose better
performing mutations more often.
Patch by Kodé Williams (@kodewilliams).
Reviewers: Dor1s, metzman, morehouse
Reviewed By: Dor1s, morehouse
Subscribers: delcypher, kcc, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D49621
llvm-svn: 338776
Reka Kovacs [Thu, 2 Aug 2018 22:19:57 +0000 (22:19 +0000)]
[analyzer] Add a safety check to InnerPointerChecker.
Do not crash if the CXXRecordDecl of an object is not available.
llvm-svn: 338775
Krzysztof Parzyszek [Thu, 2 Aug 2018 22:17:53 +0000 (22:17 +0000)]
[Hexagon] Simplify CFG after atomic expansion
This will remove suboptimal branching from the generated ll/sc loops.
The extra simplification pass affects a lot of testcases, which have
been modified to accommodate this change: either by modifying the
test to become immune to the CFG simplification, or (less preferablt)
by adding option -hexagon-initial-cfg-clenaup=0.
llvm-svn: 338774
David L. Jones [Thu, 2 Aug 2018 21:45:05 +0000 (21:45 +0000)]
[lldb] Remove unused variable.
The use of this variable was removed in r338734. It now causes unused variable warnings.
llvm-svn: 338772
Heejin Ahn [Thu, 2 Aug 2018 21:44:40 +0000 (21:44 +0000)]
[WebAssembly] Support for atomic.wait / atomic.wake builtins
Summary:
Add support for atomic.wait / atomic.wake builtins based on the Wasm
thread proposal.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits
Differential Revision: https://reviews.llvm.org/D49396
llvm-svn: 338771
Heejin Ahn [Thu, 2 Aug 2018 21:44:24 +0000 (21:44 +0000)]
[WebAssembly] Support for atomic.wait / atomic.wake instructions
Summary:
This adds support for atomic.wait / atomic.wake instructions in the wasm
thread proposal.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D49395
llvm-svn: 338770
Stella Stamenova [Thu, 2 Aug 2018 21:26:19 +0000 (21:26 +0000)]
[lldbsuite, windows] Mark tests as XFAIL on Windows or skip them
Summary:
1) Several tests that are flakey on windows fail the run even if they are marked as expected to be flakey. This is because they fail frequently enough that even a retry won't help
2) Skip several tests on Windows that will occasionally hang rather than failing or exiting. This is causing the entire test suite to hang
Reviewers: asmith, labath, zturner
Reviewed By: zturner
Differential Revision: https://reviews.llvm.org/D50198
llvm-svn: 338769
Krzysztof Parzyszek [Thu, 2 Aug 2018 20:45:06 +0000 (20:45 +0000)]
[Unittests] Fix returning string in SolveQuadraticEquationWrap
Returning a Twine caused runtime failures. Convert it to std::string
before retuning.
llvm-svn: 338768
Sam Clegg [Thu, 2 Aug 2018 20:39:19 +0000 (20:39 +0000)]
Set IsUsedInRegularObj in a consistent manor between COFF, ELF and wasm. NFC
Differential Revision: https://reviews.llvm.org/D49147
llvm-svn: 338767
Richard Smith [Thu, 2 Aug 2018 20:30:52 +0000 (20:30 +0000)]
Fix assertion failure when emitting code for a merged lambda.
llvm-svn: 338766
Craig Topper [Thu, 2 Aug 2018 20:28:45 +0000 (20:28 +0000)]
[X86] Autogenerate complete checks. NFC
llvm-svn: 338765
Lang Hames [Thu, 2 Aug 2018 20:13:58 +0000 (20:13 +0000)]
[ORC] Add a re-exports fallback definition generator.
An instance of ReexportsFallbackDefinitionGenerator can be attached to a VSO
(via setFallbackDefinitionGenerator) to re-export symbols on demandy from a
backing VSO.
llvm-svn: 338764
Julie Hockett [Thu, 2 Aug 2018 20:10:17 +0000 (20:10 +0000)]
Reland "[clang-doc] Refactoring mapper to map by scope"
Relanding with a minor change to prevent an assertion on release bots.
The result of this adjusted mapper pass is that all Function and Enum
infos are absorbed into the info of their enclosing scope (i.e. the class
or namespace in which they are defined). Namespace and Record infos are
passed along to the final output, but the second pass creates a reference
to each in its parent scope. As a result, the top-level final outputs are
Namespaces and Records.
Differential Revision: https://reviews.llvm.org/D48341
llvm-svn: 338763
George Burgess IV [Thu, 2 Aug 2018 19:50:27 +0000 (19:50 +0000)]
[Support] Add an enable bit to our DebugCounters
r337748 made us start incrementing DebugCounters all of the time. This
makes tsan unhappy in multithreaded environments.
Since it doesn't make much sense to use DebugCounters with multiple
threads, this patch makes us only count anything if the user passed a
-debug-counter option or if some other piece of code explicitly asks
for it (e.g. the pass in D50031).
The amount of global state here makes writing a unittest for this
behavior somewhat awkward. So, no test is provided.
Differential Revision: https://reviews.llvm.org/D50150
llvm-svn: 338762
Krzysztof Parzyszek [Thu, 2 Aug 2018 19:38:18 +0000 (19:38 +0000)]
Unbreak build after r338758: specify lambda return type explicitly
llvm-svn: 338760
Paul Robinson [Thu, 2 Aug 2018 19:29:38 +0000 (19:29 +0000)]
[DebugInfo/DWARF] Remove redundant iterator type. NFC
llvm-svn: 338759
Krzysztof Parzyszek [Thu, 2 Aug 2018 19:13:35 +0000 (19:13 +0000)]
[SCEV] Properly solve quadratic equations
Differential Revision: https://reviews.llvm.org/D48283
llvm-svn: 338758
Jonathan Peyton [Thu, 2 Aug 2018 19:13:07 +0000 (19:13 +0000)]
[OpenMP] Fix doacross testing for gcc
This patch adds a test using the doacross clauses in OpenMP and removes gcc from
testing kmp_doacross_check.c which is only testing the kmp rather than the
gomp interface.
Differential Revision: https://reviews.llvm.org/D50014
llvm-svn: 338757
George Karpenkov [Thu, 2 Aug 2018 18:41:25 +0000 (18:41 +0000)]
[analyzer] Fix tests.
llvm-svn: 338756
Bob Haarman [Thu, 2 Aug 2018 18:27:21 +0000 (18:27 +0000)]
[Support] [NFC] change comment about retries in createUniqueEntity
Rewording as requested on D50126 after the change was pushed.
llvm-svn: 338755
Matt Arsenault [Thu, 2 Aug 2018 18:24:55 +0000 (18:24 +0000)]
AMDGPU: Fix missing declaration of queue ptr builtin
llvm-svn: 338754
George Karpenkov [Thu, 2 Aug 2018 18:17:01 +0000 (18:17 +0000)]
[analyzer] Forward arguments in registerChecker to avoid accidental copies
Differential Revision: https://reviews.llvm.org/D50108
llvm-svn: 338753
Puyan Lotfi [Thu, 2 Aug 2018 18:16:52 +0000 (18:16 +0000)]
[NFC] clang-format cleanup of a couple files in llvm-objcopy.
llvm-svn: 338752
Tom Stellard [Thu, 2 Aug 2018 18:16:10 +0000 (18:16 +0000)]
CMake: Remove LLVM_DYLIB_SYMBOL_VERSIONING
Summary:
This option is no longer needed since r300496 added symbol
versioning by default
Reviewers: sylvestre.ledru, beanz, mgorny
Reviewed By: mgorny
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49835
llvm-svn: 338751
Jordan Rupprecht [Thu, 2 Aug 2018 18:13:40 +0000 (18:13 +0000)]
[LLD] Update split stack support to handle more generic prologues. Improve error handling. Add test file for better code-coverage. Update tests to be more complete.
Submitting patch on behalf of saugustine.
Differential Revision: https://reviews.llvm.org/D49926
llvm-svn: 338750
Martin Storsjo [Thu, 2 Aug 2018 18:12:08 +0000 (18:12 +0000)]
Work around more GCC miscompiles exposed by r338464.
This is the same fix as in r338478, for another occurrance of the
same pattern from r338464.
See gcc.gnu.org/PR86769 for details of the bug.
llvm-svn: 338749
Julie Hockett [Thu, 2 Aug 2018 18:01:37 +0000 (18:01 +0000)]
Revert "[clang-doc] Refactoring mapper to map by scope"
This reverts commit r338738 as it's breaking the bots.
llvm-svn: 338748
Erik Pilkington [Thu, 2 Aug 2018 17:45:01 +0000 (17:45 +0000)]
[itanium demangler] Support dot suffixes on block invocation functions
rdar://
32378759
llvm-svn: 338747
Zachary Turner [Thu, 2 Aug 2018 17:44:41 +0000 (17:44 +0000)]
Fix CMake build.
Some new files were committed to the repository but not added
to the CMakeLists.txt, so this patch fixes the build.
llvm-svn: 338746
Bob Haarman [Thu, 2 Aug 2018 17:41:38 +0000 (17:41 +0000)]
[Support] fix TempFile infinite loop and permission denied errors
Summary:
On Windows, TempFile::create() was prone to failing with permission
denied errors when a process created many tempfiles without providing
a model large enough to accommodate them. There was also a problem
with createUniqueEntity getting into an infinite loop when all names
permitted by the model are in use. This change fixes both of these
problems and adds a unit test for them.
Reviewers: pcc, rnk, zturner
Reviewed By: zturner
Subscribers: inglorion, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D50126
llvm-svn: 338745
Sam Clegg [Thu, 2 Aug 2018 17:38:06 +0000 (17:38 +0000)]
[WebAssembly] Ensure bitcasts that would result in invalid wasm are removed by FixFunctionBitcasts
Rather than allowing invalid bitcasts to be lowered to wasm
call instructions that won't validate, generate wrappers that
contain unreachable thereby delaying the error until runtime.
Differential Revision: https://reviews.llvm.org/D49517
llvm-svn: 338744
JF Bastien [Thu, 2 Aug 2018 17:35:46 +0000 (17:35 +0000)]
__c11_atomic_load's _Atomic can be const
Summary:
C++11 onwards specs the non-member functions atomic_load and atomic_load_explicit as taking the atomic<T> by const (potentially volatile) pointer. C11, in its infinite wisdom, decided to drop the const, and C17 will fix this with DR459 (the current draft forgot to fix B.16, but that’s not the normative part).
clang’s lib/Headers/stdatomic.h implements these as #define to the __c11_* equivalent, which are builtins with custom typecheck. Fix the typecheck.
D47613 takes care of the libc++ side.
Discussion: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058129.html
<rdar://problem/
27426936>
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D47618
llvm-svn: 338743
Zachary Turner [Thu, 2 Aug 2018 17:33:33 +0000 (17:33 +0000)]
Fix one more warning.
llvm-svn: 338742
Volodymyr Sapsai [Thu, 2 Aug 2018 17:29:53 +0000 (17:29 +0000)]
[c-index-test] Use correct executable path to discover resource directory.
Driver builds resource directory path based on provided executable path.
Instead of string "clang" use actual executable path.
rdar://problem/
42699514
Reviewers: nathawes, akyrtzi, bob.wilson
Reviewed By: akyrtzi
Subscribers: dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D50160
llvm-svn: 338741
Zachary Turner [Thu, 2 Aug 2018 17:20:31 +0000 (17:20 +0000)]
Update the LLVM VS integration to sign the assembly.
llvm-svn: 338740