platform/upstream/llvm.git
7 years ago[ELF] - Disable relro when -omagic specified.
George Rimar [Sat, 3 Dec 2016 07:09:28 +0000 (07:09 +0000)]
[ELF] - Disable relro when -omagic specified.

--omagic is an option to create old-fashioned executables in which
.text segments are writable. Today, the option is still in use to
create special-purpose programs such as boot loaders. It doesn't
make sense to create PT_GNU_RELRO for such executables.

DIfferential revision: https://reviews.llvm.org/D27297

llvm-svn: 288579

7 years ago[X86] Fix VEX encoded VPMADDUBSW to not be marked commutable.
Craig Topper [Sat, 3 Dec 2016 05:35:44 +0000 (05:35 +0000)]
[X86] Fix VEX encoded VPMADDUBSW to not be marked commutable.

This was accidentallly broken in r285515 when we started lowering the intrinsic to an ISD node. Should fix PR31241.

llvm-svn: 288578

7 years ago[X86] Add test cases demonstrating where we incorrectly commute VEX VPMADDUSBW due...
Craig Topper [Sat, 3 Dec 2016 05:35:38 +0000 (05:35 +0000)]
[X86] Add test cases demonstrating where we incorrectly commute VEX VPMADDUSBW due to a bug introduced in r285515.

I believe this is the cause of PR31241.

llvm-svn: 288577

7 years agoTurn off testsuite warnings by default with GCC
Eric Fiselier [Sat, 3 Dec 2016 03:29:45 +0000 (03:29 +0000)]
Turn off testsuite warnings by default with GCC

llvm-svn: 288576

7 years agoMake make_exception_ptr abort with -fno-exceptions
Eric Fiselier [Sat, 3 Dec 2016 03:22:11 +0000 (03:22 +0000)]
Make make_exception_ptr abort with -fno-exceptions

llvm-svn: 288575

7 years agoMark various <variant> items as complete
Eric Fiselier [Sat, 3 Dec 2016 02:47:40 +0000 (02:47 +0000)]
Mark various <variant> items as complete

llvm-svn: 288574

7 years agoWork around more -Wshadow warnings
Eric Fiselier [Sat, 3 Dec 2016 02:26:28 +0000 (02:26 +0000)]
Work around more -Wshadow warnings

llvm-svn: 288573

7 years agoRemove stale comment. NFC.
Michael Kuperstein [Sat, 3 Dec 2016 01:59:13 +0000 (01:59 +0000)]
Remove stale comment. NFC.

llvm-svn: 288572

7 years agoFix <variant> w/o exception support
Eric Fiselier [Sat, 3 Dec 2016 01:58:07 +0000 (01:58 +0000)]
Fix <variant> w/o exception support

llvm-svn: 288571

7 years agoSema: delay the DLL exported member referencing
Saleem Abdulrasool [Sat, 3 Dec 2016 01:57:47 +0000 (01:57 +0000)]
Sema: delay the DLL exported member referencing

An explicit template specialization can cause the implicit template
specialization of a type which inherits the attributes.  In such a case, we
would end up with a delayed template specialization for a dll exported type
which we would fail to reference.  This would trigger an assertion.

We now propagate the dll storage attributes through the inheritance
chain.  Only after having done so do we reference the delayed template
specializations.  This allows any implicit specializations which inherit dll
storage to also be referenced.

llvm-svn: 288570

7 years ago[TTI/CostModel] Correct the way getGEPCost() calls isLegalAddressingMode()
Haicheng Wu [Sat, 3 Dec 2016 01:57:24 +0000 (01:57 +0000)]
[TTI/CostModel] Correct the way getGEPCost() calls isLegalAddressingMode()

Fix a bug when we call isLegalAddressingMode() from getGEPCost().

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

llvm-svn: 288569

7 years ago[sanitizer-coverage] use IRB.SetCurrentDebugLocation after IRB.SetInsertPoint
Kostya Serebryany [Sat, 3 Dec 2016 01:43:30 +0000 (01:43 +0000)]
[sanitizer-coverage] use IRB.SetCurrentDebugLocation after IRB.SetInsertPoint

llvm-svn: 288568

7 years agotestcase only works in a debug build
Matthias Braun [Sat, 3 Dec 2016 01:42:32 +0000 (01:42 +0000)]
testcase only works in a debug build

llvm-svn: 288567

7 years agoRevert workaround for Clang bug. Thanks to Richard for the quick fix
Eric Fiselier [Sat, 3 Dec 2016 01:28:01 +0000 (01:28 +0000)]
Revert workaround for Clang bug. Thanks to Richard for the quick fix

llvm-svn: 288566

7 years ago[Sema] Don't perform aggregate initialization for types with explicit constructors
Eric Fiselier [Sat, 3 Dec 2016 01:26:47 +0000 (01:26 +0000)]
[Sema] Don't perform aggregate initialization for types with explicit constructors

Summary:
The C++17 rules for aggregate initialization changed to disallow types with explicit constructors [dcl.init.aggr]p1. This patch implements that new rule.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 288565

7 years agoFix -Wshadow warnings and enable warnings by default for C++ >= 11
Eric Fiselier [Sat, 3 Dec 2016 01:21:40 +0000 (01:21 +0000)]
Fix -Wshadow warnings and enable warnings by default for C++ >= 11

