platform/upstream/llvm.git
7 years agoUpdate documentation for the NetBSD target
Kamil Rytarowski [Sat, 22 Apr 2017 16:11:23 +0000 (16:11 +0000)]
Update documentation for the NetBSD target

LLVM is known to work on NetBSD x86 32-bit and 64-bit.

llvm-svn: 301081

7 years ago[globalisel][tablegen] Add support for RegisterOperand.
Daniel Sanders [Sat, 22 Apr 2017 15:53:21 +0000 (15:53 +0000)]
[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

llvm-svn: 301080

7 years ago[globalisel][tablegen] Revise API for ComplexPattern operands to improve flexibility.
Daniel Sanders [Sat, 22 Apr 2017 15:11:04 +0000 (15:11 +0000)]
[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

llvm-svn: 301079

7 years ago[globalisel][tablegen] Fix PR32733 by checking which instruction operands belong to.
Daniel Sanders [Sat, 22 Apr 2017 14:31:28 +0000 (14:31 +0000)]
[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.

llvm-svn: 301077

7 years ago[OpenMP] libomptarget: Set ref count for global objects to positive infinity
George Rokos [Sat, 22 Apr 2017 11:45:03 +0000 (11:45 +0000)]
[OpenMP] libomptarget: Set ref count for global objects to positive infinity

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

llvm-svn: 301076

7 years ago[OpenMP] libomptarget: Remove obsolete negative device IDs -2/-3
George Rokos [Sat, 22 Apr 2017 11:21:54 +0000 (11:21 +0000)]
[OpenMP] libomptarget: Remove obsolete negative device IDs -2/-3

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

llvm-svn: 301075

7 years ago[OpenMP] Run libomptarget regression tests using all available system threads.
George Rokos [Sat, 22 Apr 2017 11:20:20 +0000 (11:20 +0000)]
[OpenMP] Run libomptarget regression tests using all available system threads.

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

llvm-svn: 301074

7 years agoFix test to handle .rel and .rela sections (& to actually specify the target architec...
David Blaikie [Sat, 22 Apr 2017 08:17:39 +0000 (08:17 +0000)]
Fix test to handle .rel and .rela sections (& to actually specify the target architecture as X86)

llvm-svn: 301073

7 years agoAvoid using relocations for ref_addr in .dwo files
David Blaikie [Sat, 22 Apr 2017 07:53:44 +0000 (07:53 +0000)]
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.

llvm-svn: 301072

7 years agoFix test from polluting the source tree
David Blaikie [Sat, 22 Apr 2017 07:53:40 +0000 (07:53 +0000)]
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)

llvm-svn: 301071

7 years agoFix for PR32740 - Invalid floating type, unreachable between r300969 and r301029
Artur Pilipenko [Sat, 22 Apr 2017 07:24:52 +0000 (07:24 +0000)]
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.

llvm-svn: 301070

7 years ago[APInt] Add WORD_MAX constant and use it instead of UINT64_MAX. NFC
Craig Topper [Sat, 22 Apr 2017 06:31:36 +0000 (06:31 +0000)]
[APInt] Add WORD_MAX constant and use it instead of UINT64_MAX. NFC

llvm-svn: 301069

7 years agoRemove the unnecessary virtual dtor from the DIEUnit hierarchy (in favor of protected...
David Blaikie [Sat, 22 Apr 2017 02:18:00 +0000 (02:18 +0000)]
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.

llvm-svn: 301068

7 years agoThreadSanitizer plugin: match for loop variable with expected type
Ed Maste [Sat, 22 Apr 2017 01:38:54 +0000 (01:38 +0000)]
ThreadSanitizer plugin: match for loop variable with expected type

Removes Clang warning ThreadSanitizerRuntime.cpp:591:21: warning:
comparison of integers of different signs: 'int' and 'size_t' (aka
'unsigned long') [-Wsign-compare]

llvm-svn: 301067

7 years agoRearrange some Modules TS testcases into test/CXX/modules-ts.
Richard Smith [Sat, 22 Apr 2017 00:47:53 +0000 (00:47 +0000)]
Rearrange some Modules TS testcases into test/CXX/modules-ts.

llvm-svn: 301066

7 years ago[cfi] Disable thinlto tests on Darwin.
Ahmed Bougacha [Sat, 22 Apr 2017 00:07:47 +0000 (00:07 +0000)]
[cfi] Disable thinlto tests on Darwin.

These were added in r301016, but they're failing, because
-fsanitize=cfi seemingly causes -flto=thin to emit raw bitcode objects,
rather than the mach-o-wrapped bitcode we emit with -flto=thin alone.

That causes all tests to fail with ld64 errors.

Filed PR32741.

llvm-svn: 301065

7 years agoLowerSwitch: Fix producing invalid IR on unreachable code
Matt Arsenault [Fri, 21 Apr 2017 23:54:12 +0000 (23:54 +0000)]
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.

llvm-svn: 301064

7 years agoMove Split DWARF handling to an MC option/command line argument rather than using...
David Blaikie [Fri, 21 Apr 2017 23:35:36 +0000 (23:35 +0000)]
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.

llvm-svn: 301063

7 years agoMove Split DWARF handling to an MC option/command line argument rather than using...
David Blaikie [Fri, 21 Apr 2017 23:35:26 +0000 (23:35 +0000)]
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.

llvm-svn: 301062

7 years agoFixup for r301054: Use an explicit constructor.
Kuba Mracek [Fri, 21 Apr 2017 23:28:01 +0000 (23:28 +0000)]
Fixup for r301054: Use an explicit constructor.

llvm-svn: 301061

7 years agocmath: Skip Libc for integral types in isinf, etc.
Duncan P. N. Exon Smith [Fri, 21 Apr 2017 23:14:55 +0000 (23:14 +0000)]
cmath: Skip Libc for integral types in isinf, etc.

For std::isinf, the standard requires effectively calling isinf as
double from Libc for integral types. But integral types are never
infinite; we don't need to call Libc to return false.

Also short-circuit other functions where Libc won't have interesting
answers: signbit, fpclassify, isfinite, isnan, and isnormal.

I added correctness tests for integral types since we're no longer
deferring to Libc.

In review it was pointed out that in future revisions of the C++
standard we may add more types to std::is_arithmetic (e.g.,
std::is_fixed_point).  I'll leave it to a future commit to hack this to
allow using math functions on those.  We'll need to change things like
__libcpp_fpclassify anyway, so I'm not sure anything here would really
be future-proof.

https://reviews.llvm.org/D31561
rdar://problem/31361223

llvm-svn: 301060

7 years agoRemove a repeated comment line. NFC.
Easwaran Raman [Fri, 21 Apr 2017 23:12:16 +0000 (23:12 +0000)]
Remove a repeated comment line. NFC.

llvm-svn: 301059

7 years agoFixup for r301054: Only use __attribute__((no_sanitize("memory"))) when it's available.
Kuba Mracek [Fri, 21 Apr 2017 22:58:55 +0000 (22:58 +0000)]
Fixup for r301054: Only use __attribute__((no_sanitize("memory"))) when it's available.

llvm-svn: 301058

7 years agoAArch64FrameLowering: Check if the ExtraCSSpill register is actually unused
Matthias Braun [Fri, 21 Apr 2017 22:42:08 +0000 (22:42 +0000)]
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

llvm-svn: 301057

7 years agoP0629R0: Switch to latest proposal for distinguishing module interface from implement...
Richard Smith [Fri, 21 Apr 2017 22:39:18 +0000 (22:39 +0000)]
P0629R0: Switch to latest proposal for distinguishing module interface from implementation.

This switches from the prototype syntax in P0273R0 ('module' and 'module
implementation') to the consensus syntax 'export module' and 'module'.

In passing, drop the "module declaration must be first" enforcement, since EWG
seems to have changed its mind on that.

llvm-svn: 301056

7 years agoExpand test coverage for LWG2857
Casey Carter [Fri, 21 Apr 2017 22:38:59 +0000 (22:38 +0000)]
Expand test coverage for LWG2857

* Cover optional's emplace-from-initializer_list overload

* Verify that any::emplace and optional::emplace return a reference to the correct type even for throwing cases.

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

llvm-svn: 301055

7 years ago[libFuzzer] Always build libFuzzer
Kuba Mracek [Fri, 21 Apr 2017 22:38:24 +0000 (22:38 +0000)]
[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

llvm-svn: 301054

7 years ago[APSInt] Use APInt::compare and APInt::compareSigned to implement APSInt::compareValue
Craig Topper [Fri, 21 Apr 2017 22:32:27 +0000 (22:32 +0000)]
[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

llvm-svn: 301053

7 years ago[APSInt] Make use of APInt's recently acquired in place lshr and shl capabilities...
Craig Topper [Fri, 21 Apr 2017 22:30:06 +0000 (22:30 +0000)]
[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.

llvm-svn: 301052

7 years ago[index] Take into account the category's external_symbol attr for namespacing its...
Argyrios Kyrtzidis [Fri, 21 Apr 2017 22:27:06 +0000 (22:27 +0000)]
[index] Take into account the category's external_symbol attr for namespacing its methods

llvm-svn: 301051

7 years agoAdd test coverage for mem2reg dbg.declare lowering.
Adrian Prantl [Fri, 21 Apr 2017 22:13:55 +0000 (22:13 +0000)]
Add test coverage for mem2reg dbg.declare lowering.

llvm-svn: 301050

7 years ago[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 21 Apr 2017 22:03:05 +0000 (22:03 +0000)]
[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 301049

7 years ago[lsan] Enable LSan on PowerPC64.
Alex Shlyapnikov [Fri, 21 Apr 2017 21:59:53 +0000 (21:59 +0000)]
[lsan] Enable LSan on PowerPC64.

Summary: Re-landing reverted D31995 with suppressions defined in D32303 and D32377.

Reviewers: eugenis

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 301048

7 years agoRe-commit r301040 "X86: Don't emit zero-byte functions on Windows"
Hans Wennborg [Fri, 21 Apr 2017 21:48:41 +0000 (21:48 +0000)]
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.

llvm-svn: 301047

7 years ago[Test commit] Remove extra newline.
Frederich Munch [Fri, 21 Apr 2017 21:39:50 +0000 (21:39 +0000)]
[Test commit] Remove extra newline.

llvm-svn: 301046

7 years ago[coff] for /msvclto, pass archive members with prevailing symbols first
Bob Haarman [Fri, 21 Apr 2017 21:38:01 +0000 (21:38 +0000)]
[coff] for /msvclto, pass archive members with prevailing symbols first

Summary: When using /msvclto, lld and MSVC's linker both do their own symbol resolution. This can cause them to select different archive members, which can result in undefined references. This change avoids that situation by extracting archive members that are selected by lld and passing those to link.exe before any archives, so that MSVC's uses those objects for symbol resolution instead of different archive members.

Reviewers: pcc, rnk, ruiu

Reviewed By: pcc

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 301045

7 years agoInferAddressSpaces: Infer for just GEPs
Matt Arsenault [Fri, 21 Apr 2017 21:35:04 +0000 (21:35 +0000)]
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.

llvm-svn: 301044

7 years agoSuppress DTLS leak happening in some glibc versions.
Alex Shlyapnikov [Fri, 21 Apr 2017 21:34:37 +0000 (21:34 +0000)]
Suppress DTLS leak happening in some glibc versions.

Summary: Refer to https://sourceware.org/bugzilla/show_bug.cgi?id=12650 for the context.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 301043

7 years ago[PartialInliner] Partial inliner needs to check use kind before transformation
Xinliang David Li [Fri, 21 Apr 2017 21:20:56 +0000 (21:20 +0000)]
[PartialInliner] Partial inliner needs to check use kind before transformation

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

llvm-svn: 301042

7 years agoRevert r301040 "X86: Don't emit zero-byte functions on Windows"
Hans Wennborg [Fri, 21 Apr 2017 21:10:37 +0000 (21:10 +0000)]
Revert r301040 "X86: Don't emit zero-byte functions on Windows"

This broke almost all bots. Reverting while fixing.

llvm-svn: 301041

7 years agoX86: Don't emit zero-byte functions on Windows
Hans Wennborg [Fri, 21 Apr 2017 20:58:12 +0000 (20:58 +0000)]
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

llvm-svn: 301040

7 years agoAdd comments to the diagnostic kinds in Diagnostic.td.
Nico Weber [Fri, 21 Apr 2017 20:55:00 +0000 (20:55 +0000)]
Add comments to the diagnostic kinds in Diagnostic.td.

https://reviews.llvm.org/D32371

llvm-svn: 301039

7 years agoAdd a dependency from llvm/test to llvm-cvtres.
Zachary Turner [Fri, 21 Apr 2017 20:45:11 +0000 (20:45 +0000)]
Add a dependency from llvm/test to llvm-cvtres.

llvm-svn: 301038

7 years agoAArch64: add test for "fence singlethread"
Tim Northover [Fri, 21 Apr 2017 20:36:08 +0000 (20:36 +0000)]
AArch64: add test for "fence singlethread"

Forgot a git add yesterday.

llvm-svn: 301037

7 years agoARM: make sure we use all entries in a vector before forming a vpaddl.
Tim Northover [Fri, 21 Apr 2017 20:35:52 +0000 (20:35 +0000)]
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.

llvm-svn: 301036

7 years ago[InstCombine] revert r300977 and r301021
Sanjay Patel [Fri, 21 Apr 2017 20:29:17 +0000 (20:29 +0000)]
[InstCombine] revert r300977 and r301021

This can cause an inf-loop. Investigating...

llvm-svn: 301035

7 years agoCorrect the names of some target conditional defines in debugserver.
Jason Molenda [Fri, 21 Apr 2017 20:19:28 +0000 (20:19 +0000)]
Correct the names of some target conditional defines in debugserver.

llvm-svn: 301034

7 years agoFixed a type conversion error in BitVector.
Zachary Turner [Fri, 21 Apr 2017 20:18:43 +0000 (20:18 +0000)]
Fixed a type conversion error in BitVector.

llvm-svn: 301033

7 years ago[ms] Give -Wmicrosoft-enum-forward-reference a chance to fire in clang-cl, PR32736
Nico Weber [Fri, 21 Apr 2017 20:12:26 +0000 (20:12 +0000)]
[ms] Give -Wmicrosoft-enum-forward-reference a chance to fire in clang-cl, PR32736

clang-cl sets MicrosoftCompat. In that mode, we always give enums a fixed
underlying type, and for enums with fixed underlying type we never enter the
block that tries to emit ext_ms_forward_ref_enum. Fix this by requiring an
explicit underlying type when we're skipping this diagnostic.

We had a test for this warning, but it only ran in C++98 mode. clang-cl always
enables -std=c++14, so MicrosoftCompatibiliy-cxx98.cpp is a fairly useless
test. Fold it into MicrosoftCompatibility.cpp -- that way, the test checks if
-Wmicrosoft-enum-forward-reference can fire in clang-cl builds.

https://reviews.llvm.org/D32369

llvm-svn: 301032

7 years ago[BitVector] Make BitVector store an ArrayRef.
Zachary Turner [Fri, 21 Apr 2017 20:12:08 +0000 (20:12 +0000)]
[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

llvm-svn: 301031

7 years agotypo
Adrian Prantl [Fri, 21 Apr 2017 20:06:41 +0000 (20:06 +0000)]
typo

llvm-svn: 301030

7 years agoAMDGPU/GFX9: Enable FastFMAF32
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:57:53 +0000 (19:57 +0000)]
AMDGPU/GFX9: Enable FastFMAF32

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

llvm-svn: 301029

7 years agoAMDGPU: Temporarily disable packed inlinable literals (v2f16, v2i16)
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:45:22 +0000 (19:45 +0000)]
AMDGPU: Temporarily disable packed inlinable literals (v2f16, v2i16)

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

llvm-svn: 301028

7 years ago[asan] Optimize strchr for strict_string_checks=false
Vitaly Buka [Fri, 21 Apr 2017 19:39:46 +0000 (19:39 +0000)]
[asan] Optimize strchr for strict_string_checks=false

Summary:
strchr interceptor does not need to call strlen if strict_string_checks is not
enabled. Unnecessary strlen calls affect python parser performance.

Reviewers: eugenis, kcc

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 301027

7 years agoAMDGPU: Fix S_PACK_HH_B32_B16
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:35:05 +0000 (19:35 +0000)]
AMDGPU: Fix S_PACK_HH_B32_B16
  - We really ought to zero out lower 16 bits

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

llvm-svn: 301026

7 years ago[AMDGPU] Handle SI_MASKED_UNREACHABLE in instruction emitter
Yaxun Liu [Fri, 21 Apr 2017 19:32:02 +0000 (19:32 +0000)]
[AMDGPU] Handle SI_MASKED_UNREACHABLE in instruction emitter

SI_MASKED_UNREACHABLE does not have machine instruction encoding.
It needs special handling in AMDGPUAsmPrinter::EmitInstruction like some
other pseudo instructions.

This patch fixes compilation failure of RadeonRays.

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

llvm-svn: 301025

7 years agoRevert "X86RegisterInfo: eliminateFrameIndex: Avoid code duplication; NFC"
Matthias Braun [Fri, 21 Apr 2017 19:26:45 +0000 (19:26 +0000)]
Revert "X86RegisterInfo: eliminateFrameIndex: Avoid code duplication; NFC"

It seems we have on situation in a sanitizer enable bootstrap build
where the return instruction has a frame index operand that does not
point to a fixed object and fails the assert added here.

This reverts commit r300923.
This reverts commit r300922.

llvm-svn: 301024

7 years agoAMDGPU: Do not lower fast unsafe div for safe, f32, with fp32 denormals
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:25:33 +0000 (19:25 +0000)]
AMDGPU: Do not lower fast unsafe div for safe, f32, with fp32 denormals

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

llvm-svn: 301023

7 years ago[cfi] Replace elif with elseif in cmake.
Evgeniy Stepanov [Fri, 21 Apr 2017 19:22:15 +0000 (19:22 +0000)]
[cfi] Replace elif with elseif in cmake.

Apparently, elif() is deprecated.

llvm-svn: 301022

7 years ago[InstCombine] use isSubsetOf() for efficiency
Sanjay Patel [Fri, 21 Apr 2017 19:16:52 +0000 (19:16 +0000)]
[InstCombine] use isSubsetOf() for efficiency

C | ~D == -1
~(C | ~D) == 0
~C & D == 0
D & ~C == 0
D.isSubsetOf(C)

llvm-svn: 301021

7 years ago[CMake] Link unittests only against libLLVM.so, if available.
Michael Kruse [Fri, 21 Apr 2017 19:03:51 +0000 (19:03 +0000)]
[CMake] Link unittests only against libLLVM.so, if available.

We can only link against libLLVM.so or the individual libLLVM*.so
components, but not both of them. Doing so results in these components
exist twice in the programs address space, since it is already contained
in libLLVM.so. The observable effect of this is that command line
switches are registered multiple times (once for each instance),
which is an error.

This fixes llvm.org/PR32735.

Reported-by: Singapuram Sanjay Srivallabh <singapuram.sanjay@gmail.com>
llvm-svn: 301020

7 years ago[AArch64] Improve code generation for logical instructions taking
Akira Hatanaka [Fri, 21 Apr 2017 18:53:12 +0000 (18:53 +0000)]
[AArch64] Improve code generation for logical instructions taking
immediate operands.

This commit adds an AArch64 dag-combine that optimizes code generation
for logical instructions taking immediate operands. The optimization
uses demanded bits to change a logical instruction's immediate operand
so that the immediate can be folded into the immediate field of the
instruction.

This recommits r300932 and r300930, which was causing dag-combine to
loop forever. The problem was that optimizeLogicalImm was returning
true even when there was no change to the immediate node (which happened
when the immediate was all zeros or ones), which caused dag-combine to
push and pop the same node to the work list over and over again without
making any progress.

This commit fixes the bug by returning false early in optimizeLogicalImm
if the immediate is all zeros or ones. Also, it changes the code to
compare the immediate with 0 or Mask rather than calling
countPopulation.

rdar://problem/18231627

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

llvm-svn: 301019

7 years ago[InstCombine] fadd double (sitofp x), y check that the promotion is valid
Artur Pilipenko [Fri, 21 Apr 2017 18:45:25 +0000 (18:45 +0000)]
[InstCombine] fadd double (sitofp x), y check that the promotion is valid

Doing these transformations check that the result of integer addition is representable in the FP type.

(fadd double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
(fadd double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))

This is a fix for https://bugs.llvm.org//show_bug.cgi?id=27036

Reviewed By: andrew.w.kaylor, scanon, spatel

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

llvm-svn: 301018

7 years agoFixup for r301007: Restrict the -D hack to Darwin.
Kuba Mracek [Fri, 21 Apr 2017 18:19:56 +0000 (18:19 +0000)]
Fixup for r301007: Restrict the -D hack to Darwin.

llvm-svn: 301017

7 years ago[cfi] Run tests with and without lld and thinlto.
Evgeniy Stepanov [Fri, 21 Apr 2017 18:11:23 +0000 (18:11 +0000)]
[cfi] Run tests with and without lld and thinlto.

Run tests in all configurations:
(standalone, with devirtualization) * (gold, lld) * (lto, thinlto)

llvm-svn: 301016

7 years ago[scudo] Bypass Quarantine if its size is set to 0
Kostya Kortchinsky [Fri, 21 Apr 2017 18:10:53 +0000 (18:10 +0000)]
[scudo] Bypass Quarantine if its size is set to 0

Summary:
In the current state of things, the deallocation path puts a chunk in the
Quarantine whether it's enabled or not (size of 0). When the Quarantine is
disabled, this results in the header being loaded (and checked) twice, and
stored (and checksummed) once, in `deallocate` and `Recycle`.

This change introduces a `quarantineOrDeallocateChunk` function that has a
fast path to deallocation if the Quarantine is disabled. Even though this is
not the preferred configuration security-wise, this change saves a sizeable
amount of processing for that particular situation (which could be adopted by
low memory devices). Additionally this simplifies a bit `deallocate` and
`reallocate`.

Reviewers: dvyukov, kcc, alekseyshl

Reviewed By: dvyukov

Subscribers: llvm-commits

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

llvm-svn: 301015

7 years ago[BitVector] Add find_last() and find_last_unset().
Zachary Turner [Fri, 21 Apr 2017 18:07:46 +0000 (18:07 +0000)]
[BitVector] Add find_last() and find_last_unset().

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

llvm-svn: 301014

7 years agoCOFF: add support for CONSTANT exports
Saleem Abdulrasool [Fri, 21 Apr 2017 18:05:46 +0000 (18:05 +0000)]
COFF: add support for CONSTANT exports

The CONSTANT export type is marked as obsolete, but link still supports
this.  Furthermore, WinObjC uses this for certain exports.  Add support
for this export type.

llvm-svn: 301013

7 years agoRevert r301010: Bot failures on Windows, NetBSD and even some old Darwin.
Kuba Mracek [Fri, 21 Apr 2017 18:02:22 +0000 (18:02 +0000)]
Revert r301010: Bot failures on Windows, NetBSD and even some old Darwin.

llvm-svn: 301012

7 years ago[tsan] Add a test for "external" API that checks the dup suppression is based on...
Kuba Mracek [Fri, 21 Apr 2017 17:49:19 +0000 (17:49 +0000)]
[tsan] Add a test for "external" API that checks the dup suppression is based on the caller PC

We need to make sure that the "external" API isn't dup'ing all data races into a single one (because the stack might look the same) and suppressing all external races. This works now, so just adding a test for that.

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

llvm-svn: 301011

7 years ago[libFuzzer] Always build libFuzzer
Kuba Mracek [Fri, 21 Apr 2017 17:47:44 +0000 (17:47 +0000)]
[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

llvm-svn: 301010

7 years ago[tsan] Refactor __tsan_external_read/__tsan_external_write to avoid code duplication
Kuba Mracek [Fri, 21 Apr 2017 17:41:01 +0000 (17:41 +0000)]
[tsan] Refactor __tsan_external_read/__tsan_external_write to avoid code duplication

Let's introduce a ExternalAccess function that has the shared code only once.

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

llvm-svn: 301008

7 years ago[libFuzzer] Changing thread_local to __thread in libFuzzer
Kuba Mracek [Fri, 21 Apr 2017 17:39:50 +0000 (17:39 +0000)]
[libFuzzer] Changing thread_local to __thread in libFuzzer

Old Apple compilers do not support thread_local keyword. This patch adds -Dthread_local=__thread when the compiler doesn't support thread_local.

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

llvm-svn: 301007

7 years agoAdd llvm-cvtres to LLVMBuild.txt
Zachary Turner [Fri, 21 Apr 2017 17:37:31 +0000 (17:37 +0000)]
Add llvm-cvtres to LLVMBuild.txt

It wasn't getting picked up as an implicit project, so it wasn't
being built.

llvm-svn: 301006

7 years ago[AArch64] Refactor instruction selection lowering for addresses. NFCI
Joel Jones [Fri, 21 Apr 2017 17:31:03 +0000 (17:31 +0000)]
[AArch64] Refactor instruction selection lowering for addresses. NFCI

Factor out the common code used for generating addresses into common
templated functions that call overloaded versions of a new function,
getTargetNode.

Tested with make check-llvm with targets AArch64.

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

llvm-svn: 301005

7 years agoAdd empty shell of llvm-cvtres.
Zachary Turner [Fri, 21 Apr 2017 17:30:29 +0000 (17:30 +0000)]
Add empty shell of llvm-cvtres.

This marks the beginning of an effort to port remaining
MSVC toolchain miscellaneous utilities to all platforms.

Currently clang-cl shells out to certain additional tools
such as the IDL compiler, resource compiler, and a few
other tools, but as these tools are Windows-only it
limits the ability of clang to target Windows on other
platforms.  having a full suite of these tools directly
in LLVM should eliminate this constraint.

The current implementation provides no actual functionality,
it is just an empty skeleton executable for the purposes
of making incremental changes.

Differential Revision: https://reviews.llvm.org/D32095
Patch by Eric Beckmann (ecbeckmann@google.com)

llvm-svn: 301004

7 years ago[tsan] Publish the TSan external API in tsan_interface.h
Kuba Mracek [Fri, 21 Apr 2017 17:25:47 +0000 (17:25 +0000)]
[tsan] Publish the TSan external API in tsan_interface.h

Let's make the TSan external API available and commented in the public header:

    void *__tsan_external_register_tag(const char *object_type);
    void __tsan_external_assign_tag(void *addr, void *tag);
    void __tsan_external_read(void *addr, void *caller_pc, void *tag);
    void __tsan_external_write(void *addr, void *caller_pc, void *tag);

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

llvm-svn: 301003

7 years agoARM: don't try to create an i8 -> i32 vpaddl.
Tim Northover [Fri, 21 Apr 2017 17:21:59 +0000 (17:21 +0000)]
ARM: don't try to create an i8 -> i32 vpaddl.

DAG combine was mistakenly assuming that the step-up it was looking at was
always a doubling, but it can sometimes be a larger extension in which case
we'd crash.

llvm-svn: 301002

7 years ago[tsan] Track external API accesses as 1-byte accesses (instead of 8-byte)
Kuba Mracek [Fri, 21 Apr 2017 17:21:18 +0000 (17:21 +0000)]
[tsan] Track external API accesses as 1-byte accesses (instead of 8-byte)

It doesn't really make sense to track them as 8-byte accesses.

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

llvm-svn: 301001

7 years ago[tsan] Ignore memory accesses for libignored modules for "external" races
Kuba Mracek [Fri, 21 Apr 2017 17:18:14 +0000 (17:18 +0000)]
[tsan] Ignore memory accesses for libignored modules for "external" races

On Darwin, the setting ignore_noninstrumented_modules is used to suppress false positives in code that users don't have control of. The recently added "external" API (which can be used to detect races on objects provided by system libraries, but the race is actually user's fault) ignores this flag and it can report issues in non-instrumented modules. This patch fixes that.

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

llvm-svn: 301000

7 years ago[libFuzzer] Check for target(popcnt) capability before usage
Kuba Mracek [Fri, 21 Apr 2017 16:57:37 +0000 (16:57 +0000)]
[libFuzzer] Check for target(popcnt) capability before usage

Older compilers (e.g. LLVM 3.4) do not support the attribute target("popcnt").
In order to support those, this diff check the attribute support using the preprocessor.

Patch by George Karpenkov.

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

llvm-svn: 300999

7 years ago[tsan] Don't report bugs from interceptors called from libignored modules
Kuba Mracek [Fri, 21 Apr 2017 16:44:27 +0000 (16:44 +0000)]
[tsan] Don't report bugs from interceptors called from libignored modules

This patch make sure we don't report deadlocks and other bug types when we're inside an interceptor that was called from a noninstrumented module (when ignore_noninstrumented_modules=1 is set). Adding a testcase that shows that deadlock detection still works on Darwin (to make sure we're not silencing too many reports).

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

llvm-svn: 300998

7 years ago[ValueTracking] Use APInt::setAllBits and APInt::intersects to simplify some code...
Craig Topper [Fri, 21 Apr 2017 16:43:32 +0000 (16:43 +0000)]
[ValueTracking] Use APInt::setAllBits and APInt::intersects to simplify some code. NFC

llvm-svn: 300997

7 years ago[APInt] Add compare/compareSigned methods that return -1, 0, 1. Reimplement slt/ult...
Craig Topper [Fri, 21 Apr 2017 16:13:15 +0000 (16:13 +0000)]
[APInt] Add compare/compareSigned methods that return -1, 0, 1. Reimplement slt/ult and friends using them

Currently sle and ule have to call slt/ult and eq to get the proper answer. This results in extra code for both calls and additional scans of multiword APInts.

This patch replaces slt/ult with a compareSigned/compare that can return -1, 0, or 1 so we can cover all the comparison functions with a single call.

While I was there I removed the activeBits calls and other checks at the start of the slow part of ult. Both of the activeBits calls potentially scan through each of the APInts separately. I can't imagine that's any better than just scanning them in parallel and doing the compares. Now we just share the code with tcCompare.

These changes seem to be good for about a 7-8k reduction on the size of the opt binary on my local x86-64 build.

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

llvm-svn: 300995

7 years agoRemove empty and unused header file.
Juergen Ributzka [Fri, 21 Apr 2017 16:05:01 +0000 (16:05 +0000)]
Remove empty and unused header file.

llvm-svn: 300994

7 years ago[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivale...
Daniel Sanders [Fri, 21 Apr 2017 15:59:56 +0000 (15:59 +0000)]
[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.

Summary:
The SelectionDAG importer now imports rules with Predicate's attached via
Requires, PredicateControl, etc. These predicates are implemented as
bitset's to allow multiple predicates to be tested together. However,
unlike the MC layer subtarget features, each target only pays for it's own
predicates (e.g. AArch64 doesn't have 192 feature bits just because X86
needs a lot).

Both AArch64 and X86 derive at least one predicate from the MachineFunction
or Function so they must re-initialize AvailableFeatures before each
function. They also declare locals in <Target>InstructionSelector so that
computeAvailableFeatures() can use the code from SelectionDAG without
modification.

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

Reviewed By: rovka

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

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

llvm-svn: 300993

7 years ago[SimplifyCFG] Fix the determination of PostBB in conditional store merging to handle...
Craig Topper [Fri, 21 Apr 2017 15:53:42 +0000 (15:53 +0000)]
[SimplifyCFG] Fix the determination of PostBB in conditional store merging to handle the targets on the second branch being commuted

Currently we choose PostBB as the single successor of QFB, but its possible that QTB's single successor is QFB which would make QFB the correct choice.

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

llvm-svn: 300992

7 years ago[Clangd] Failed to decode params using 1.x-compatible request message
Benjamin Kramer [Fri, 21 Apr 2017 15:51:23 +0000 (15:51 +0000)]
[Clangd] Failed to decode params using 1.x-compatible request message

textDocument/completion sends a TextDocumentPositionParams message in the 2.x
and 3.x. But in 1.x it was instead a TextDocumentPosition with inlined
parameters. This means that the "uri" field is at the top level and not in
textDocument. Because of this, some clients that maintain compability with 1.x
have both uri and textDocument.uri. Clangd, however, early returns in the
presence of anything but 'textDocument' or 'position' which prevents a client
compatible with both 3.x and 1.x to work correctly. If Clangd was a bit more
permissive (no early return), clients implementing all the versions of the
protocol would work.

Patch by Marc-Andre Laperle!

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

llvm-svn: 300991

7 years ago[Clangd] Support Authority-less URIs
Benjamin Kramer [Fri, 21 Apr 2017 15:51:18 +0000 (15:51 +0000)]
[Clangd] Support Authority-less URIs

Clangd strips URIs by removing the file:// part but some clients can send file:
which is also valid according to RFC 3896. For example, if a client sends
file:///home/user, it gets converted to /home/user but if a client sends
file:/home/user, it is left untouched and problems arise.

Patch by Marc-Andre Laperle!

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

llvm-svn: 300990

7 years ago[ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
Wei Mi [Fri, 21 Apr 2017 15:50:16 +0000 (15:50 +0000)]
[ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
places based on it.

Existing constant hoisting pass will merge a group of contants in a small range
and hoist the const materialization code to the common dominator of their uses.
However, if the uses are all in cold pathes, existing implementation may hoist
the materialization code from cold pathes to a hot place. This may hurt performance.
The patch introduces BFI to the pass and selects the best insertion places based
on it.

The change is controlled by an option consthoist-with-block-frequency which is
off by default for now.

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

llvm-svn: 300989

7 years ago[OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.
Anastasia Stulova [Fri, 21 Apr 2017 15:13:24 +0000 (15:13 +0000)]
[OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.

Check unqualified type for ndrange argument in device_side_enqueue so
device_side_enqueue accept const and volatile qualified ndranges.

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

Patch by Dmitry Borisenkov!

llvm-svn: 300988

7 years ago[AArch64][Falkor] Refine modeling of store-release exclusive instructions.
Chad Rosier [Fri, 21 Apr 2017 14:58:32 +0000 (14:58 +0000)]
[AArch64][Falkor] Refine modeling of store-release exclusive instructions.

llvm-svn: 300987

7 years ago[Mips] Document Mips Backend Relocation Principles
Joel Jones [Fri, 21 Apr 2017 14:49:27 +0000 (14:49 +0000)]
[Mips] Document Mips Backend Relocation Principles

This revision documents the combination of C++ and table-gen code that
handles relocations and addresses.

Thanks for Simon Dardis for the careful reviews.

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

llvm-svn: 300986

7 years ago[clang-format] Replace IncompleteFormat by a struct with Line
Krasimir Georgiev [Fri, 21 Apr 2017 14:35:20 +0000 (14:35 +0000)]
[clang-format] Replace IncompleteFormat by a struct with Line

Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by a struct that also contains a line number.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 300985

7 years ago[AArch64][Falkor] Refine resource needs of STRQ with register offset.
Chad Rosier [Fri, 21 Apr 2017 14:33:13 +0000 (14:33 +0000)]
[AArch64][Falkor] Refine resource needs of STRQ with register offset.

llvm-svn: 300984

7 years ago[clang-format] Clang-tidy cleanup of NamespaceEndCommentFixerTest.cpp, NFC
Krasimir Georgiev [Fri, 21 Apr 2017 14:30:01 +0000 (14:30 +0000)]
[clang-format] Clang-tidy cleanup of NamespaceEndCommentFixerTest.cpp, NFC

llvm-svn: 300983

7 years ago[clang-format] Clang-tidy cleanup of CleanupTest.cpp, NFC
Krasimir Georgiev [Fri, 21 Apr 2017 14:21:21 +0000 (14:21 +0000)]
[clang-format] Clang-tidy cleanup of CleanupTest.cpp, NFC

llvm-svn: 300982

7 years ago[PR32667] -Wdocumentation should allow @param/@returns for fields/variables
Alex Lorenz [Fri, 21 Apr 2017 14:17:49 +0000 (14:17 +0000)]
[PR32667] -Wdocumentation should allow @param/@returns for fields/variables
that have a function/block pointer type

This commit improves the -Wdocumentation warning by making sure that @param and
@returns commands won't trigger warnings when used for fields, variables,
or properties whose type is a function/block pointer type. The
function/block pointer type must be specified directly with the declaration,
and when a typedef is used the warning is still emitted.

In the future we might also want to handle the std::function type as well.

rdar://24978538

llvm-svn: 300981

7 years ago[LV] Model if-converted phi node costs
Matthew Simpson [Fri, 21 Apr 2017 14:14:54 +0000 (14:14 +0000)]
[LV] Model if-converted phi node costs

Phi nodes in non-header blocks are converted to select instructions after
if-conversion. This patch updates the cost model to account for the selects.

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

llvm-svn: 300980

7 years agoRevert r300964 + r300970 - [globalisel][tablegen] Import SelectionDAG's rule predicat...
Daniel Sanders [Fri, 21 Apr 2017 14:09:20 +0000 (14:09 +0000)]
Revert r300964 + r300970 - [globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.

It's causing llvm-clang-x86_64-expensive-checks-win to fail to compile and I
haven't worked out why. Reverting to make it green while I figure it out.

llvm-svn: 300978