Commit Graph

148106 Commits

Author SHA1 Message Date
Craig Topper
aeda136605 [APInt] Fix a few places that use APInt::getRawData to operate within the normal API.
getRawData exposes the internal type of the APInt class directly to its users. Ideally we wouldn't expose such an implementation detail.

This patch fixes a few of the easy cases by using truncate, extract, or a rotate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 06:41:11 +00:00
Craig Topper
e3ba850127 [APInt] Use operator<<= where possible. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 05:43:02 +00:00
Craig Topper
5e17d2e85c [APInt] Use operator<<= instead of shl where possible. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301103 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 05:18:31 +00:00
Davide Italiano
49f1a751ec [ThinLTO/Summary] Rename anonymous globals as last action ...
... in the per-TU -O0 pipeline.
The problem is that there could be passes registered using
`addExtensionsToPM()` introducing unnamed globals.
Asan is an example, but there may be others. Building cppcheck
with `-flto=thin` and `-fsanitize=address` triggers an assertion
while we're reading bitcode (in lib/LTO), as the BitcodeReader
assumes there are no unnamed globals (because the namer has run).
Unfortunately I wasn't able to find an easy way to test this.
I added a comment in the hope nobody moves this again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301102 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 04:49:34 +00:00
Craig Topper
1ea7b69466 [APInt] Use ashInPlace where possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301101 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 03:45:59 +00:00
Adrian Prantl
b48f5b7b50 Revert "Use DW_OP_stack_value when reconstructing variable values with arithmetic."
This reverts commit r301093 while investigating stage2 bot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301099 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 00:44:40 +00:00
Jonathan Roelofs
5807fd2aba Fix testcase: s/CHECKNEXT/CHECK-NEXT/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301098 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 23:43:44 +00:00
Sanjay Patel
7c9ed78e22 [InstCombine] clean up tests and regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 23:36:47 +00:00
Craig Topper
0d0472f857 [APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling.
For single word, shift by BitWidth was always returning 0, but for multiword it was based on original sign. Now single word matches multi word.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 22:00:03 +00:00
Adrian Prantl
702614a330 Use DW_OP_stack_value when reconstructing variable values with arithmetic.
When the location description of a source variable involves arithmetic
on the value itself, it needs to be marked with DW_OP_stack_value since it
is not describing the variable's location, but rather its value.

This is a follow-up to r297971 and fixes the source testcase quoted in
the comment in debuginfo-dce.ll.

rdar://problem/30725338

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301093 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 20:54:06 +00:00
Simon Pilgrim
14a80cdb01 [X86] Regenerate TLS tests
Use the correct check prefix for X86/X32/X64 target types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301092 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 20:13:58 +00:00
Craig Topper
e14494685b [APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
The unused upper bits are guaranteed to be 0 so we don't need to worry about accidentally counting them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 19:59:11 +00:00
Xinliang David Li
db0b3ce4eb [PartialInlining] Using existing hasAddressTaken interface to legality check/NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301090 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 19:24:19 +00:00
Sanjay Patel
56bf04cfa4 [InstCombine] use 'match' to reduce code; NFCI
The later uses of dyn_castNotVal in this block are either
incomplete (doesn't handle vector constants) or overstepping
(shouldn't handle constants at all), but this first use is
just unnecessary. 'I' is obviously not a constant, and it 
can't be a not-of-a-not because that would already be
instsimplified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 18:05:35 +00:00
Kamil Rytarowski
bb7651ba99 Update documentation for the NetBSD target
LLVM is known to work on NetBSD x86 32-bit and 64-bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301081 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 16:11:23 +00:00
Daniel Sanders
4a4290955c [globalisel][tablegen] Add support for RegisterOperand.
Summary:
It functions just like RegisterClass except that the class is obtained
from a field.

Depends on D31761.

Reviewers: ab, qcolombet, t.p.northover, rovka, kristof.beyls, aditya_nandakumar

Reviewed By: ab

Subscribers: dberris, llvm-commits, igorb

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301080 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 15:53:21 +00:00
Daniel Sanders
cc3830e7da [globalisel][tablegen] Revise API for ComplexPattern operands to improve flexibility.
Summary:
Some targets need to be able to do more complex rendering than just adding an
operand or two to an instruction. For example, it may need to insert an
instruction to extract a subreg first, or it may need to perform an operation
on the operand.

In SelectionDAG, targets would create SDNode's to achieve the desired effect
during the complex pattern predicate. This worked because SelectionDAG had a
form of garbage collection that would take care of SDNode's that were created
but not used due to a later predicate rejecting a match. This doesn't translate
well to GlobalISel and the churn was wasteful.

The API changes in this patch enable GlobalISel to accomplish the same thing
without the waste. The API is now:
	InstructionSelector::OptionalComplexRendererFn selectArithImmed(MachineOperand &Root) const;
where Root is the root of the match. The return value can be omitted to
indicate that the predicate failed to match, or a function with the signature
ComplexRendererFn can be returned. For example:
	return OptionalComplexRendererFn(
	       [=](MachineInstrBuilder &MIB) { MIB.addImm(Immed).addImm(ShVal); });
adds two immediate operands to the rendered instruction. Immed and ShVal are
captured from the predicate function.

As an added bonus, this also reduces the amount of information we need to
provide to GIComplexOperandMatcher.

Depends on D31418

Reviewers: aditya_nandakumar, t.p.northover, qcolombet, rovka, ab, javed.absar

Reviewed By: ab

Subscribers: dberris, kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 15:11:04 +00:00
Daniel Sanders
caed319d51 [globalisel][tablegen] Fix PR32733 by checking which instruction operands belong to.
canMutate() was returning true when the operands were all in the same order as
the matched instruction. However, it wasn't checking the operands were actually
on that instruction. This worked when we could only match a single instruction
but the addition of nested instruction matching led to cases where the operands
could be split across multiple instructions. canMutate() now returns false if
operands belong to instructions other than the root of the match.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301077 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 14:31:28 +00:00
David Blaikie
ae37bc3170 Fix test to handle .rel and .rela sections (& to actually specify the target architecture as X86)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301073 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 08:17:39 +00:00
David Blaikie
36e99fa5b0 Avoid using relocations for ref_addr in .dwo files
In dwo files the fixed offset can be used - if the dwos are linked into
a dwp, the dwo consumer must use the dwp tables to find out where the
original range of the debug_info was and resolve the "section relative"
value relative to that original range - effectively
avoiding/reimplementing the relocation handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301072 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 07:53:44 +00:00
David Blaikie
dae36df6c6 Fix test from polluting the source tree
(though this seems like a "does this not crash" test - which isn't very
good. Should be fixed)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301071 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 07:53:40 +00:00
Artur Pilipenko
7ff25f5145 Fix for PR32740 - Invalid floating type, unreachable between r300969 and r301029
The bug was introduced by r301018 "[InstCombine] fadd double (sitofp x), y check that the promotion is valid". The patch didn't expect that fadd can be on vectors not necessarily scalars. Add vector support along with the test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301070 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 07:24:52 +00:00
Craig Topper
b75bb044ee [APInt] Add WORD_MAX constant and use it instead of UINT64_MAX. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301069 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 06:31:36 +00:00
David Blaikie
a753d9a103 Remove the unnecessary virtual dtor from the DIEUnit hierarchy (in favor of protected dtor in the base, final derived classes with public non-virtual dtors)
These objects are never polymorphically owned/destroyed, so the virtual
dtor was unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301068 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 02:18:00 +00:00
Matt Arsenault
9254ae141b LowerSwitch: Fix producing invalid IR on unreachable code
If a switch was in an unreachable block that branched
to a block with a phi, it would leave phis with missing
predecessors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301064 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:54:12 +00:00
David Blaikie
9c1b0af658 Move Split DWARF handling to an MC option/command line argument rather than using metadata
Since Split DWARF needs to name the actual .dwo file that is generated,
it can't be known at the time the llvm::Module is produced as it may be
merged with other Modules before the object is generated and that object
may be generated with any name.

By passing the Split DWARF file name when LLVM is producing object code
the .dwo file name in the object file can match correctly.

The support for Split DWARF for implicit modules remains the same -
using metadata to store the dwo name and dwo id so that potentially
multiple skeleton CUs referring to different dwo files can be generated
from one llvm::Module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301062 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:35:26 +00:00
Kuba Mracek
9204f8cf4a Fixup for r301054: Use an explicit constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:28:01 +00:00
Easwaran Raman
4b8e4224d5 Remove a repeated comment line. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:12:16 +00:00
Kuba Mracek
1d830459ca Fixup for r301054: Only use __attribute__((no_sanitize("memory"))) when it's available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:58:55 +00:00
Matthias Braun
d534f62d26 AArch64FrameLowering: Check if the ExtraCSSpill register is actually unused
The code assumed that when saving an additional CSR register
(ExtraCSSpill==true) we would have a free register throughout the
function. This was not true if this CSR register is also used to pass
values as in the swiftself case.

rdar://31451816

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301057 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:42:08 +00:00
Kuba Mracek
d0b815c06f [libFuzzer] Always build libFuzzer
There are two reasons why users might want to build libfuzzer:
- To fuzz LLVM itself
- To get the libFuzzer.a archive file, so that they can attach it to their code
This change always builds libfuzzer, and supports the second use case if the specified flag is set.

The point of this patch is to have something that can potentially be shipped with the compiler, and this also ensures that the version of libFuzzer is correct to use with that compiler.

Patch by George Karpenkov.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301054 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:38:24 +00:00
Craig Topper
e2389da742 [APSInt] Use APInt::compare and APInt::compareSigned to implement APSInt::compareValue
APInt just got compare methods that return -1, 0, or 1 instead of just having ult/slt and eq.

This patch uses these methods to implement APSInt::compareValues so that we don't have to call do an equal comparison and then possibly a second less than comparison.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301053 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:32:27 +00:00
Craig Topper
e8b9699699 [APSInt] Make use of APInt's recently acquired in place lshr and shl capabilities in APSInt's >>= and <<= operators.
APInt hasn't acquired an in place ashr yet, but hopefully soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301052 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:30:06 +00:00
Adrian Prantl
080b5ab6da Add test coverage for mem2reg dbg.declare lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301050 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:13:55 +00:00
Eugene Zelenko
903f87efcc [Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301049 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:03:05 +00:00
Hans Wennborg
960a40ec57 Re-commit r301040 "X86: Don't emit zero-byte functions on Windows"
In addition to the original commit, tighten the condition for when to
pad empty functions to COFF Windows.  This avoids running into problems
when targeting e.g. Win32 AMDGPU, which caused test failures when this
was committed initially.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301047 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:48:41 +00:00
Frederich Munch
94f347bd33 [Test commit] Remove extra newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:39:50 +00:00
Matt Arsenault
cfadbaaf1a InferAddressSpaces: Infer for just GEPs
Fixes leaving intermediate flat addressing computations
where a GEP instruction's source is a constant expression.

Still leaves behind a trivial addrspacecast + gep pair that
instcombine is able to handle, which ideally could be folded
here directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301044 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:35:04 +00:00
Xinliang David Li
29f3141f90 [PartialInliner] Partial inliner needs to check use kind before transformation
Differential Revision: https://reviews.llvm.org/D32373



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301042 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:20:56 +00:00
Hans Wennborg
0720f631bf Revert r301040 "X86: Don't emit zero-byte functions on Windows"
This broke almost all bots. Reverting while fixing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301041 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:10:37 +00:00
Hans Wennborg
fe76aaa6ee X86: Don't emit zero-byte functions on Windows
Empty functions can lead to duplicate entries in the Guard CF Function
Table of a binary due to multiple functions sharing the same RVA,
causing the kernel to refuse to load that binary.

We had a terrific bug due to this in Chromium.

It turns out we were already doing this for Mach-O in certain
situations. This patch expands the code for that in
AsmPrinter::EmitFunctionBody() and renames
TargetInstrInfo::getNoopForMachoTarget() to simply getNoop() since it
seems it was used for not just Mach-O anyway.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:58:12 +00:00
Zachary Turner
9044c52d56 Add a dependency from llvm/test to llvm-cvtres.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301038 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:45:11 +00:00
Tim Northover
5623f8d30a AArch64: add test for "fence singlethread"
Forgot a git add yesterday.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301037 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:36:08 +00:00
Tim Northover
602538f2e2 ARM: make sure we use all entries in a vector before forming a vpaddl.
Otherwise there's some mismatch, and we'll either form an illegal type or an
illegal node.

Thanks to Eli Friedman for pointing out the problem with my original solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:35:52 +00:00
Sanjay Patel
b51ea00f00 [InstCombine] revert r300977 and r301021
This can cause an inf-loop. Investigating...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:29:17 +00:00
Zachary Turner
9dfab9e768 Fixed a type conversion error in BitVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301033 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:18:43 +00:00
Zachary Turner
82ba8f89e0 [BitVector] Make BitVector store an ArrayRef.
This makes certain operations on the underlying storage
easier since we have access to ArrayRef methods such as
drop_front, drop_back, slice, range-based for loops, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301031 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:12:08 +00:00
Adrian Prantl
cb0aed9eec typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301030 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:06:41 +00:00
Konstantin Zhuravlyov
79953642da AMDGPU/GFX9: Enable FastFMAF32
Differential Revision: https://reviews.llvm.org/D32363


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301029 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:57:53 +00:00
Konstantin Zhuravlyov
8c373cc5e6 AMDGPU: Temporarily disable packed inlinable literals (v2f16, v2i16)
Differential Revision: https://reviews.llvm.org/D32361


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:45:22 +00:00