llvm-svn: 288564

7 years agoDR616, and part of P0135R1: member access (or pointer-to-member access) on a
Richard Smith [Sat, 3 Dec 2016 01:14:32 +0000 (01:14 +0000)]
DR616, and part of P0135R1: member access (or pointer-to-member access) on a
temporary produces an xvalue, not a prvalue. Support this by materializing the
temporary prior to performing the member access.

llvm-svn: 288563

7 years ago[doc] Add .arcconfig setup to the "how to work with a monorepo" section
Mehdi Amini [Sat, 3 Dec 2016 01:04:40 +0000 (01:04 +0000)]
[doc] Add .arcconfig setup to the "how to work with a monorepo" section

llvm-svn: 288562

7 years agoAArch64CollectLOH: Rewrite as block-local analysis.
Matthias Braun [Sat, 3 Dec 2016 00:52:56 +0000 (00:52 +0000)]
AArch64CollectLOH: Rewrite as block-local analysis.

Previously this pass was using up to 5% compile time in some cases which
is a bit much for what it is doing. The pass featured a full blown
data-flow analysis which in the default configuration was restricted to a
single block.

This rewrites the pass under the assumption that we only ever work on a
single block. This is done in a single pass maintaining a state machine
per general purpose register to catch LOH patterns.

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

llvm-svn: 288561

7 years ago[ppc] Correctly compute the cost of loading 32/64 bit memory into VSR
Guozhi Wei [Sat, 3 Dec 2016 00:41:43 +0000 (00:41 +0000)]
[ppc] Correctly compute the cost of loading 32/64 bit memory into VSR

VSX has instructions lxsiwax/lxsdx that can load 32/64 bit value into VSX register cheaply. That patch makes it known to memory cost model, so the vectorization of the test case in pr30990 is beneficial.

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

llvm-svn: 288560

7 years agoXFAIL variant tests for apple-clang
Eric Fiselier [Sat, 3 Dec 2016 00:33:03 +0000 (00:33 +0000)]
XFAIL variant tests for apple-clang

llvm-svn: 288559

7 years agoPR31244: Use the exception specification from the callee's type directly to
Richard Smith [Sat, 3 Dec 2016 00:29:06 +0000 (00:29 +0000)]
PR31244: Use the exception specification from the callee's type directly to
compute whether a call is noexcept, even if we can't map the callee expression
to a called declaration.

llvm-svn: 288558

7 years agoEnable warnings by default for C++ >= 11 and fix -Wshadow occurances
Eric Fiselier [Sat, 3 Dec 2016 00:27:13 +0000 (00:27 +0000)]
Enable warnings by default for C++ >= 11 and fix -Wshadow occurances

llvm-svn: 288557

7 years agoWork around Clang 3.8 bugs
Eric Fiselier [Sat, 3 Dec 2016 00:13:33 +0000 (00:13 +0000)]
Work around Clang 3.8 bugs

llvm-svn: 288556

7 years agoFix C++03 build
Eric Fiselier [Fri, 2 Dec 2016 23:41:18 +0000 (23:41 +0000)]
Fix C++03 build

llvm-svn: 288555

7 years agoMake variant's index part of the hash value
Eric Fiselier [Fri, 2 Dec 2016 23:38:31 +0000 (23:38 +0000)]
Make variant's index part of the hash value

llvm-svn: 288554

7 years agoSupport escaping in TrigramIndex.
Ivan Krasin [Fri, 2 Dec 2016 23:30:16 +0000 (23:30 +0000)]
Support escaping in TrigramIndex.

Summary:
This is a follow up to r288303, where I have introduced TrigramIndex
to speed up SpecialCaseList for the cases when all rules are
simple wildcards, like *hello*wor.d*.

Here, I add support for escaping, so that it's possible to
specify rules like *c\+\+abi*.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 288553

7 years agoFix generated warnings in <variant>
Eric Fiselier [Fri, 2 Dec 2016 23:17:33 +0000 (23:17 +0000)]
Fix generated warnings in <variant>

llvm-svn: 288552

7 years agoUpdate darwin ABI list for <variant>
Eric Fiselier [Fri, 2 Dec 2016 23:14:18 +0000 (23:14 +0000)]
Update darwin ABI list for <variant>

llvm-svn: 288551

7 years agoUpdate ABI lists for <variant>
Eric Fiselier [Fri, 2 Dec 2016 23:11:28 +0000 (23:11 +0000)]
Update ABI lists for <variant>

llvm-svn: 288550

7 years agoResubmit "[LibFuzzer] Split FuzzerUtil for Posix and Windows."
Zachary Turner [Fri, 2 Dec 2016 23:02:01 +0000 (23:02 +0000)]
Resubmit "[LibFuzzer] Split FuzzerUtil for Posix and Windows."

This resubmits r288529, which was resubmitted because it broke a
fuzzer bot.  According to kcc@ the test that broke was flakey
and it is unlikely to be a result of this patch.

llvm-svn: 288549

