Rui Ueyama [Wed, 28 Feb 2018 00:31:16 +0000 (00:31 +0000)]
[WebAssembly] Remove redundant local variables.
Differential Revision: https://reviews.llvm.org/D43709
llvm-svn: 326280
Rui Ueyama [Wed, 28 Feb 2018 00:28:07 +0000 (00:28 +0000)]
[WebAssembly] Simplify createLikingSection.
Summary: [WebAssembly] Simplify createLikingSection.
Reviewers: sbc100
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D43715
llvm-svn: 326279
Konstantin Zhuravlyov [Wed, 28 Feb 2018 00:27:00 +0000 (00:27 +0000)]
AMDGPU: Move run and check lines around to match processor order in AMDGPU.h
llvm-svn: 326278
Rui Ueyama [Wed, 28 Feb 2018 00:26:26 +0000 (00:26 +0000)]
[WebAssembly] Inline accessor functions that are called only once.
Looks like these accessor functions are a bit overly defensive, and
due to the amount of code, that part isn't easy to read. We have
code to log translation results in writeTo and writeRelocations, so
I don't think we need to log it again in these functions.
I think the new function is much easier to understand.
Differential Revision: https://reviews.llvm.org/D43713
llvm-svn: 326277
Rui Ueyama [Wed, 28 Feb 2018 00:20:29 +0000 (00:20 +0000)]
[WebAssembly] Remove trivial accessors.
{set,get}OutputSegment don't hide anything, so remove them.
Differential Revision: https://reviews.llvm.org/D43724
llvm-svn: 326276
Rui Ueyama [Wed, 28 Feb 2018 00:18:34 +0000 (00:18 +0000)]
[WebAssembly] Use more specific type and simplify code.
Instead of {Function,Global,Data}Symbol, use Defined{Function,Global,Data}
because undefined symbol should never reach this function.
Differential Revision: https://reviews.llvm.org/D43710
llvm-svn: 326275
Rui Ueyama [Wed, 28 Feb 2018 00:16:11 +0000 (00:16 +0000)]
[WebAssembly] Remove LastDefinedKind for consistency with undefined kinds. NFC.
Differential Revision: https://reviews.llvm.org/D43711
llvm-svn: 326274
Rui Ueyama [Wed, 28 Feb 2018 00:15:59 +0000 (00:15 +0000)]
[WebAssembly] Remove premature optimization.
I think calling reserve() for each object file is too many and isn't useful.
We can add reserve() later. By default, we shouldn't add reserve() to a lot
of places.
Differential Revision: https://reviews.llvm.org/D43722
llvm-svn: 326273
Rafael Espindola [Wed, 28 Feb 2018 00:14:18 +0000 (00:14 +0000)]
Inline trivial function. NFC.
llvm-svn: 326272
Rui Ueyama [Wed, 28 Feb 2018 00:09:22 +0000 (00:09 +0000)]
[WebAssembly] Separate addUndefined into addUndefined{Function,Data,Global}.
Previously, one function adds all types of undefined symbols. That
doesn't fit to the wasm's undefined symbol semantics well because
different types of undefined symbols are very different in wasm.
As a result, separate control flows merge in this addUndefined function
and then separate again for each type. That wasn't easy to read.
This patch separates the function into three functions. Now it is pretty
clear what we are doing for each undefined symbol type.
Differential Revision: https://reviews.llvm.org/D43697
llvm-svn: 326271
Rafael Espindola [Wed, 28 Feb 2018 00:06:01 +0000 (00:06 +0000)]
Pass a GlobalDecl to setAliasAttributes. NFC.
This just makes a followup change easier to read.
llvm-svn: 326270
Rui Ueyama [Wed, 28 Feb 2018 00:01:31 +0000 (00:01 +0000)]
[WebAssembly] Use StringRef instead of `const char *`.
Differential Revision: https://reviews.llvm.org/D43721
llvm-svn: 326269
Sam Clegg [Tue, 27 Feb 2018 23:58:03 +0000 (23:58 +0000)]
[WebAssembly] Remove DataSize from linking metadata
This means we don't need to write the linking metadata section
at all for executable (non-relocatable) output.
Differential Revision: https://reviews.llvm.org/D42869
llvm-svn: 326268
Sam Clegg [Tue, 27 Feb 2018 23:57:37 +0000 (23:57 +0000)]
[WebAssembly] Remove DataSize from linking metadata section
Neither the linker nor the runtime need this information
anymore. We were originally using this to model BSS size
but the plan is now to use the segment metadata to allow
for BSS segments.
Differential Revision: https://reviews.llvm.org/D41366
llvm-svn: 326267
Aaron Ballman [Tue, 27 Feb 2018 23:49:28 +0000 (23:49 +0000)]
Improve the way attribute argument printing happens for omitted optional arguments when pretty printing.
Patch by Joel Denny.
llvm-svn: 326266
Rafael Espindola [Tue, 27 Feb 2018 23:44:36 +0000 (23:44 +0000)]
Pass a GlobalDecl to setFunctionDefinitionAttributes. NFC.
This just makes a followup patch easier to read.
llvm-svn: 326265
Pavel Labath [Tue, 27 Feb 2018 22:45:49 +0000 (22:45 +0000)]
Fix lldbinline tests for remote targets
r326140 exposed the fact that we are not actually running inline tests on
remote targets. The tests fail to launch the inferior in the first place
because they passed an invalid working directory to the launch function.
This should fix that.
llvm-svn: 326264
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:44:41 +0000 (22:44 +0000)]
[Hexagon] Recognize more sign-extensions as inputs to 32x32-bit multiply
llvm-svn: 326263
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:40:52 +0000 (22:40 +0000)]
[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX
Absence of memory operands is treated as "aliasing everything", so
dropping them is sufficient.
Recommit r326256 with a fixed testcase.
llvm-svn: 326262
Pavel Labath [Tue, 27 Feb 2018 22:14:33 +0000 (22:14 +0000)]
[lldb] Use vFlash commands when writing to target's flash memory regions
Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup.
- Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region
Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html
Reviewers: clayborg, labath
Reviewed By: labath
Subscribers: arichardson, emaste, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>
llvm-svn: 326261
Reid Kleckner [Tue, 27 Feb 2018 22:08:15 +0000 (22:08 +0000)]
[CodeView] Lower __restrict and other pointer qualifiers correctly
Qualifiers on a pointer or reference type may apply to either the
pointee or the pointer itself. Consider 'const char *' and 'char *
const'. In the first example, the pointee data may not be modified
without casts, and in the second example, the pointer may not be updated
to point to new data.
In the general case, qualifiers are applied to types with LF_MODIFIER
records, which support the usual const and volatile qualifiers as well
as the __unaligned extension qualifier.
However, LF_POINTER records, which are used for pointers, references,
and member pointers, have flags for qualifiers applying to the
*pointer*. In fact, this is the only way to represent the restrict
qualifier, which can only apply to pointers, and cannot qualify regular
data types.
This patch causes LLVM to correctly fold 'const' and 'volatile' pointer
qualifiers into the pointer record, as well as adding support for
'__restrict' qualifiers in the same place.
Based on a patch from Aaron Smith
Differential Revision: https://reviews.llvm.org/D43060
llvm-svn: 326260
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:07:38 +0000 (22:07 +0000)]
Revert "[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX"
This reverts r326256. One testcase needs to be updated.
llvm-svn: 326259
Artem Dergachev [Tue, 27 Feb 2018 22:05:55 +0000 (22:05 +0000)]
[analyzer] UndefinedAssignmentChecker: Better warning message in implicit ctors.
When a class forgets to initialize a field in the constructor, and then gets
copied around, a warning is emitted that the value assigned to a specific field
is undefined.
When the copy/move constructor is implicit (not written out in the code) but not
trivial (is not a trivial memory copy, eg. because members have an explicit copy
constructor), the body of such constructor is auto-generated in the AST.
In this case the checker's warning message is squeezed at the top of
the class declaration, and it gets hard to guess which field is at fault.
Fix the warning message to include the name of the field.
Differential Revision: https://reviews.llvm.org/D43798
llvm-svn: 326258
Alexander Richardson [Tue, 27 Feb 2018 22:01:02 +0000 (22:01 +0000)]
[ELF] Add llvm-readelf to the lit tool substitutions
Summary:
Some of the tests invoke llvm-readelf. This currently appears to work
probably because the LLVM binary directory is included in $PATH. However,
this is quite fragile so let's just make lit expand the full path.
Reviewers: ruiu, espindola
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D43827
llvm-svn: 326257
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:00:32 +0000 (22:00 +0000)]
[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX
Absence of memory operands is treated as "aliasing everything", so
dropping them is sufficient.
llvm-svn: 326256
Shoaib Meenai [Tue, 27 Feb 2018 21:48:41 +0000 (21:48 +0000)]
[AsmPrinter] Handle qualified unnamed types in CodeView printer
When attempting to compile the following Objective-C++ code with
CodeView debug info:
void (^b)(void) = []() {};
The generated debug metadata contains a structure like the following:
!43 = !DICompositeType(tag: DW_TAG_structure_type, name: "__block_literal_1", scope: !6, file: !6, line: 1, size: 168, elements: !44)
!44 = !{!45, !46, !47, !48, !49, !52}
...
!52 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !6, line: 1, baseType: !53, size: 8, offset: 160, flags: DIFlagPublic)
!53 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !54)
!54 = !DICompositeType(tag: DW_TAG_class_type, file: !6, line: 1, flags: DIFlagFwdDecl)
Note that the member node (!52) is unnamed, but rather than pointing to
a DICompositeType directly, it points to a DIDerivedType with tag
DW_TAG_const_type, which then points to the DICompositeType. However,
the CodeView assembly printer currently assumes that the base type for
an unnamed member will always be a DICompositeType, and attempts to
perform that cast, which triggers an assertion failure, since in this
case the base type is actually a DIDerivedType, not a DICompositeType
(and we would have to get the base type of the DIDerivedType to reach
the DICompositeType). I think the debug metadata being generated by the
frontend is correct (or at least plausible), and the CodeView printer
needs to handle this case.
This patch teaches the CodeView printer to unwrap any qualifier types.
The qualifiers are just dropped for now. Ideally, they would be applied
to the added indirect members instead, but this occurs infrequently
enough that adding the logic to handle the qualifiers correctly isn't
worth it for now. A FIXME is added to note this.
Additionally, Reid pointed out that the underlying assumption that an
unnamed member must be a composite type is itself incorrect and may not
hold for all frontends. Therefore, after all qualifiers have been
stripped, check if the resulting type is in fact a DICompositeType and
just return if it isn't, rather than assuming the type and crashing if
that assumption is violated.
Differential Revision: https://reviews.llvm.org/D43803
llvm-svn: 326255
Konstantin Zhuravlyov [Tue, 27 Feb 2018 21:48:05 +0000 (21:48 +0000)]
AMDGPU: Define FP_FAST_FMA{F} macros for amdgcn
- Expand GK_*s (i.e. GFX6 -> GFX600, GFX601, etc.)
- This allows us to choose features correctly in some cases (for example, fast fmaf is available on gfx600, but not gfx601)
- Move HasFMAF, HasFP64, HasLDEXPF to GPUInfo tables
- Add HasFastFMA, HasFastFMAF to GPUInfo tables
- Add missing tests
llvm-svn: 326254
Reid Kleckner [Tue, 27 Feb 2018 21:46:40 +0000 (21:46 +0000)]
[codeview] Remove unused variable
llvm-svn: 326253
Konstantin Zhuravlyov [Tue, 27 Feb 2018 21:46:15 +0000 (21:46 +0000)]
AMDGPU: Add fast fmaf feature to gfx702
Differential Revision: https://reviews.llvm.org/D43790
llvm-svn: 326252
Alexey Bataev [Tue, 27 Feb 2018 21:31:11 +0000 (21:31 +0000)]
[OPENMP] Emit warning for non-trivial types in map clauses.
If the mapped type is non-trivial, the warning message is emitted for
better user experience.
llvm-svn: 326251
John Baldwin [Tue, 27 Feb 2018 21:24:02 +0000 (21:24 +0000)]
[libunwind][MIPS]: Add support for unwinding in N32 processes.
Summary:
N32 uses the same register context as N64. However, N32 requires one
change to properly fetch addresses from registers stored in memory.
Since N32 is an ILP32 platform, getP() only fetches the first 32-bits
of a stored register. For a big-endian platform this fetches the
upper 32-bits which will be zero. To fix this, add a new
getRegister() method to AddressSpace which is responsible for
extracting the address stored in a register in memory. This matches
getP() for all current ABIs except for N32 where it reads the 64-bit
register and returns the low 32-bits as an address. The
DwarfInstructions::getSavedRegister() method uses
AddressSpace::getRegister() instead of AddressSpace::getP().
Reviewers: sdardis, compnerd
Reviewed By: sdardis
Differential Revision: https://reviews.llvm.org/D39074
llvm-svn: 326250
Artem Dergachev [Tue, 27 Feb 2018 21:19:33 +0000 (21:19 +0000)]
[analyzer] MallocChecker: Suppress false positives in shared pointers.
Throw away MallocChecker warnings that occur after releasing a pointer within a
destructor (or its callees) after performing C11 atomic fetch_add or fetch_sub
within that destructor (or its callees).
This is an indication that the destructor's class is likely a
reference-counting pointer. The analyzer is not able to understand that the
original reference count is usually large enough to avoid most use-after-frees.
Even when the smart pointer is a local variable, we still have these false
positives that this patch suppresses, because the analyzer doesn't currently
support atomics well enough.
Differential Revision: https://reviews.llvm.org/D43791
llvm-svn: 326249
Martin Storsjo [Tue, 27 Feb 2018 21:11:03 +0000 (21:11 +0000)]
[llvm-cvtres] Update the help test after SVN r326244.
llvm-svn: 326248
Artem Dergachev [Tue, 27 Feb 2018 21:10:08 +0000 (21:10 +0000)]
[analyzer] Fix trivial copy for empty objects.
The SVal for any empty C++ object is an UnknownVal. Because RegionStore does
not have binding extents, binding an empty object to an UnknownVal may
potentially overwrite existing bindings at the same offset.
Therefore, when performing a trivial copy of an empty object, don't try to
take the value of the object and bind it to the copy. Doing nothing is accurate
enough, and it doesn't screw any existing bindings.
Differential Revision: https://reviews.llvm.org/D43714
llvm-svn: 326247
Artem Dergachev [Tue, 27 Feb 2018 21:02:58 +0000 (21:02 +0000)]
[analyzer] Track temporaries without construction contexts for destruction.
Sometimes it is not known at compile time which temporary objects will be
constructed, eg. 'x ? A() : B()' or 'C() || D()'. In this case we track which
temporary was constructed to know how to properly call the destructor.
Once the construction context for temporaries was introduced, we moved the
tracking code to the code that investigates the construction context.
Bring back the old mechanism because construction contexts are not always
available yet - eg. in the case where a temporary is constructed without a
constructor expression, eg. returned from a function by value. The mechanism
should still go away eventually.
Additionally, fix a bug in the temporary cleanup code for the case when
construction contexts are not available, which could lead to temporaries
staying in the program state and increasing memory consumption.
Differential Revision: https://reviews.llvm.org/D43666
llvm-svn: 326246
Artem Dergachev [Tue, 27 Feb 2018 20:54:40 +0000 (20:54 +0000)]
[analyzer] Don't crash when dynamic type of a variable is set via placement new.
If a variable or an otherwise a concrete typed-value region is being
placement-new'ed into, its dynamic type may change in arbitrary manners. And
when the region is used, there may be a third type that's different from both
the static and the dynamic type. It cannot be *completely* different from the
dynamic type, but it may be a base class of the dynamic type - and in this case
there isn't (and shouldn't be) any indication anywhere in the AST that there is
a derived-to-base cast from the dynamic type to the third type.
Perform a generic cast (evalCast()) from the third type to the dynamic type
in this case. From the point of view of the SVal hierarchy, this would have
produced non-canonical SVals if we used such generic cast in the normal case,
but in this case there doesn't seem to be a better option.
Differential Revision: https://reviews.llvm.org/D43659
llvm-svn: 326245
Martin Storsjo [Tue, 27 Feb 2018 20:44:33 +0000 (20:44 +0000)]
llvm-cvtres: Mention ARM64 as a supported machine type in the help text. NFC.
llvm-svn: 326244
Rui Ueyama [Tue, 27 Feb 2018 20:37:18 +0000 (20:37 +0000)]
Add `--dynamic-linker=foo` as an alias for `--dynamic-linker foo`.
This patch fixes a minor compatibility issue with ld.gold and ld.bfd.
llvm-svn: 326243
Rafael Espindola [Tue, 27 Feb 2018 20:31:22 +0000 (20:31 +0000)]
Put undefined symbols from shared libraries in the symbol table.
With the recent fixes these symbols have more in common than not with
regular undefined symbols.
llvm-svn: 326242
Sanjay Patel [Tue, 27 Feb 2018 20:17:18 +0000 (20:17 +0000)]
[InstSimplify] add tests for FP with undef operand; NFC
Are any of these correct?
llvm-svn: 326241
Artem Dergachev [Tue, 27 Feb 2018 20:14:06 +0000 (20:14 +0000)]
[analyzer] Disable constructor inlining when lifetime extending through a field.
Automatic destructors are missing in the CFG in situations like
const int &x = C().x;
For now it's better to disable construction inlining, because inlining
constructors while doing nothing on destructors is very bad.
Differential Revision: https://reviews.llvm.org/D43689
llvm-svn: 326240
Artem Dergachev [Tue, 27 Feb 2018 20:06:20 +0000 (20:06 +0000)]
[analyzer] Self-debug: Dump dynamic type info and taint with the program state.
Useful for debugging problems with dynamic type info and taint.
Differential Revision: https://reviews.llvm.org/D43657
llvm-svn: 326239
Artem Dergachev [Tue, 27 Feb 2018 20:03:35 +0000 (20:03 +0000)]
[CFG] NFC: Refactor ConstructionContext into a finite set of cases.
ConstructionContext is moved into a separate translation unit and is separated
into multiple classes. The "old" "raw" ConstructionContext is renamed into
ConstructionContextLayer - which corresponds to the idea of building the context
gradually layer-by-layer, but it isn't easy to use in the clients. Once
CXXConstructExpr is reached, layers that we've gathered so far are transformed
into the actual, "new-style" "flat" ConstructionContext, which is put into the
CFGConstructor element and has no layers whatsoever (until it actually needs
them, eg. aggregate initialization). The new-style ConstructionContext is
instead presented as a variety of sub-classes that enumerate different ways of
constructing an object in C++. There are 5 of these supported for now,
which is around a half of what needs to be supported.
The layer-by-layer buildup process is still a little bit weird, but it hides
all the weirdness in one place, that sounds like a good thing.
Differential Revision: https://reviews.llvm.org/D43533
llvm-svn: 326238
Craig Topper [Tue, 27 Feb 2018 19:53:45 +0000 (19:53 +0000)]
[ValueTracking] Teach cannotBeOrderedLessThanZeroImpl to look through ExtractElement.
This is similar to what's done in computeKnownBits and computeSignBits. Don't do anything fancy just collect information valid for any element.
Differential Revision: https://reviews.llvm.org/D43789
llvm-svn: 326237
Artem Dergachev [Tue, 27 Feb 2018 19:47:49 +0000 (19:47 +0000)]
[analyzer] Introduce correct lifetime extension behavior in simple cases.
This patch uses the reference to MaterializeTemporaryExpr stored in the
construction context since r326014 in order to model that expression correctly.
When modeling MaterializeTemporaryExpr, instead of copying the raw memory
contents from the sub-expression's rvalue to a completely new temporary region,
that we conjure up for the lack of better options, we now have the better
option to recall the region into which the object was originally constructed
and declare that region to be the value of the expression, which is semantically
correct.
This only works when the construction context is available, which is worked on
independently.
The temporary region's liveness (in the sense of removeDeadBindings) is extended
until the MaterializeTemporaryExpr is resolved, in order to keep the store
bindings around, because it wouldn't be referenced from anywhere else in the
program state.
Differential Revision: https://reviews.llvm.org/D43497
llvm-svn: 326236
Martin Storsjo [Tue, 27 Feb 2018 19:42:19 +0000 (19:42 +0000)]
[MinGW, CrossWindows] Allow passing -static together with -shared
In these combinations, link a DLL as usual, but pass -Bstatic instead
of -Bdynamic to indicate prefering static libraries.
Differential Revision: https://reviews.llvm.org/D43811
llvm-svn: 326235
George Karpenkov [Tue, 27 Feb 2018 19:28:52 +0000 (19:28 +0000)]
[analyzer] Remove redundant check
There is no point in assigning void just to crash on it in the next line
Differential Revision: https://reviews.llvm.org/D43802
llvm-svn: 326234
George Karpenkov [Tue, 27 Feb 2018 19:28:52 +0000 (19:28 +0000)]
[analyzer] Only attempt to get the value of locations of known type
Fixes https://bugs.llvm.org/show_bug.cgi?id=36474
In general, getSVal API should be changed so that it does not crash on
some non-obvious conditions.
It should either be updated to require a type, or to return Optional<SVal>.
Differential Revision: https://reviews.llvm.org/D43801
llvm-svn: 326233
Sjoerd Meijer [Tue, 27 Feb 2018 19:26:02 +0000 (19:26 +0000)]
[ARM] Another f16 litpool fix
We were always setting the block alignment to 2 bytes in Thumb mode
and 4-bytes in ARM mode (r325754, and r325012), but this could cause
reducing the block alignment when it already had been aligned (e.g.
in Thumb mode when the block is a CPE that was already 4-byte aligned).
Patch by Momchil Velikov, I've only added a test.
Differential Revision: https://reviews.llvm.org/D43777
llvm-svn: 326232
Jonas Devlieghere [Tue, 27 Feb 2018 19:24:36 +0000 (19:24 +0000)]
[dsymutil] Skip DW_AT_sibling attributes.
Following DW_AT_sibling attributes completely defeats the pruning pass.
Although clang doesn't generate the DW_AT_sibling attribute we should
still handle it correctly.
Differential revision: https://reviews.llvm.org/D43439
llvm-svn: 326231
George Karpenkov [Tue, 27 Feb 2018 19:19:49 +0000 (19:19 +0000)]
[analyzer] Quickfix: don't crash when runtime definition is not available.
llvm-svn: 326230
George Karpenkov [Tue, 27 Feb 2018 19:19:43 +0000 (19:19 +0000)]
[analyzer] Logging test quickfix #2.
llvm-svn: 326229
Craig Topper [Tue, 27 Feb 2018 19:15:40 +0000 (19:15 +0000)]
Revert r326225 "[X86] Move the load folding tables to a separate .inc file"
The bots don't seem to like the .inc file. I must be missing some cmake incantation.
llvm-svn: 326228
Krasimir Georgiev [Tue, 27 Feb 2018 19:07:47 +0000 (19:07 +0000)]
[clang-format] Format operator key in protos
Summary: This fixes a glitch where ``operator: value`` in a text proto would mess up the underlying formatting since it gets parsed as a kw_operator instead of an identifier.
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43830
llvm-svn: 326227
Peter Collingbourne [Tue, 27 Feb 2018 19:00:59 +0000 (19:00 +0000)]
ARM: Don't rewrite add reg, $sp, 0 -> mov reg, $sp if the add defines CPSR.
Differential Revision: https://reviews.llvm.org/D43807
llvm-svn: 326226
Craig Topper [Tue, 27 Feb 2018 18:46:11 +0000 (18:46 +0000)]
[X86] Move the load folding tables to a separate .inc file
These tables add 3000 lines to X86InstrInfo.cpp. And if we ever manage to auto generate them they'll be a separate file anyway.
Differential Revision: https://reviews.llvm.org/D43806
llvm-svn: 326225
Pavel Labath [Tue, 27 Feb 2018 18:42:46 +0000 (18:42 +0000)]
[LLDB] Initial version of PPC64 InstEmulation
Summary: Supports common prologue/epilogue instructions.
Reviewers: clayborg, labath
Reviewed By: clayborg, labath
Subscribers: davide, anajuliapc, alexandreyy, lbianc, nemanjai, mgorny, kbarton
Differential Revision: https://reviews.llvm.org/D43345
Author: Leandro Lupori <leandro.lupori@gmail.com>
llvm-svn: 326224
John Baldwin [Tue, 27 Feb 2018 18:40:04 +0000 (18:40 +0000)]
[libunwind] Permit additional compiler and linker flags to be passed to tests.
Summary:
This is done via new LIBUNWIND_TEST_COMPILER_FLAGS and
LIBUNWIND_TEST_LINKER_FLAGS variables.
Reviewed By: sdardis
Differential Revision: https://reviews.llvm.org/D43585
llvm-svn: 326223
Yan Zhang [Tue, 27 Feb 2018 18:35:53 +0000 (18:35 +0000)]
add UUID to the acronyms list of objc property name checks
Reviewers: benhamilton, hokein
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43775
llvm-svn: 326222
Sanjay Patel [Tue, 27 Feb 2018 18:33:24 +0000 (18:33 +0000)]
[ARM] add loop vectorizer test based on 482.sphinx3 from SPEC2006; NFC
This is a slight reduction of one of the benchmarks
that suffered with D43079. Cost model changes should
not cause this test to remain scalarized.
llvm-svn: 326221
Krzysztof Parzyszek [Tue, 27 Feb 2018 18:31:46 +0000 (18:31 +0000)]
[Hexagon] Add patterns for compares of i1 values
llvm-svn: 326220
Kamil Rytarowski [Tue, 27 Feb 2018 18:16:47 +0000 (18:16 +0000)]
Handle the NetBSD case in ToolChain::getOSLibName()
Return a new CompilerRT Path on NetBSD: "netbsd", instead of
getOS(), which returns a string like "netbsd8.9.12".
Sponsored by <The NetBSD Foundation>
llvm-svn: 326219
Pavel Labath [Tue, 27 Feb 2018 18:07:53 +0000 (18:07 +0000)]
Move TestGdbRemoteExitCode next to the other llgs tests
This test contained a copy of the inferior used by most of llgs test.
This was done to enable better paralelization, but now it's irrelevant.
llvm-svn: 326218
Sanjay Patel [Tue, 27 Feb 2018 18:06:15 +0000 (18:06 +0000)]
[AArch64] add SLP test based on TSVC; NFC
This is a slight reduction of one of the benchmarks
that suffered with D43079. Cost model changes should
not cause this test to remain scalarized.
llvm-svn: 326217
Kamil Rytarowski [Tue, 27 Feb 2018 18:05:49 +0000 (18:05 +0000)]
Disable ASan exceptions on NetBSD
This is a workarond for the fallout from D42644:
[asan] Intercept std::rethrow_exception indirectly.
Reported problem on NetBSD/amd64:
$ sh ./projects/compiler-rt/test/sanitizer_common/asan-i386-NetBSD/NetBSD/Output/ttyent.cc.script
/usr/lib/i386/libgcc.a(unwind-dw2.o): In function `_Unwind_RaiseException':
unwind-dw2.c:(.text+0x1b41): multiple definition of `_Unwind_RaiseException'
/public/llvm-build/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-i386.a(asan_interceptors.cc.o):/public/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:337: first defined here
clang-7.0: error: linker command failed with exit code 1 (use -v to see invocation)
llvm-svn: 326216
Aditya Nandakumar [Tue, 27 Feb 2018 18:04:23 +0000 (18:04 +0000)]
[GISel]: Print more fallback information when aborting
Currently when abort is enabled, we get a diagnostic saying "Fallback
path used .... " and the program terminates. To actually figure out what
the reason is, we need to run again with another verbose argument
"-pass-remarks-missed=gisel". Instead, when we are going to abort,
we might as well print expensive remarks.
https://reviews.llvm.org/D43796
llvm-svn: 326215
Han Ming Ong [Tue, 27 Feb 2018 18:02:15 +0000 (18:02 +0000)]
Removed accidentally committed code from previous commit.
llvm-svn: 326214
Han Ming Ong [Tue, 27 Feb 2018 17:53:38 +0000 (17:53 +0000)]
Got rid of weak imports of libpenergy and libpsample because we are already requiring a modern macOS (at least 10.11)
Reviewer: Jason Molenda
llvm-svn: 326213
Alexey Bataev [Tue, 27 Feb 2018 17:42:00 +0000 (17:42 +0000)]
[OPENMP] Allow multiple mappings for member expressions for pointers.
If several member expressions are mapped and they reference the same
address as a base, but access different members, this must be allowed.
llvm-svn: 326212
Sam McCall [Tue, 27 Feb 2018 17:15:50 +0000 (17:15 +0000)]
[clangd] Remove codecomplete override content API. Long live addDocument!
llvm-svn: 326211
Rafael Espindola [Tue, 27 Feb 2018 17:13:23 +0000 (17:13 +0000)]
Add missing REQUIRES.
llvm-svn: 326210
Rafael Espindola [Tue, 27 Feb 2018 17:11:10 +0000 (17:11 +0000)]
Fix gcc warning.
Should fix the build in some bots.
llvm-svn: 326209
Geoff Berry [Tue, 27 Feb 2018 16:59:10 +0000 (16:59 +0000)]
Re-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding"
Re-enable commit r323991 now that r325931 has been committed to make
MachineOperand::isRenamable() check more conservative w.r.t. code
changes and opt-in on a per-target basis.
llvm-svn: 326208
Rafael Espindola [Tue, 27 Feb 2018 16:55:25 +0000 (16:55 +0000)]
Add support for SHF_ARM_PURECODE.
Now we don't mark a PT_LOAD as readable if all its sections are
SHF_ARM_PURECODE.
llvm-svn: 326207
Kostya Kortchinsky [Tue, 27 Feb 2018 16:14:49 +0000 (16:14 +0000)]
[scudo] Introduce Chunk::getHeaderSize
Summary:
Instead of using `AlignedChunkHeaderSize`, introduce a `constexpr` function
`getHeaderSize` in the `Chunk` namespace. Switch `RoundUpTo` to a `constexpr`
as well (so we can use it in `constexpr` declarations). Mark a few variables
in the areas touched as `const`.
Overall this has no functional change, and is mostly to make things a bit more
consistent.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D43772
llvm-svn: 326206
Ben Hamilton [Tue, 27 Feb 2018 15:56:40 +0000 (15:56 +0000)]
[clang-format] Tidy up new API guessLanguage()
Summary:
This fixes a few issues djasper@ brought up in his review of D43522.
Test Plan:
make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43598
llvm-svn: 326205
Roman Lebedev [Tue, 27 Feb 2018 15:54:55 +0000 (15:54 +0000)]
Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"
This reverts commit rL326201
This broke gcc4.8 builds, compiler just segfaults:¬
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬
llvm-svn: 326204
Roman Lebedev [Tue, 27 Feb 2018 15:54:41 +0000 (15:54 +0000)]
Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"
This reverts commit rL326202
This broke gcc4.8 builds, compiler just segfaults:
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673
llvm-svn: 326203
Roman Lebedev [Tue, 27 Feb 2018 15:19:28 +0000 (15:19 +0000)]
[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>
Summary:
I'm not sure whether there are any principal reasons why it returns raw owning pointer,
or it is just a old code that was not updated post-C++11.
I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason,
but it does not //appear// asif those failures are related to these changes.
This is Clang-tools-extra part.
Clang part is D43779.
Reviewers: klimek, bkramer, alexfh, pcc
Reviewed By: alexfh
Subscribers: ioeric, jkorous-apple, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D43780
llvm-svn: 326202
Roman Lebedev [Tue, 27 Feb 2018 15:19:20 +0000 (15:19 +0000)]
[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>
Summary:
Noticed during review of D41102.
I'm not sure whether there are any principal reasons why it returns raw owning pointer,
or it is just a old code that was not updated post-C++11.
I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason,
but it does not //appear// asif those failures are related to these changes.
This is clang part.
Clang-tools-extra part is D43780.
Reviewers: klimek, bkramer, alexfh, pcc
Reviewed By: alexfh
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D43779
llvm-svn: 326201
George Rimar [Tue, 27 Feb 2018 14:06:47 +0000 (14:06 +0000)]
[ELF] - Format, fix mistype. NFC.
llvm-svn: 326198
Hans Wennborg [Tue, 27 Feb 2018 13:48:50 +0000 (13:48 +0000)]
AttrDocs.td: fix some bad code-blocks
llvm-svn: 326195
Hans Wennborg [Tue, 27 Feb 2018 13:48:47 +0000 (13:48 +0000)]
AttrDocs.td: fix bad bullet list
llvm-svn: 326194
Hans Wennborg [Tue, 27 Feb 2018 13:48:41 +0000 (13:48 +0000)]
AttrDocs.td: fix bad indent and code block
llvm-svn: 326193
Francois Ferrand [Tue, 27 Feb 2018 13:48:27 +0000 (13:48 +0000)]
clang-format: use AfterControlStatement to format ObjC control blocks
ObjC defines `@autoreleasepool` and `@synchronized` control blocks. These
used to be formatted according to the `AfterObjCDeclaration` brace-
wrapping flag, which is not very consistent.
This patch changes the behavior to use the `AfterControlStatement` flag
instead. This should not affect the behavior unless a custom brace
wrapping mode is used.
Reviewers: krasimir, djasper, klimek, benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43232
llvm-svn: 326192
Francois Ferrand [Tue, 27 Feb 2018 13:48:21 +0000 (13:48 +0000)]
clang-format: fix formatting of ObjC @synchronized blocks
Summary:
The blocks used to be formatted using the "default" behavior, and would
thus be mistaken for function calls followed by blocks: this could lead
to unexpected inlining of the block and extra line-break before the
opening brace.
They are now formatted similarly to `@autoreleasepool` blocks, as
expected:
@synchronized(self) {
f();
}
Reviewers: krasimir, djasper, klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43114
llvm-svn: 326191
Simon Pilgrim [Tue, 27 Feb 2018 12:20:37 +0000 (12:20 +0000)]
[X86][AVX] combineLoopMAddPattern - support 256-bit cases on AVX1 via SplitBinaryOpsAndApply
llvm-svn: 326189
Alexander Richardson [Tue, 27 Feb 2018 11:15:11 +0000 (11:15 +0000)]
Make the LLParser accept call instructions of variables in the program AS
Summary:
Since r325479 the DataLayout includes a program address space. However, it
is not possible to use `call %foo` if foo is a `i8(...) addrspace(200)` and
the DataLayout specifies address space 200 as the address space for functions.
With this change the IR parser will still accept variables in the program
address space as well as address space 0 for call and invoke functions.
Reviewers: pcc, arsenm, bjope, dylanmckay, theraven
Reviewed By: dylanmckay
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D43645
llvm-svn: 326188
Alexander Richardson [Tue, 27 Feb 2018 11:15:05 +0000 (11:15 +0000)]
Don't output bitcode to stdout in 2002-07-31-SlashInString.ll test
llvm-svn: 326187
Jonas Devlieghere [Tue, 27 Feb 2018 10:28:43 +0000 (10:28 +0000)]
[dsymutil][test] Add PowerPC test
Add test that verifies that we don't follow DWARF values with a
reference form class, such as DW_AT_sibling.
Since clang doesn't generate the latter attribute, we added a PowerPC
test generated on an old PowerBook G4. (Thanks Adrian!)
llvm-svn: 326183
Jonas Devlieghere [Tue, 27 Feb 2018 10:09:58 +0000 (10:09 +0000)]
[ADT] Recognize ppc as valid architecture in target triple.
Until this patch, only `powerpc` and `ppc32` were recognized as valid
PowerPC 32-bit architectures in a target triple. This was incompatible
with the triple `ppc-apple-darwin` as returned for libObject. I found
out about this when working on a test case using a binary generated on
an old PowerBook G4.
We had the choice of either fix this in the Mach-O object parser or
in the Triple implementation. I chose the latter because it feels like
the most canonical place.
Differential revision: https://reviews.llvm.org/D43760
llvm-svn: 326182
Florian Hahn [Tue, 27 Feb 2018 09:34:51 +0000 (09:34 +0000)]
[NewGVN] Update phi-of-ops def block when updating existing ValuePHI.
In case we update a ValuePHI node created earlier, we could update it
based on a different OpPHI which could be in a different block.
We need to update the TempToBlock mapping reflecting the new block,
otherwise we would end up placing the new phi node in a wrong block.
This problem is exposed by the test case in
https://bugs.llvm.org/show_bug.cgi?id=36504.
This patch fixes a slightly simpler problem than in the bug report. In
the bug's re-producer, the additional problem is that we are re-using a
ValuePHI node with to few incoming values for the new OpPHI. If this
patch makes sense, I will follow it up with a patch that creates a new
PHI node if the existing PHI node has a different number of incoming
values.
Reviewers: davide, dberlin
Reviewed By: dberlin
Differential Revision: https://reviews.llvm.org/D43770
llvm-svn: 326181
Martin Storsjo [Tue, 27 Feb 2018 08:35:35 +0000 (08:35 +0000)]
[test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.
llvm-svn: 326180
George Rimar [Tue, 27 Feb 2018 08:26:38 +0000 (08:26 +0000)]
[ELF] - Fix case of using both --icf and --symbol-ordering-file together.
Imagine that we have sections A, B, C, where A == C and
symbol ordering file containing symbols: symC, symB, symA
Previously because of ICF it was possible that final order would be
B, A or B, C. That violates order specified in ordering file.
Patch changes that.
Differential revision: https://reviews.llvm.org/D43234
llvm-svn: 326179
Jonas Paulsson [Tue, 27 Feb 2018 07:53:23 +0000 (07:53 +0000)]
[SystemZ] Make sure SelectCode() is not called on a target opcode.
Since getNode() might not always return the requsted opcode, for instance if
called with (ISD::AND, -1) arguments, there should be a check so that
SelectCode() is only called when appropriate.
Review: Ulrich Weigand
llvm-svn: 326178
George Burgess IV [Tue, 27 Feb 2018 07:20:49 +0000 (07:20 +0000)]
[MemorySSA] Invalidate def caches on deletion
The only cases I can come up with where this invalidation needs to
happen is when there's a deletion somewhere. If we find more creative
test-cases, we can probably go with another approach mentioned on
PR36529.
Fixes PR36529.
llvm-svn: 326177
Igor Kudrin [Tue, 27 Feb 2018 07:18:07 +0000 (07:18 +0000)]
[ELF] Create and export symbols provided by a linker script if they referenced by DSOs.
It should be possible to resolve undefined symbols in dynamic libraries
using symbols defined in a linker script.
Differential Revision: https://reviews.llvm.org/D43011
llvm-svn: 326176
George Burgess IV [Tue, 27 Feb 2018 06:43:19 +0000 (06:43 +0000)]
[MemorySSA] Call the correct dtors
It appears that there were many cases where we were directly (through
templates) calling the dtor of MemoryAccess, which is conceptually an
abstract class.
This hasn't been a problem, since the data members of all of the
subclasses of MemoryAccess have been POD. I'm planning on changing that.
:)
llvm-svn: 326175
Serguei Katkov [Tue, 27 Feb 2018 06:39:31 +0000 (06:39 +0000)]
[SCEV] Cleanup SCEVInitRewriter. NFC.
Set default value for IgnoreOtherLoops of SCEVInitRewriter::rewrite to true
to be consistent with SCEVPostIncRewriter which does not have this parameter
but behaves as it would be true.
This is follow up for rL326067.
llvm-svn: 326174
Martin Storsjo [Tue, 27 Feb 2018 06:27:06 +0000 (06:27 +0000)]
[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields
When targeting GNU/MinGW for i386, the size of the "long double" data
type is 12 bytes (while it is 8 bytes in MSVC). When building
with -mms-bitfields to have struct layouts match MSVC, data types
are laid out in a struct with alignment according to their size.
However, this doesn't make sense for the long double type, since
it doesn't match MSVC at all, and aligning to a non-power-of-2
size triggers other asserts later.
This matches what GCC does, aligning a long double to 4 bytes
in structs on i386 even when -mms-bitfields is specified.
This fixes asserts when using the max_align_t data type when
building for MinGW/i386 with the -mms-bitfields flag.
Differential Revision: https://reviews.llvm.org/D43734
llvm-svn: 326173