7 years agoMore diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.
Richard Smith [Fri, 2 Dec 2016 23:00:28 +0000 (23:00 +0000)]
More diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.
In passing, add a warning group for "ignored qualifier in inline assembly" warnings.

llvm-svn: 288548

7 years agoImplement C++17 <variant>. Patch from Michael Park!
Eric Fiselier [Fri, 2 Dec 2016 23:00:05 +0000 (23:00 +0000)]
Implement C++17 <variant>. Patch from Michael Park!

This patch was reviewed as https://reviews.llvm.org/D23263.

llvm-svn: 288547

7 years agoCodeGen: export typeinfo and typeinfo name on itanium
Saleem Abdulrasool [Fri, 2 Dec 2016 22:46:18 +0000 (22:46 +0000)]
CodeGen: export typeinfo and typeinfo name on itanium

When a C++ record is marked with dllexport mark both the typeinfo and the
typeinfo name as being exported.  Handle dllimport as the inverse.  This applies
to the itanium environment and not the MinGW environment.

llvm-svn: 288546

7 years agoMass-rename the handful of error_* diagnostics to err_*.
Richard Smith [Fri, 2 Dec 2016 22:38:31 +0000 (22:38 +0000)]
Mass-rename the handful of error_* diagnostics to err_*.

llvm-svn: 288545

7 years agoWork around a bug in Clang's implementation of noexcept function types
Eric Fiselier [Fri, 2 Dec 2016 22:30:52 +0000 (22:30 +0000)]
Work around a bug in Clang's implementation of noexcept function types

llvm-svn: 288544

7 years agoCheck for SD-6 feature test macro when determining which tests should be
Richard Smith [Fri, 2 Dec 2016 22:14:59 +0000 (22:14 +0000)]
Check for SD-6 feature test macro when determining which tests should be
available, rather than #ifdef'ing away the relevant tests if it's unavailable.

llvm-svn: 288543

7 years agoUpdate test expectations after AddressSanitizer text descriptions changed in r288535.
Kuba Mracek [Fri, 2 Dec 2016 22:11:26 +0000 (22:11 +0000)]
Update test expectations after AddressSanitizer text descriptions changed in r288535.

llvm-svn: 288542

7 years ago[lanai] Custom lowering of SHL_PARTS
Jacques Pienaar [Fri, 2 Dec 2016 22:01:28 +0000 (22:01 +0000)]
[lanai] Custom lowering of SHL_PARTS

Summary: Implement custom lowering of SHL_PARTS to enable lowering of left shift with larger than 32-bit shifts.

Reviewers: eliben, majnemer

Subscribers: llvm-commits

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

llvm-svn: 288541

7 years ago[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warning...
Eugene Zelenko [Fri, 2 Dec 2016 22:00:59 +0000 (22:00 +0000)]
[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 288540

7 years agoFix up r288457 for compilers that don't support noexcept function types:
Richard Smith [Fri, 2 Dec 2016 21:43:36 +0000 (21:43 +0000)]
Fix up r288457 for compilers that don't support noexcept function types:
disable the test entirely for those cases. This is a quick patch, I'll look at
a proper feature flag next.

llvm-svn: 288539

7 years agoFix copy/paste errors in new variant tests
Eric Fiselier [Fri, 2 Dec 2016 21:32:35 +0000 (21:32 +0000)]
Fix copy/paste errors in new variant tests

llvm-svn: 288538

7 years ago[sanitizer] Track architecture and UUID of modules in LoadedModule
Kuba Mracek [Fri, 2 Dec 2016 21:27:14 +0000 (21:27 +0000)]
[sanitizer] Track architecture and UUID of modules in LoadedModule

When we enumerate loaded modules, we only track the module name and base address, which then has several problems on macOS. Dylibs and executables often have several architecture slices and not storing which architecture/UUID is actually loaded creates problems with symbolication: A file path + offset isn't enough to correctly symbolicate, since the offset can be valid in multiple slices. This is especially common for Haswell+ X86_64 machines, where x86_64h slices are preferred, but if one is not available, a regular x86_64 is loaded instead. But the same issue exists for i386 vs. x86_64 as well.

This patch adds tracking of arch and UUID for each LoadedModule. At this point, this information isn't used in reports, but this is the first step. The goal is to correctly identify which slice is loaded in symbolication, and also to output this information in reports so that we can tell which exact slices were loaded in post-mortem analysis.

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

llvm-svn: 288537

7 years agoAdd tests for libc++'s constexpr variant copy/move extension
Eric Fiselier [Fri, 2 Dec 2016 21:17:51 +0000 (21:17 +0000)]
Add tests for libc++'s constexpr variant copy/move extension

llvm-svn: 288536

7 years agoSupport more report types in AddressSanitizerRuntime.cpp, re-word existing ones.
Kuba Mracek [Fri, 2 Dec 2016 21:00:32 +0000 (21:00 +0000)]
Support more report types in AddressSanitizerRuntime.cpp, re-word existing ones.

In r288065, we added more report types into ASan that will be reported via the debugging API. This patch in LLDB provides human-friendly bug descriptions. This also improves wording on existing bug descriptions.

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

llvm-svn: 288535

7 years ago[Sema] Reset a BumpPtrAllocator on clear(). NFC.
George Burgess IV [Fri, 2 Dec 2016 21:00:12 +0000 (21:00 +0000)]
[Sema] Reset a BumpPtrAllocator on clear(). NFC.

Looks like the reset() call was omitted by accident.

llvm-svn: 288534

7 years agoRevert "[LibFuzzer] Split FuzzerUtil for Posix and Windows."
Zachary Turner [Fri, 2 Dec 2016 20:54:56 +0000 (20:54 +0000)]
Revert "[LibFuzzer] Split FuzzerUtil for Posix and Windows."

This reverts commit r288529, as it seems to introduce some
problems on the Linux bots.

llvm-svn: 288533

7 years ago[WebAssembly] Fix a compiler warning. NFC.
Dan Gohman [Fri, 2 Dec 2016 20:13:05 +0000 (20:13 +0000)]
[WebAssembly] Fix a compiler warning. NFC.

Fix a warning about a comparison between signed and unsigned integer
expressions.

llvm-svn: 288532

7 years ago[LibFuzzer] Introduce a portable WeakAlias implementation.
Zachary Turner [Fri, 2 Dec 2016 19:41:17 +0000 (19:41 +0000)]
[LibFuzzer] Introduce a portable WeakAlias implementation.

Windows doesn't really support weak aliases, but with some
linker magic we can get something that's pretty close on
Windows.  This introduces an interface to accessing weakly
aliased symbols that will work on any platform.  Linker
magic changes to come in a separate patch.

Patch by Marcos Pividori
Differential Revision: https://reviews.llvm.org/D27235

llvm-svn: 288530

7 years ago[LibFuzzer] Split FuzzerUtil for Posix and Windows.
Zachary Turner [Fri, 2 Dec 2016 19:38:19 +0000 (19:38 +0000)]
[LibFuzzer] Split FuzzerUtil for Posix and Windows.

Pave the way for separating out platform specific
utility functions into separate files.

Patch by Marcos Pividori
Differential Revision: https://reviews.llvm.org/D27234

llvm-svn: 288529

7 years ago[PGO] Fix PGO use ICE when there are unreachable BBs
Rong Xu [Fri, 2 Dec 2016 19:10:29 +0000 (19:10 +0000)]
[PGO] Fix PGO use ICE when there are unreachable BBs

For -O0 there might be unreachable BBs, which breaks the assumption that all the
BBs have an auxiliary data structure.  In this patch, we add another interface
called findBBInfo() so that a nullptr can be returned for the unreachable BBs
(and the callers can ignore those BBs).

This fixes the bug reported
https://llvm.org/bugs/show_bug.cgi?id=31209

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

llvm-svn: 288528

7 years agoRemove a wrong performance optimization.
Rui Ueyama [Fri, 2 Dec 2016 18:40:43 +0000 (18:40 +0000)]
Remove a wrong performance optimization.

This is a hack for single thread execution. We are using Color[0] and
Color[1] alternately on each iteration. This optimization is to look
at the next slot as opposted to the current slot to get recent results
early. Turns out that the assumption is wrong, because the other slots
are not always have the most recent values, but instead it may have
stale values of the previous iteration. This patch removes that
performance hack.

llvm-svn: 288527

7 years ago[SystemZ] Support remaining atomic instructions
Ulrich Weigand [Fri, 2 Dec 2016 18:24:16 +0000 (18:24 +0000)]
[SystemZ] Support remaining atomic instructions

Add assembler support for all atomic instructions that weren't already
supported.  Some of those could be used to implement codegen for 128-bit
atomic operations, but this isn't done here yet.

llvm-svn: 288526

7 years ago[SystemZ] Support floating-point control register instructions
Ulrich Weigand [Fri, 2 Dec 2016 18:21:53 +0000 (18:21 +0000)]
[SystemZ] Support floating-point control register instructions

Add assembler support for instructions manipulating the FPC.

Also add codegen support via the GCC compatibility builtins:
  __builtin_s390_sfpc
  __builtin_s390_efpc

llvm-svn: 288525

7 years ago[SystemZ] Refactor hasSideEffects setting
Ulrich Weigand [Fri, 2 Dec 2016 18:19:22 +0000 (18:19 +0000)]
[SystemZ] Refactor hasSideEffects setting

Move setting of hasSideEffects out of SystemZInstrFormats.td,
to allow use of the format classes for instructions where this
flag shouldn't be set.  NFC.

llvm-svn: 288524

7 years agoAMDGPU: Implement isCheapAddrSpaceCast
Matt Arsenault [Fri, 2 Dec 2016 18:12:53 +0000 (18:12 +0000)]
AMDGPU: Implement isCheapAddrSpaceCast

llvm-svn: 288523

7 years ago[x86] add common check prefix to reduce duplication; NFC
Sanjay Patel [Fri, 2 Dec 2016 17:58:26 +0000 (17:58 +0000)]
[x86] add common check prefix to reduce duplication; NFC

llvm-svn: 288522

7 years agoAllow to disable unsigned operations (zext, icmp ugt, ...)
Johannes Doerfert [Fri, 2 Dec 2016 17:55:41 +0000 (17:55 +0000)]
Allow to disable unsigned operations (zext, icmp ugt, ...)

Unsigned operations are often useful to support but the heuristics are
not yet tuned. This options allows to disable them if necessary.

llvm-svn: 288521

7 years agoWith LTO and profile-use, enable hotness info in opt remarks
Adam Nemet [Fri, 2 Dec 2016 17:54:34 +0000 (17:54 +0000)]
With LTO and profile-use, enable hotness info in opt remarks

This is to match the behavior of non-LTO;
when -fsave-optimization-record is passed and PGO is available we enable
the generation of hotness information in the optimization records.

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

llvm-svn: 288520

7 years ago[LTOs] Allow generation of hotness information
Adam Nemet [Fri, 2 Dec 2016 17:53:56 +0000 (17:53 +0000)]
[LTOs] Allow generation of hotness information

The flag is passed by the clang driver.

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

llvm-svn: 288519

7 years agoMake LTO opt-remarks tests matching stricter
Adam Nemet [Fri, 2 Dec 2016 17:53:49 +0000 (17:53 +0000)]
Make LTO opt-remarks tests matching stricter

This ensures that we don't generate the hotness attribute by default.

llvm-svn: 288518

7 years agofix check-label
Sanjay Patel [Fri, 2 Dec 2016 17:50:14 +0000 (17:50 +0000)]
fix check-label

llvm-svn: 288517

7 years agoDo not allow multiple possibly aliasing ptrs in an expression
Johannes Doerfert [Fri, 2 Dec 2016 17:49:52 +0000 (17:49 +0000)]
Do not allow multiple possibly aliasing ptrs in an expression

  Relational comparisons should not involve multiple potentially
  aliasing pointers. Similarly this should hold for switch conditions
  and the two conditions involved in equality comparisons (separately!).
  This is a heuristic based on the C semantics that does only allow such
  operations when the base pointers do point into the same object.
  Since this makes aliasing likely we will bail out early instead of
  producing a probably failing runtime check.

llvm-svn: 288516

7 years ago[x86] add tests to show missing demanded bits analysis; NFC
Sanjay Patel [Fri, 2 Dec 2016 17:48:48 +0000 (17:48 +0000)]
[x86] add tests to show missing demanded bits analysis; NFC

llvm-svn: 288515

7 years agoRerun mem2reg after the inliner
Johannes Doerfert [Fri, 2 Dec 2016 17:43:57 +0000 (17:43 +0000)]
Rerun mem2reg after the inliner

It did happen that after the inliner finished we end up with promotable
allocas in a function. We now run mem2reg to make sure everything is
promoted if possible.

llvm-svn: 288514

7 years ago[CUDA] Forward sanitizer support to host toolchain
Jason Henline [Fri, 2 Dec 2016 17:32:18 +0000 (17:32 +0000)]
[CUDA] Forward sanitizer support to host toolchain

Summary:
This is an improvement on rL288448 where address sanitization was listed
as supported for the CudaToolChain. Since the intent is for the
CudaToolChain not to reject any flags supported by the host compiler,
this patch switches to forwarding the CudaToolChain sanitizer support to
the host toolchain rather than explicitly whitelisting address
sanitization.

Thanks to hfinkel for this suggestion.

Reviewers: jlebar

Subscribers: hfinkel, cfe-commits

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

llvm-svn: 288512

7 years agoRemoved a wrong assertion about non-colorable sections.
Rui Ueyama [Fri, 2 Dec 2016 17:23:58 +0000 (17:23 +0000)]
Removed a wrong assertion about non-colorable sections.

The assertion asserted that colorable sections can never have
a reference to non-colorable sections, but that was simply wrong.
They can have references to non-colorable sections. If that's the
case, referenced sections must be the same in terms of pointer
comparison.

llvm-svn: 288511

7 years ago[InstCombine] Add vector urem tests
Simon Pilgrim [Fri, 2 Dec 2016 17:16:21 +0000 (17:16 +0000)]
[InstCombine] Add vector urem tests

Demonstrate missed opportunity for urem -> and combine for powerof2 or zero non-uniform constant dividers

llvm-svn: 288510

7 years ago[InstCombine] Regenerate vector srem tests
Simon Pilgrim [Fri, 2 Dec 2016 17:12:56 +0000 (17:12 +0000)]
[InstCombine] Regenerate vector srem tests

llvm-svn: 288509

7 years agoRevert "[SLP] Fix for PR6246: vectorization for scalar ops on vector elements."
Renato Golin [Fri, 2 Dec 2016 16:56:26 +0000 (16:56 +0000)]
Revert "[SLP] Fix for PR6246: vectorization for scalar ops on vector elements."

This reverts commit r288497, as it broke the AArch64 build of Compiler-RT's
builtins (twice: once in r288412 and once in r288497). We should investigate
this offline.

llvm-svn: 288508

7 years agoRevert "Compiler-rt part of D26230: Add (constant) masked load/store support (Try...
Filipe Cabecinhas [Fri, 2 Dec 2016 16:19:14 +0000 (16:19 +0000)]
Revert "Compiler-rt part of D26230: Add (constant) masked load/store support (Try #2)"

This reverts commit r288504.

clang-bpf-build fails with no details:
******************** TEST 'AddressSanitizer-x86_64-linux ::
TestCases/masked-ops.cpp' FAILED ********************
Script:
--
/mnt/buildbot/slave-root/clang-bpf-build/stage1/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -o /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp -mavx -O1
not /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp l1 2>&1 | FileCheck -check-prefix=CHECK-L1 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp l6 2>&1 | FileCheck -check-prefix=CHECK-L6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp la 2>&1 | FileCheck -check-prefix=CHECK-LA /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
not /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp s1 2>&1 | FileCheck -check-prefix=CHECK-S1 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp s6 2>&1 | FileCheck -check-prefix=CHECK-S6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp sa 2>&1 | FileCheck -check-prefix=CHECK-SA /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
--
Exit Code: 2

Command Output (stderr):
--
FileCheck error: '-' is empty.
FileCheck command line:  FileCheck -check-prefix=CHECK-L6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp

--

********************

llvm-svn: 288507

7 years ago[DAGCombiner] do not fold (fmul (fadd X, 1), Y) -> (fmad X, Y, Y) by default
Nicolai Haehnle [Fri, 2 Dec 2016 16:06:18 +0000 (16:06 +0000)]
[DAGCombiner] do not fold (fmul (fadd X, 1), Y) -> (fmad X, Y, Y) by default

Summary:
When X = 0 and Y = inf, the original code produces inf, but the transformed
code produces nan. So this transform (and its relatives) should only be
used when the no-infs-fp-math flag is explicitly enabled.

Also disable the transform using fmad (intermediate rounding) when unsafe-math
is not enabled, since it can reduce the precision of the result; consider this
example with binary floating point numbers with two bits of mantissa:

  x = 1.01
  y = 111

  x * (y + 1) = 1.01 * 1000 = 1010 (this is the exact result; no rounding occurs at any step)

  x * y + x = 1000.11 + 1.01 =r 1000 + 1.01 = 1001.01 =r 1000 (with rounding towards zero)

The example relies on rounding towards zero at least in the second step.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98578

Reviewers: RKSimon, tstellarAMD, spatel, arsenm

Subscribers: wdng, llvm-commits

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

llvm-svn: 288506

7 years agoTidyup code with indentation and clang-format. NFCI.
Simon Pilgrim [Fri, 2 Dec 2016 15:44:30 +0000 (15:44 +0000)]
Tidyup code with indentation and clang-format. NFCI.

llvm-svn: 288505

7 years agoCompiler-rt part of D26230: Add (constant) masked load/store support (Try #2)
Filipe Cabecinhas [Fri, 2 Dec 2016 15:33:04 +0000 (15:33 +0000)]
Compiler-rt part of D26230: Add (constant) masked load/store support (Try #2)

Summary:
Unfortunately, there is no way to emit an llvm masked load/store in
clang without optimizations, and AVX enabled. Unsure how we should go
about making sure this test only runs if it's possible to execute AVX
code.

Reviewers: kcc, RKSimon, pgousseau

Subscribers: kubabrecka, dberris, llvm-commits

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

llvm-svn: 288504

7 years ago[Sparc] Fix parsing of double-precision %f18, %f20, and %f22
Daniel Cederman [Fri, 2 Dec 2016 15:05:26 +0000 (15:05 +0000)]
[Sparc] Fix parsing of double-precision %f18, %f20, and %f22

Summary: They are currently being parsed as %f14, %f16, and %f18.

Reviewers: venkatra, jyknight

Subscribers: llvm-commits

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

llvm-svn: 288503

7 years ago[clang-tidy] Do not trigger unnecessary-value-param check on methods marked as final
Felix Berger [Fri, 2 Dec 2016 14:44:16 +0000 (14:44 +0000)]
[clang-tidy] Do not trigger unnecessary-value-param check on methods marked as final

Summary: Virtual method overrides of dependent types cannot be recognized unless
they are marked as override or final.

Exclude methods marked as final from check and add test.

Reviewers: sbenza, hokein, alexfh

Subscribers: malcolm.parsons, JDevlieghere, cfe-commits

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

llvm-svn: 288502

7 years ago[X86][SSE] Renamed shuffle combine test.
Simon Pilgrim [Fri, 2 Dec 2016 14:43:39 +0000 (14:43 +0000)]
[X86][SSE] Renamed shuffle combine test.

We're trying to combine to vpunpckhbw not vpunpckhwd

llvm-svn: 288501

7 years agoCODE_OWNERS: Take ownership of IR Linker as discussed on llvm-dev
Teresa Johnson [Fri, 2 Dec 2016 14:06:53 +0000 (14:06 +0000)]
CODE_OWNERS: Take ownership of IR Linker as discussed on llvm-dev

llvm-svn: 288500

7 years ago[X86][SSE] Add support for extracting constant bit data from broadcasted constants
Simon Pilgrim [Fri, 2 Dec 2016 13:16:08 +0000 (13:16 +0000)]
[X86][SSE] Add support for extracting constant bit data from broadcasted constants

llvm-svn: 288499

7 years ago[clang-move] some tweaks.
Haojian Wu [Fri, 2 Dec 2016 12:39:39 +0000 (12:39 +0000)]
[clang-move] some tweaks.

* Don't save SourceManager for each declarations.
* Rename some out-dated methods.

No functionality change.

llvm-svn: 288498

7 years ago[SLP] Fix for PR6246: vectorization for scalar ops on vector elements.
Alexey Bataev [Fri, 2 Dec 2016 12:20:22 +0000 (12:20 +0000)]
[SLP] Fix for PR6246: vectorization for scalar ops on vector elements.

When trying to vectorize trees that start at insertelement instructions
function tryToVectorizeList() uses vectorization factor calculated as
MinVecRegSize/ScalarTypeSize. But sometimes it does not work as tree
cost for this fixed vectorization factor is too high.
Patch tries to improve the situation. It tries different vectorization
factors from max(PowerOf2Floor(NumberOfVectorizedValues),
MinVecRegSize/ScalarTypeSize) to MinVecRegSize/ScalarTypeSize and tries
to choose the best one.

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

llvm-svn: 288497

7 years ago[X86] Refactored getTargetConstantBitsFromNode to allow for expansion. NFCI.
Simon Pilgrim [Fri, 2 Dec 2016 11:58:05 +0000 (11:58 +0000)]
[X86] Refactored getTargetConstantBitsFromNode to allow for expansion. NFCI.

getTargetConstantBitsFromNode currently only extracts constant pool vector data, but it will need to be generalized to support broadcast and scalar constant pool data as well.

Converted Constant bit extraction and Bitset splitting to helper lambda functions.

llvm-svn: 288496

7 years agoFix a buildbot failure in include-fixer.
Eric Liu [Fri, 2 Dec 2016 11:23:07 +0000 (11:23 +0000)]
Fix a buildbot failure in include-fixer.

llvm-svn: 288495

7 years agoReplace __ANDROID_NDK__ with __ANDROID__
Pavel Labath [Fri, 2 Dec 2016 11:15:15 +0000 (11:15 +0000)]
Replace __ANDROID_NDK__ with __ANDROID__

Summary:
This replaces all the uses of the __ANDROID_NDK__ define with __ANDROID__. This
is a preparatory step to remove our custom android toolchain file and rely on
the standard android NDK one instead, which does not provide this define.
Instead I rely, on __ANDROID__, which is set by the compiler.

I haven't yet removed the cmake variable with the same name, as we will need to
do something completely different there -- NDK toolchain defines
CMAKE_SYSTEM_NAME to Android, while our current one pretends it's linux.

Reviewers: tberghammer, zturner

Subscribers: danalbert, srhines, mgorny, lldb-commits

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

llvm-svn: 288494

7 years ago[ClangFormat] Only insert #include into the #include block in the beginning of the...
Eric Liu [Fri, 2 Dec 2016 11:01:43 +0000 (11:01 +0000)]
[ClangFormat] Only insert #include into the #include block in the beginning of the file.

Summary:
This avoid inserting #include into:
- raw string literals containing #include.
- #if block.
- Special #include among declarations (e.g. functions).

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 288493

7 years ago[SLPVectorizer][X86] Add tests for vectorization of buildvector of scalar fp-ops...
Simon Pilgrim [Fri, 2 Dec 2016 10:54:46 +0000 (10:54 +0000)]
[SLPVectorizer][X86] Add tests for vectorization of buildvector of scalar fp-ops (PR6246)

llvm-svn: 288492

7 years ago[Frontend] Fix an issue where a quoted search path is incorrectly
Alex Lorenz [Fri, 2 Dec 2016 09:51:51 +0000 (09:51 +0000)]
[Frontend] Fix an issue where a quoted search path is incorrectly
removed as a duplicate header search path

The commit r126167 started passing the First index into RemoveDuplicates, but
forgot to update 0 to First in the loop that looks for the duplicate. This
resulted in a bug where an -iquoted search path was incorrectly removed if you
passed in the same path into -iquote and more than one time into -isystem.

rdar://23991350

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

llvm-svn: 288491

7 years agocompiler-rt/test/profile/Linux/lit.local.cfg: [Py3] Use text mode (universal_newlines...
NAKAMURA Takumi [Fri, 2 Dec 2016 08:17:17 +0000 (08:17 +0000)]
compiler-rt/test/profile/Linux/lit.local.cfg: [Py3] Use text mode (universal_newlines=True).

llvm-svn: 288490

7 years ago[ScopInfo] Fold constant coefficients in array dimensions to the right
Tobias Grosser [Fri, 2 Dec 2016 08:10:56 +0000 (08:10 +0000)]
[ScopInfo] Fold constant coefficients in array dimensions to the right

This allows us to delinearize code such as the one below, where the array
sizes are A[][2 * n] as there are n times two elements in the innermost
dimension. Alternatively, we could try to generate another dimension for the
struct in the innermost dimension, but as the struct has constant size,
recovering this dimension is easy.

   struct com {
     double Real;
     double Img;
   };

   void foo(long n, struct com A[][n]) {
     for (long i = 0; i < 100; i++)
       for (long j = 0; j < 1000; j++)
         A[i][j].Real += A[i][j].Img;
   }

   int main() {
     struct com A[100][1000];
     foo(1000, A);

llvm-svn: 288489

7 years ago[sanitizer] Add a bunch of ifdefs for sparc targets to avoid build failures.
Maxim Ostapenko [Fri, 2 Dec 2016 08:07:35 +0000 (08:07 +0000)]
[sanitizer] Add a bunch of ifdefs for sparc targets to avoid build failures.

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

llvm-svn: 288488

7 years agoPort parallel ICF to COFF.
Rui Ueyama [Fri, 2 Dec 2016 08:03:58 +0000 (08:03 +0000)]
Port parallel ICF to COFF.

LLD used to take 11.73 seconds to link Clang. Now it is 6.94 seconds.
MSVC link takes 83.02 seconds. Note that ICF is enabled by default on
Windows, so a low latency ICF is more important than in ELF.

llvm-svn: 288487

7 years agoDon't include system header inside namespace
Stephan Bergmann [Fri, 2 Dec 2016 08:03:57 +0000 (08:03 +0000)]
Don't include system header inside namespace

...causes build failure at least with GCC 6.2.1, as smmintrin.h indirectly
includes cstdlib, which then runs into problems.

llvm-svn: 288486

7 years agoIgnore R_X86_64_NONE.
Rafael Espindola [Fri, 2 Dec 2016 08:00:09 +0000 (08:00 +0000)]
Ignore R_X86_64_NONE.

It looks like the way dtrace works is

* The user creates .o files that reference magical symbol names.
* dtrace reads those files, collecs the info it needs and changes the
  relocation to R_X86_64_NONE expecting the linker to ignore them.

llvm-svn: 288485

7 years ago[AVX-512] Add EVEX vpshuflw/vpshufhw/vpshufd instructions to load folding tables.
Craig Topper [Fri, 2 Dec 2016 07:57:11 +0000 (07:57 +0000)]
[AVX-512] Add EVEX vpshuflw/vpshufhw/vpshufd instructions to load folding tables.

llvm-svn: 288484

7 years agoFix a bug in ICF involving COFF associative sections.
Rui Ueyama [Fri, 2 Dec 2016 07:46:12 +0000 (07:46 +0000)]
Fix a bug in ICF involving COFF associative sections.

Associative sections are sections that need to be linked if their associated
sections are linked. Associative sections are used to append auxiliary data
such as debug info.

Previously, we compared all associative sections when comparing two comdat
sections. Because usually assocative sections are not mergeable sections,
we missed a lot of mergeable sections. MSVC linker doesn't seem to check
the identity of associative sections.

This patch makes LLD to ignore associative sections when doing ICF.

llvm-svn: 288483

7 years ago[AVX-512] Add EVEX PSHUFB instructions to load folding tables.
Craig Topper [Fri, 2 Dec 2016 07:06:30 +0000 (07:06 +0000)]
[AVX-512] Add EVEX PSHUFB instructions to load folding tables.

llvm-svn: 288482

7 years ago[AVX-512] Add masked VINSERTF/VINSERTI instructions to load folding tables.
Craig Topper [Fri, 2 Dec 2016 06:24:38 +0000 (06:24 +0000)]
[AVX-512] Add masked VINSERTF/VINSERTI instructions to load folding tables.

llvm-svn: 288481

7 years agoFix the worse case performance of ICF.
Rui Ueyama [Fri, 2 Dec 2016 05:35:46 +0000 (05:35 +0000)]
Fix the worse case performance of ICF.

r288228 seems to have regressed ICF performance in some cases in which
a lot of sections are actually mergeable. In r288228, I made a change
to create a Range object for each new color group. So every time we
split a group, we allocated and added a new group to a list of groups.

This patch essentially reverted r288228 with an improvement to
parallelize the original algorithm.

Now the ICF main loop is entirely allocation-free and lock-free.

Just like pre-r288228, we search for group boundaries by linear scan
instead of managing the information using Range class. r288228 was
neutral in performance-wise, and so is this patch.

I confirmed that this produces the exact same result as before
using chromium and clang as tests.

llvm-svn: 288480

7 years ago[ScopInfo] Separate construction and finalization of memory accesses [NFC]
Tobias Grosser [Fri, 2 Dec 2016 05:21:22 +0000 (05:21 +0000)]
[ScopInfo] Separate construction and finalization of memory accesses [NFC]

After having built memory accesses we perform some additional transformations
on them to increase the chances that our delinearization guesses the right
shape. Only after these transformations, we take the assumptions that the
array shape we predict is such that no out-of-bounds memory accesses arise.

Before this change, the construction of the memory access, the access folding
that improves the represenation for certain parametric subscripts, and taking
the assumption was all done right after a memory access was created. In this
change we split this now into three separate iterations over all memory
accesses. This means only after all memory accesses have been built, we start
to canonicalize accesses, and to take assumptions. This split prepares for
future canonicalizations that must consider all memory accesses for deriving
additional beneficial transformations.

llvm-svn: 288479

7 years agoclang/test/Driver/defsym.s: Appease targeting msc. It is incapable of external assemb...
NAKAMURA Takumi [Fri, 2 Dec 2016 05:09:21 +0000 (05:09 +0000)]
clang/test/Driver/defsym.s: Appease targeting msc. It is incapable of external assembler in trunk.

llvm-svn: 288478