platform/upstream/llvm.git
6 years agoUse std::thread directly.
Rafael Espindola [Tue, 7 Nov 2017 23:09:54 +0000 (23:09 +0000)]
Use std::thread directly.

Now that this code is posix only we don't need to use runBackground.

llvm-svn: 317632

6 years agoSimplify unlinkAsync.
Rafael Espindola [Tue, 7 Nov 2017 23:01:37 +0000 (23:01 +0000)]
Simplify unlinkAsync.

It used to rename the file before removing it in a background thread.

A simpler way to delay the removal is simply to open the file.

Since this is a posix specific issue, simplify the windows
implementation.

llvm-svn: 317631

6 years agoRevert "Allow yaml2obj to order implicit sections for ELF"
Dave Lee [Tue, 7 Nov 2017 22:51:27 +0000 (22:51 +0000)]
Revert "Allow yaml2obj to order implicit sections for ELF"

Also, revert "Fix build bots after r317622"

This reverts commit r317622, r317626.

llvm-svn: 317630

6 years agoRevert r317609, test fails on one bot
Paul Robinson [Tue, 7 Nov 2017 22:39:12 +0000 (22:39 +0000)]
Revert r317609, test fails on one bot

llvm-svn: 317628

6 years agoChange noplt.c to work for non-x86 targets.
Sriraman Tallam [Tue, 7 Nov 2017 22:34:55 +0000 (22:34 +0000)]
Change noplt.c to work for non-x86 targets.

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

llvm-svn: 317627

6 years agoFix build bots after r317622
Dave Lee [Tue, 7 Nov 2017 22:33:07 +0000 (22:33 +0000)]
Fix build bots after r317622

Example build failure: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/14660

TIL that the warning flags for local builds are loose compared to what build
servers use.

llvm-svn: 317626

6 years agoDelete unused constructor.
Rafael Espindola [Tue, 7 Nov 2017 22:30:53 +0000 (22:30 +0000)]
Delete unused constructor.

llvm-svn: 317625

6 years agoUpdate tuple/list/deque data formatters to work with newest libc++
Pavel Labath [Tue, 7 Nov 2017 22:17:29 +0000 (22:17 +0000)]
Update tuple/list/deque data formatters to work with newest libc++

Summary:
A couple of members of these data structures have been renamed in recent
months. This makes sure they still work with the latest libc++ version.

Reviewers: jingham, EricWF

Subscribers: lldb-commits

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

llvm-svn: 317624

6 years ago[NVPTX] Implement __nvvm_atom_add_gen_d builtin.
Justin Lebar [Tue, 7 Nov 2017 22:10:54 +0000 (22:10 +0000)]
[NVPTX] Implement __nvvm_atom_add_gen_d builtin.

Summary:
This just seems to have been an oversight.  We already supported the f64
atomic add with an explicit scope (e.g. "cta"), but not the scopeless
version.

Reviewers: tra

Subscribers: jholewinski, sanjoy, cfe-commits, llvm-commits, hiraditya

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

llvm-svn: 317623

6 years agoAllow yaml2obj to order implicit sections for ELF
Dave Lee [Tue, 7 Nov 2017 22:05:24 +0000 (22:05 +0000)]
Allow yaml2obj to order implicit sections for ELF

Summary:
This change allows yaml input to control the order of implicitly added sections
(`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a
placeholder section of the given name to the Sections field.

This change is to support changes in D39582, where it is desirable to control
the location of the `.dynsym` section.

Reviewers: compnerd, jakehehrlich

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 317622

6 years ago[ObjC++] Don't warn about pessimizing move for __block variables
Alex Lorenz [Tue, 7 Nov 2017 21:40:11 +0000 (21:40 +0000)]
[ObjC++] Don't warn about pessimizing move for __block variables

rdar://33316951

llvm-svn: 317620

6 years ago[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer...
Dinar Temirbulatov [Tue, 7 Nov 2017 21:25:34 +0000 (21:25 +0000)]
[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer binary ops.

    Patch tries to improve vectorization of the following code:

    void add1(int * __restrict dst, const int * __restrict src) {
      *dst++ = *src++;
      *dst++ = *src++ + 1;
      *dst++ = *src++ + 2;
      *dst++ = *src++ + 3;
    }
    Allows to vectorize even if the very first operation is not a binary add, but just a load.

    Fixed PR34619 and other issues related to previous commit.

    Reviewers: spatel, mzolotukhin, mkuper, hfinkel, RKSimon, filcab, ABataev

    Reviewed By: ABataev, RKSimon

    Subscribers: llvm-commits, RKSimon

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

llvm-svn: 317618

6 years agoExtend SpecialCaseList to allow users to blame matches on entries in the file.
Mitch Phillips [Tue, 7 Nov 2017 21:16:46 +0000 (21:16 +0000)]
Extend SpecialCaseList to allow users to blame matches on entries in the file.

Summary:
Extends SCL functionality to allow users to find the line number in the file the SCL is built from through SpecialCaseList::inSectionBlame(...).

Also removes the need to compile the SCL before use. As the matcher now contains a list of regexes to test against instead of a single regex, the regexes can be individually built on each insertion rather than one large compilation at the end of construction.

This change also fixes a bug where blank lines would cause the parser to become out-of-sync with the line number. An error on line `k` was being reported as being on line `k - num_blank_lines_before_k`.

Note: This change has a cyclical dependency on D39486. Both these changes must be submitted at the same time to avoid a build breakage.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: kcc, pcc, llvm-commits

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

llvm-svn: 317617

6 years agoUpdate SanitizerSpecialCaseList to use renamed functions in base class.
Mitch Phillips [Tue, 7 Nov 2017 21:16:37 +0000 (21:16 +0000)]
Update SanitizerSpecialCaseList to use renamed functions in base class.

Note: This change has a cyclical dependency on D39485. Both these changes must be submitted at the same time to avoid a build breakage.

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits

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

llvm-svn: 317616

6 years ago[CodeGenPrepare] Fix typo in comment. NFC
Craig Topper [Tue, 7 Nov 2017 20:56:17 +0000 (20:56 +0000)]
[CodeGenPrepare] Fix typo in comment. NFC

llvm-svn: 317614

6 years agoUse new vector insert half-word and byte instructions when we see insertelement on...
Graham Yiu [Tue, 7 Nov 2017 20:55:43 +0000 (20:55 +0000)]
Use new vector insert half-word and byte instructions when we see insertelement on '8 x i16' and '16 x i8' types.  Also extended existing lit testcase to cover these cases.

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

llvm-svn: 317613

6 years agoConvert a dwarfdump test from checked-in binary to assembler source.
Paul Robinson [Tue, 7 Nov 2017 20:35:44 +0000 (20:35 +0000)]
Convert a dwarfdump test from checked-in binary to assembler source.

llvm-svn: 317612

6 years agoTeach test suite about C++2a dialect flag.
Eric Fiselier [Tue, 7 Nov 2017 20:26:23 +0000 (20:26 +0000)]
Teach test suite about C++2a dialect flag.

This patch teaches the test suite configuration about the -std=c++2a
flag. And, since it's the newest dialect, change the test suite to
choose it, if possible, by default.

llvm-svn: 317611

6 years agoChange test suite to support c++17 dialect flag instead of c++1z.
Eric Fiselier [Tue, 7 Nov 2017 20:20:58 +0000 (20:20 +0000)]
Change test suite to support c++17 dialect flag instead of c++1z.

This patch changes the test suite to attempt and prefer -std=c++17 over
-std=c++1z. It also fixes the REQUIRES and UNSUPPORTED lit markers
to refer to c++17 over c++1z.

llvm-svn: 317610

6 years ago[DWARFv5] Add new test for previous commit.
Paul Robinson [Tue, 7 Nov 2017 20:12:58 +0000 (20:12 +0000)]
[DWARFv5] Add new test for previous commit.

llvm-svn: 317609

6 years ago[sanitizer] Fix sanitizer_common compile errors on gcc trunk
Vitaly Buka [Tue, 7 Nov 2017 20:10:17 +0000 (20:10 +0000)]
[sanitizer] Fix sanitizer_common compile errors on gcc trunk

Summary:
When testing a merge of compiler-rt r304709 into gcc trunk on x86-64-pc-linux-gnu,
I ran into two compile errors:
sanitizer_common/sanitizer_symbolizer_libbacktrace.cc:96:73: error: no matching function for call to '__sanitizer::AddressInfo::FillModuleInfo(char*&, __sanitizer::uptr&)'

All other files in sanitizer_common (with the exception of sanitizer_malloc_mac.inc
which is special) include sanitizer_platform.h without directory name.

Patch by Mike Jongen

Reviewers: kcc, vitalybuka

Reviewed By: kcc

Subscribers: kubamracek, fedor.sergeev, llvm-commits

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

llvm-svn: 317608

6 years ago[DWARFv5] Support DW_FORM_strp in the .debug_line header.
Paul Robinson [Tue, 7 Nov 2017 19:57:12 +0000 (19:57 +0000)]
[DWARFv5] Support DW_FORM_strp in the .debug_line header.

Supporting this form in .debug_line.dwo will be done as a follow-up.

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

llvm-svn: 317607

6 years agoNew clang option -fno-plt which avoids the PLT and lazy binding while making external...
Sriraman Tallam [Tue, 7 Nov 2017 19:37:51 +0000 (19:37 +0000)]
New clang option -fno-plt which avoids the PLT and lazy binding while making external calls.

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

llvm-svn: 317605

6 years ago[scudo] Make getNumberOfCPUs Fuchsia compliant
Kostya Kortchinsky [Tue, 7 Nov 2017 19:30:08 +0000 (19:30 +0000)]
[scudo] Make getNumberOfCPUs Fuchsia compliant

Summary: This change allows Fuchsia to boot properly using the Scudo allocator.

Reviewers: cryptoad, alekseyshl, krytarowski

Reviewed By: cryptoad, krytarowski

Subscribers: krytarowski, kubamracek, llvm-commits

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

llvm-svn: 317604

6 years ago[WebAssembly] Include GENERIC_TF_SOURCES in wasm builds
Sam Clegg [Tue, 7 Nov 2017 19:03:11 +0000 (19:03 +0000)]
[WebAssembly] Include GENERIC_TF_SOURCES in wasm builds

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

llvm-svn: 317601

6 years agoRecommit r317510 "[InstCombine] Pull shifts through a select plus binop with constant"
Craig Topper [Tue, 7 Nov 2017 18:47:24 +0000 (18:47 +0000)]
Recommit r317510 "[InstCombine] Pull shifts through a select plus binop with constant"

The hexagon test should be fixed now.

Original commit message:

This pulls shifts through a select+binop with a constant where the select conditionally executes the binop. We already do this for just the binop, but not with the select.

This can allow us to get the select closer to other selects to enable removing one.

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

llvm-svn: 317600

6 years ago[refactor] rename field references in __builtin_offsetof
Alex Lorenz [Tue, 7 Nov 2017 18:30:23 +0000 (18:30 +0000)]
[refactor] rename field references in __builtin_offsetof

rdar://33875453

llvm-svn: 317599

6 years agoClang/libomptarget map interface flag renaming - NFC patch
George Rokos [Tue, 7 Nov 2017 18:27:04 +0000 (18:27 +0000)]
Clang/libomptarget map interface flag renaming - NFC patch

This patch renames some of the flag names of the clang/libomptarget map interface. The old names are slightly misleading, whereas the new ones describe in a better way what each flag is about.

Only the macros within the enumeration are renamed, there is no change in functionality therefore there are no updated regression tests.

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

llvm-svn: 317598

6 years ago[index] __builtin_offset's field reference is located at the end location
Alex Lorenz [Tue, 7 Nov 2017 18:25:36 +0000 (18:25 +0000)]
[index] __builtin_offset's field reference is located at the end location

The starting location is the location of the '.'

llvm-svn: 317596

6 years ago[InstCombine] Update stale comment. NFC
Craig Topper [Tue, 7 Nov 2017 17:37:32 +0000 (17:37 +0000)]
[InstCombine] Update stale comment. NFC

Datalayout is no longer optional so the comment didn't match what the code currently does.

llvm-svn: 317594

6 years ago[index] index field references in __builtin_offset
Alex Lorenz [Tue, 7 Nov 2017 17:29:11 +0000 (17:29 +0000)]
[index] index field references in __builtin_offset

rdar://35109556

llvm-svn: 317593

6 years ago[Hexagon] Make a test more flexible in HexagonLoopIdiomRecognition
Krzysztof Parzyszek [Tue, 7 Nov 2017 17:05:54 +0000 (17:05 +0000)]
[Hexagon] Make a test more flexible in HexagonLoopIdiomRecognition

An "or" that sets the sign-bit can be replaced with a "xor", if
the sign-bit was known to be clear before. With some changes to
instruction combining, the simple sign-bit check was failing.
Replace it with a more flexible one to catch more cases.

llvm-svn: 317592

6 years ago[AArch64][SVE] Asm: Add support for (ADD|SUB)_ZZZ
Florian Hahn [Tue, 7 Nov 2017 16:58:13 +0000 (16:58 +0000)]
[AArch64][SVE] Asm: Add support for (ADD|SUB)_ZZZ

Patch [5/5] in a series to add assembler/disassembler support for AArch64 SVE unpredicated ADD/SUB instructions.

Patch by Sander De Smalen.

Reviewed by: rengolin

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

llvm-svn: 317591

6 years ago[AArch64][SVE] Asm: Add SVE (Z) Register definitions and parsing support
Florian Hahn [Tue, 7 Nov 2017 16:45:48 +0000 (16:45 +0000)]
[AArch64][SVE] Asm: Add SVE (Z) Register definitions and parsing support

Patch [3/5] in a series to add assembler/disassembler support for AArch64 SVE unpredicated ADD/SUB instructions.

To summarise, this patch adds:

 * SVE register definitions
 * Methods to parse SVE register operands
 * Methods to print SVE register operands
 * RegKind SVEDataVector to distinguish it from other data types like scalar register or Neon vector.
 * k_SVEDataRegister and SVEDataRegOp to describe SVE registers (which will be extended by further patches with e.g. ElementWidth and the shift-extend type).

Patch by Sander De Smalen.

Reviewed by: rengolin

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

llvm-svn: 317590

6 years agoSystemZ Swift TargetInfo: swifterror support in the backend is broken
Arnold Schwaighofer [Tue, 7 Nov 2017 16:40:51 +0000 (16:40 +0000)]
SystemZ Swift TargetInfo: swifterror support in the backend is broken

Return false for swifterror support until the backend is fixed.

llvm-svn: 317589

6 years ago[SelectionDAG] Fix typo in comment. NFC
Craig Topper [Tue, 7 Nov 2017 16:32:31 +0000 (16:32 +0000)]
[SelectionDAG] Fix typo in comment. NFC

llvm-svn: 317588

6 years agotsan: allow usage of global vars with ctors in interceptors
Dmitry Vyukov [Tue, 7 Nov 2017 16:31:08 +0000 (16:31 +0000)]
tsan: allow usage of global vars with ctors in interceptors

We allow usage of global/per-thread data with non-trivial ctors/dtors
throughout tsan code base by placing all global/per-thread data into
Context/ThreadState and then explicitly constructing them with
placement new. This greatly simplifies code by restricting the
"linker initialized plague" to only these 2 objects.

Do the same for interceptors data.

This allows to use Vector instead of bunch of hand-written code in:
https://reviews.llvm.org/D39619

Reviewed in: https://reviews.llvm.org/D39721

llvm-svn: 317587

6 years agoUpdate sanitizer_allocator to use new API.
Kostya Kortchinsky [Tue, 7 Nov 2017 16:19:24 +0000 (16:19 +0000)]
Update sanitizer_allocator to use new API.

Summary:
Update sanitizer_allocator to use new API.

Second patch in a series.  First patch https://reviews.llvm.org/D39072

Updates MmapNoAccess / MmapFixed call sites in the saniziter_allocator
to use the new Init/Map APIs instead.

Reviewers: alekseyshl, cryptoad, phosek, mcgrathr, dvyukov

Reviewed By: alekseyshl, cryptoad

Subscribers: dvyukov, mcgrathr, kubamracek

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

llvm-svn: 317586

6 years ago[clangd] Fix opening declarations located in non-preamble inclusion
Marc-Andre Laperle [Tue, 7 Nov 2017 16:16:45 +0000 (16:16 +0000)]
[clangd] Fix opening declarations located in non-preamble inclusion

Summary:
When an inclusion is not processed as part of the preamble, its path is
not made into an absolute path as part of the precompiled header code
(adjustFilenameForRelocatableAST in ASTWriter.cpp). Because of this,
when we convert a Decl location to retrieve the file name with
FileEntry->getName(), it is possible for this path to be relative.
Instead, we should try to use tryGetRealPathName first which returns
an absolute path.

Fixes bug 35217.

Reviewers: sammccall, ilya-biryukov, rwols, Nebiroth

Reviewed By: sammccall

Subscribers: cfe-commits, ilya-biryukov

Tags: #clang-tools-extra

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

llvm-svn: 317585

6 years ago[clangd] Fix initialize capabilities response
Sam McCall [Tue, 7 Nov 2017 15:49:35 +0000 (15:49 +0000)]
[clangd] Fix initialize capabilities response

llvm-svn: 317584

6 years ago[CodeGen] split math and complex tests into separate files; NFCI
Sanjay Patel [Tue, 7 Nov 2017 15:13:22 +0000 (15:13 +0000)]
[CodeGen] split math and complex tests into separate files; NFCI

The files are already large, and we may need to add even more RUNs to
distinguish differences based on OS, environment, or other platform things.

llvm-svn: 317583

6 years ago[AArch64][SVE] Asm: Set SVE as unsupported feature for existing scheduler models.
Florian Hahn [Tue, 7 Nov 2017 15:03:11 +0000 (15:03 +0000)]
[AArch64][SVE] Asm: Set SVE as unsupported feature for existing scheduler models.

Patch [4/5] in a series to add assembler/disassembler support for AArch64 SVE unpredicated ADD/SUB instructions.

We add SVE as unsupported feature for CPUs that don't have SVE to prevent errors from scheduler models saying it lacks information for these instructions.

Patch by Sander De Smalen.

Reviewed by: rengolin

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

llvm-svn: 317582

6 years ago[clangd] MSVC - third time's the charm
Sam McCall [Tue, 7 Nov 2017 14:59:21 +0000 (14:59 +0000)]
[clangd] MSVC - third time's the charm

llvm-svn: 317581

6 years ago[clangd] don't crash on invalid JSON-RPC ID
Sam McCall [Tue, 7 Nov 2017 14:45:31 +0000 (14:45 +0000)]
[clangd] don't crash on invalid JSON-RPC ID

llvm-svn: 317580

6 years agoReland "Correct dwarf unwind information in function epilogue for X86"
Petar Jovanovic [Tue, 7 Nov 2017 14:40:27 +0000 (14:40 +0000)]
Reland "Correct dwarf unwind information in function epilogue for X86"

Reland r317100 with minor fix regarding ComputeCommonTailLength function in
BranchFolding.cpp. Skipping top CFI instructions block needs to executed on
several more return points in ComputeCommonTailLength().

Original r317100 message:

"Correct dwarf unwind information in function epilogue for X86"

This patch aims to provide correct dwarf unwind information in function
epilogue for X86.

It consists of two parts. The first part inserts CFI instructions that set
appropriate cfa offset and cfa register in emitEpilogue() in
X86FrameLowering. This part is X86 specific.

The second part is platform independent and ensures that:

- CFI instructions do not affect code generation
- Unwind information remains correct when a function is modified by
  different passes. This is done in a late pass by analyzing information
  about cfa offset and cfa register in BBs and inserting additional CFI
  directives where necessary.

Changed CFI instructions so that they:

- are duplicable
- are not counted as instructions when tail duplicating or tail merging
- can be compared as equal

Added CFIInstrInserter pass:

- analyzes each basic block to determine cfa offset and register valid at
  its entry and exit
- verifies that outgoing cfa offset and register of predecessor blocks match
  incoming values of their successors
- inserts additional CFI directives at basic block beginning to correct the
  rule for calculating CFA

Having CFI instructions in function epilogue can cause incorrect CFA
calculation rule for some basic blocks. This can happen if, due to basic
block reordering, or the existence of multiple epilogue blocks, some of the
blocks have wrong cfa offset and register values set by the epilogue block
above them.

CFIInstrInserter is currently run only on X86, but can be used by any target
that implements support for adding CFI instructions in epilogue.

Patch by Violeta Vukobrat.

llvm-svn: 317579

6 years agoSilence MSVC error C2398
Kristof Beyls [Tue, 7 Nov 2017 14:37:01 +0000 (14:37 +0000)]
Silence MSVC error C2398

Reported by http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/6000/steps/build-unified-tree/logs/stdio
The error messages were all similar to:
llvm\unittests\CodeGen\GlobalISel\LegalizerInfoTest.cpp(54): error C2398: Element '1': conversion from '' to 'unsigned int' requires a narrowing conversion

llvm-svn: 317578

6 years ago[clang-refactor] Use ClangTool more explicitly by making refaroing actions AST fronte...
Eric Liu [Tue, 7 Nov 2017 14:35:03 +0000 (14:35 +0000)]
[clang-refactor] Use ClangTool more explicitly by making refaroing actions AST frontend actions.

Summary: This is a refactoring change. NFC

Reviewers: arphaman, hokein

Reviewed By: arphaman, hokein

Subscribers: cfe-commits

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

llvm-svn: 317577

6 years ago[SLP] Fix PR35047: Fix default cost model for cast op in X86.
Alexey Bataev [Tue, 7 Nov 2017 14:23:44 +0000 (14:23 +0000)]
[SLP] Fix PR35047: Fix default cost model for cast op in X86.

Summary:
The cost calculation for default case on X86 target does not always
follow correct wayt because of missing 4-th argument in
`BaseT::getCastInstrCost()` call. Added this missing parameter.

Reviewers: hfinkel, mkuper, RKSimon, spatel

Subscribers: llvm-commits

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

llvm-svn: 317576

6 years ago[clangd] another try at fixing MSVC
Sam McCall [Tue, 7 Nov 2017 14:14:58 +0000 (14:14 +0000)]
[clangd] another try at fixing MSVC

llvm-svn: 317575

6 years agoFix an issue in r317563 causing a clang assert
Tamas Berghammer [Tue, 7 Nov 2017 13:43:55 +0000 (13:43 +0000)]
Fix an issue in r317563 causing a clang assert

llvm-svn: 317574

6 years agoMark intentional fall-through with LLVM_FALLTHROUGH.
Kristof Beyls [Tue, 7 Nov 2017 13:31:52 +0000 (13:31 +0000)]
Mark intentional fall-through with LLVM_FALLTHROUGH.

... to silence gcc 7's default -Wimplicit-fallthrough.

llvm-svn: 317573

6 years agoAdd a -D flag to FileCheck to define variables
Alexander Richardson [Tue, 7 Nov 2017 13:24:44 +0000 (13:24 +0000)]
Add a -D flag to FileCheck to define variables

Summary:
This makes it very easy to test files that only differ in a constant
value somewhere in the test case.

Reviewers: jlebar, hfinkel, chandlerc, probinson

Reviewed By: probinson

Subscribers: probinson, llvm-commits

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

llvm-svn: 317572

6 years ago[X86] Regenerate select tests
Simon Pilgrim [Tue, 7 Nov 2017 13:21:02 +0000 (13:21 +0000)]
[X86] Regenerate select tests

llvm-svn: 317571

6 years ago[clang-tidy] Misc redundant expressions checker updated for macros
Gabor Horvath [Tue, 7 Nov 2017 13:17:58 +0000 (13:17 +0000)]
[clang-tidy] Misc redundant expressions checker updated for macros

Redundant Expression Checker is updated to be able to detect expressions that
contain macros. Also, other small details are modified to improve the current
implementation.

The improvements in detail are as follows:
* Binary and ternary operator expressions containing two constants, with at
least one of them from a macro, are detected and tested for redundancy.

Macro expressions are treated somewhat differently from other expressions,
because the particular values of macros can vary across builds.
They can be considered correct and intentional, even if macro values equal,
produce ranges that exclude each other or fully overlap, etc.

* The code structure is slightly modified: typos are corrected,
comments are added and some functions are renamed to improve comprehensibility,
both in the checker and the test file. A few test cases are moved to another
function.

* The checker is now able to detect redundant CXXFunctionalCastExprs as well.
A corresponding test case is added.

Patch by: Lilla Barancsuk!

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

llvm-svn: 317570

6 years ago[AArch64][SVE] Asm: Replace 'IsVector' by 'RegKind' in AArch64AsmParser (NFC)
Florian Hahn [Tue, 7 Nov 2017 13:07:50 +0000 (13:07 +0000)]
[AArch64][SVE] Asm: Replace 'IsVector' by 'RegKind' in AArch64AsmParser (NFC)

Patch [2/5] in a series to add assembler/disassembler support for AArch64 SVE unpredicated ADD/SUB instructions.

This change is a non functional change that adds RegKind as an alternative to 'isVector' to prepare it for newer types (SVE data vectors and predicate vectors) that will be added in next patches (where the SVE data vector is added as part of this patch set)

Patch by Sander De Smalen.

Reviewed by: rengolin

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

llvm-svn: 317569

6 years agoSilence C4715 warning from MSVC (NFC).
Kristof Beyls [Tue, 7 Nov 2017 11:54:00 +0000 (11:54 +0000)]
Silence C4715 warning from MSVC (NFC).

The warning started triggering after r317560.
This commit silences it in the same way as previously done in a similar
situation, see
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140915/236088.html

llvm-svn: 317568

6 years ago[analyzer] pr34779: CStringChecker: Accept non-standard headers.
Artem Dergachev [Tue, 7 Nov 2017 10:51:15 +0000 (10:51 +0000)]
[analyzer] pr34779: CStringChecker: Accept non-standard headers.

Do not crash when trying to define and call a non-standard
strcpy(unsigned char *, unsigned char *) during analysis.

At the same time, do not try to actually evaluate the call.

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

llvm-svn: 317565

6 years ago[AArch64][SVE] Asm: Extend EnforceVectorSubVectorTypeIs to distinguish Scalable Vectors
Florian Hahn [Tue, 7 Nov 2017 10:43:56 +0000 (10:43 +0000)]
[AArch64][SVE] Asm: Extend EnforceVectorSubVectorTypeIs to distinguish Scalable Vectors

Patch [1/5] in a series to add assembler/disassembler support for AArch64 SVE
unpredicated ADD/SUB instructions.

Patch by Sander De Smalen.

Reviewed by: rengolin

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

llvm-svn: 317564

6 years agoSupport scoped enums in the DWARF AST parser
Tamas Berghammer [Tue, 7 Nov 2017 10:39:22 +0000 (10:39 +0000)]
Support scoped enums in the DWARF AST parser

Subscribers: JDevlieghere

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

llvm-svn: 317563

6 years agotest: Clean up finalize_build_dictionary
Pavel Labath [Tue, 7 Nov 2017 10:36:42 +0000 (10:36 +0000)]
test: Clean up finalize_build_dictionary

We only support API>=16 now, so we don't need to check the API level of
the android device.

llvm-svn: 317562

6 years ago"Fix" concurrent events test for arm
Pavel Labath [Tue, 7 Nov 2017 10:36:36 +0000 (10:36 +0000)]
"Fix" concurrent events test for arm

Summary:
The test incremented an atomic varible to trigger the watchpoint event.
On arm64 this compiled to a ldaxr/stlxr loop, with the watchpoint being
triggered in the middle of the loop. Hitting the watchpoint resets the
exclusive monitor, and forces the process to loop one more time, hitting
the watchpoint again, etc.

While it would be nice if the debugger was able to resume from this
situation, this is not trivial, and is not what this test is about.
Therefore, I propose to change this to a simple store to a normal
variable (which should still trip the watchpoint everywhere, but without
atomic loops) and file a bug to investigate the possibilities of
handling the watchpoints in atomic loops in a more reasonable way.

Reviewers: clayborg

Subscribers: aemerson, kristof.beyls, lldb-commits

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

llvm-svn: 317561

6 years ago[GlobalISel] Enable legalizing non-power-of-2 sized types.
Kristof Beyls [Tue, 7 Nov 2017 10:34:34 +0000 (10:34 +0000)]
[GlobalISel] Enable legalizing non-power-of-2 sized types.

This changes the interface of how targets describe how to legalize, see
the below description.

1. Interface for targets to describe how to legalize.

In GlobalISel, the API in the LegalizerInfo class is the main interface
for targets to specify which types are legal for which operations, and
what to do to turn illegal type/operation combinations into legal ones.

For each operation the type sizes that can be legalized without having
to change the size of the type are specified with a call to setAction.
This isn't different to how GlobalISel worked before. For example, for a
target that supports 32 and 64 bit adds natively:

  for (auto Ty : {s32, s64})
    setAction({G_ADD, 0, s32}, Legal);

or for a target that needs a library call for a 32 bit division:

  setAction({G_SDIV, s32}, Libcall);

The main conceptual change to the LegalizerInfo API, is in specifying
how to legalize the type sizes for which a change of size is needed. For
example, in the above example, how to specify how all types from i1 to
i8388607 (apart from s32 and s64 which are legal) need to be legalized
and expressed in terms of operations on the available legal sizes
(again, i32 and i64 in this case). Before, the implementation only
allowed specifying power-of-2-sized types (e.g. setAction({G_ADD, 0,
s128}, NarrowScalar).  A worse limitation was that if you'd wanted to
specify how to legalize all the sized types as allowed by the LLVM-IR
LangRef, i1 to i8388607, you'd have to call setAction 8388607-3 times
and probably would need a lot of memory to store all of these
specifications.

Instead, the legalization actions that need to change the size of the
type are specified now using a "SizeChangeStrategy".  For example:

   setLegalizeScalarToDifferentSizeStrategy(
       G_ADD, 0, widenToLargerAndNarrowToLargest);

This example indicates that for type sizes for which there is a larger
size that can be legalized towards, do it by Widening the size.
For example, G_ADD on s17 will be legalized by first doing WidenScalar
to make it s32, after which it's legal.
The "NarrowToLargest" indicates what to do if there is no larger size
that can be legalized towards. E.g. G_ADD on s92 will be legalized by
doing NarrowScalar to s64.

Another example, taken from the ARM backend is:
   for (unsigned Op : {G_SDIV, G_UDIV}) {
     setLegalizeScalarToDifferentSizeStrategy(Op, 0,
         widenToLargerTypesUnsupportedOtherwise);
     if (ST.hasDivideInARMMode())
       setAction({Op, s32}, Legal);
     else
       setAction({Op, s32}, Libcall);
   }

For this example, G_SDIV on s8, on a target without a divide
instruction, would be legalized by first doing action (WidenScalar,
s32), followed by (Libcall, s32).

The same principle is also followed for when the number of vector lanes
on vector data types need to be changed, e.g.:

   setAction({G_ADD, LLT::vector(8, 8)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(16, 8)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(4, 16)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(8, 16)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(2, 32)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(4, 32)}, LegalizerInfo::Legal);
   setLegalizeVectorElementToDifferentSizeStrategy(
       G_ADD, 0, widenToLargerTypesUnsupportedOtherwise);

As currently implemented here, vector types are legalized by first
making the vector element size legal, followed by then making the number
of lanes legal. The strategy to follow in the first step is set by a
call to setLegalizeVectorElementToDifferentSizeStrategy, see example
above.  The strategy followed in the second step
"moreToWiderTypesAndLessToWidest" (see code for its definition),
indicating that vectors are widened to more elements so they map to
natively supported vector widths, or when there isn't a legal wider
vector, split the vector to map it to the widest vector supported.

Therefore, for the above specification, some example legalizations are:
  * getAction({G_ADD, LLT::vector(3, 3)})
    returns {WidenScalar, LLT::vector(3, 8)}
  * getAction({G_ADD, LLT::vector(3, 8)})
    then returns {MoreElements, LLT::vector(8, 8)}
  * getAction({G_ADD, LLT::vector(20, 8)})
    returns {FewerElements, LLT::vector(16, 8)}

2. Key implementation aspects.

How to legalize a specific (operation, type index, size) tuple is
represented by mapping intervals of integers representing a range of
size types to an action to take, e.g.:

       setScalarAction({G_ADD, LLT:scalar(1)},
                       {{1, WidenScalar},  // bit sizes [ 1, 31[
                        {32, Legal},       // bit sizes [32, 33[
                        {33, WidenScalar}, // bit sizes [33, 64[
                        {64, Legal},       // bit sizes [64, 65[
                        {65, NarrowScalar} // bit sizes [65, +inf[
                       });

Please note that most of the code to do the actual lowering of
non-power-of-2 sized types is currently missing, this is just trying to
make it possible for targets to specify what is legal, and how non-legal
types should be legalized.  Probably quite a bit of further work is
needed in the actual legalizing and the other passes in GlobalISel to
support non-power-of-2 sized types.

I hope the documentation in LegalizerInfo.h and the examples provided in the
various {Target}LegalizerInfo.cpp and LegalizerInfoTest.cpp explains well
enough how this is meant to be used.

This drops the need for LLT::{half,double}...Size().

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

llvm-svn: 317560

6 years ago[clangd] Add ErrorCode enum class.
Haojian Wu [Tue, 7 Nov 2017 10:21:02 +0000 (10:21 +0000)]
[clangd] Add ErrorCode enum class.

Summary: Avoid using magic number in the code everywhere.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, cfe-commits

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

llvm-svn: 317559

6 years ago[docs] Add section 'Half-Precision Floating Point'
Sjoerd Meijer [Tue, 7 Nov 2017 10:09:45 +0000 (10:09 +0000)]
[docs] Add section 'Half-Precision Floating Point'

This documents the differences/interactions between _Float16 and __fp16
and is a companion change for the _Float16 type implementation (r312794).

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

llvm-svn: 317558

6 years ago[CGP] Disable Select instruction handling in optimizeMemoryInst. NFC
Serguei Katkov [Tue, 7 Nov 2017 09:43:08 +0000 (09:43 +0000)]
[CGP] Disable Select instruction handling in optimizeMemoryInst. NFC

This patch disables the handling of selects in optimization
extensing scope of optimizeMemoryInst.

The optimization itself is disable by default.
The idea here is just to switch optimiztion level step by step.

Specifically, first optimization will be enabled only for Phi nodes,
then select instructions will be added.

In case someone will complain about perfromance it will be easier to
detect what part of optimizations is responsible for that.

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

llvm-svn: 317555

6 years ago[docs][ARM] Add HowTo for cross compiling and testing compiler-rt builtins
Peter Smith [Tue, 7 Nov 2017 09:40:05 +0000 (09:40 +0000)]
[docs][ARM] Add HowTo for cross compiling and testing compiler-rt builtins

This document contains information on how to cross-compile the compiler-rt
builtins library for several flavours of Arm target and how to test the
libraries using qemu.

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

llvm-svn: 317554

6 years ago[clangd] fix MSVC build errors
Sam McCall [Tue, 7 Nov 2017 08:57:54 +0000 (08:57 +0000)]
[clangd] fix MSVC build errors

llvm-svn: 317553

6 years agoAdd new check in google module for Objective-C code to ensure global variables follow...
Haojian Wu [Tue, 7 Nov 2017 08:53:37 +0000 (08:53 +0000)]
Add new check in google module for Objective-C code to ensure global variables follow the naming convention of Google Objective-C Style Guide

Summary:
This is a new checker for objc files in clang-tidy.

The new check finds global variable declarations in Objective-C files that are not follow the pattern of variable names in Google's Objective-C Style Guide.

All the global variables should follow the pattern of "g[A-Z].*" (variables) or "k[A-Z].*" (constants). The check will suggest a variable name that follows the pattern
if it can be inferred from the original name.

Patch by Yan Zhang!

Reviewers: benhamilton, hokein, alexfh

Reviewed By: hokein

Subscribers: Eugene.Zelenko, mgorny

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

llvm-svn: 317552

6 years ago[X86] Don't clobber reserved registers with stack adjustments
Bjorn Steinbrink [Tue, 7 Nov 2017 08:50:21 +0000 (08:50 +0000)]
[X86] Don't clobber reserved registers with stack adjustments

Summary:
Calls using invoke in funclet based functions are assumed to clobber
all registers, which causes the stack adjustment using pops to consider
all registers not defined by the call to be undefined, which can
unfortunately include the base pointer, if one is needed.

To prevent this (and possibly other hazards), skip reserved registers
when looking for candidate registers.

This fixes issue #45034 in the Rust compiler.

Reviewers: mkuper

Subscribers: llvm-commits

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

llvm-svn: 317551

6 years ago[X86] Add patterns to fold a 64-bit load into the EVEX vcvtph2ps instructions.
Craig Topper [Tue, 7 Nov 2017 07:13:07 +0000 (07:13 +0000)]
[X86] Add patterns to fold a 64-bit load into the EVEX vcvtph2ps instructions.

llvm-svn: 317548

6 years ago[X86] Add patterns for folding a v16i8 with the VEX vcvtph2ps intrinsics.
Craig Topper [Tue, 7 Nov 2017 07:13:06 +0000 (07:13 +0000)]
[X86] Add patterns for folding a v16i8 with the VEX vcvtph2ps intrinsics.

Disable the peephole pass to prove that the pattern is working.

llvm-svn: 317547

6 years ago[X86] Add a test for a 128-bit vector load feeding a cvtph2ps intrinsic.
Craig Topper [Tue, 7 Nov 2017 07:13:05 +0000 (07:13 +0000)]
[X86] Add a test for a 128-bit vector load feeding a cvtph2ps intrinsic.

The instruction only loads 64-bits, but we should be able to fold a wider load and let it be narrowed.

llvm-svn: 317546

6 years ago[X86] Remove alignment from a load in the f16c intrinsic test. The alignment shouldn...
Craig Topper [Tue, 7 Nov 2017 07:13:04 +0000 (07:13 +0000)]
[X86] Remove alignment from a load in the f16c intrinsic test. The alignment shouldn't be required for load folding.

llvm-svn: 317545

6 years ago[X86] Add support for using EVEX instructions for the legacy vcvtph2ps intrinsics.
Craig Topper [Tue, 7 Nov 2017 07:13:03 +0000 (07:13 +0000)]
[X86] Add support for using EVEX instructions for the legacy vcvtph2ps intrinsics.

Looks like there's some missed load folding opportunities for i64 loads.

llvm-svn: 317544

6 years ago[X86] Add AVX512VL command line to f16c intrinsic test to show missed EVEX opportunit...
Craig Topper [Tue, 7 Nov 2017 07:13:01 +0000 (07:13 +0000)]
[X86] Add AVX512VL command line to f16c intrinsic test to show missed EVEX opportunities for the legacy intrinsics.

llvm-svn: 317543

6 years ago[X86] Use IMPLICIT_DEF in VEX/EVEX vcvtss2sd/vcvtsd2ss patterns instead of a COPY_TO_...
Craig Topper [Tue, 7 Nov 2017 04:44:22 +0000 (04:44 +0000)]
[X86] Use IMPLICIT_DEF in VEX/EVEX vcvtss2sd/vcvtsd2ss patterns instead of a COPY_TO_REGCLASS.

ExeDepsFix pass should take care of making the registers match.

llvm-svn: 317542

6 years ago[X86] Remove 'Requires' from instructions with no patterns. NFC
Craig Topper [Tue, 7 Nov 2017 04:44:21 +0000 (04:44 +0000)]
[X86] Remove 'Requires' from instructions with no patterns. NFC

llvm-svn: 317541

6 years agoClangdTests/JSONExprTests.cpp: Appease g++-4.8 to move raw string literal out of...
NAKAMURA Takumi [Tue, 7 Nov 2017 02:18:24 +0000 (02:18 +0000)]
ClangdTests/JSONExprTests.cpp: Appease g++-4.8 to move raw string literal out of macro arg.

llvm-svn: 317538

6 years ago[analyzer] [NFC] Remove unused typedef from SVals.h
George Karpenkov [Tue, 7 Nov 2017 02:02:10 +0000 (02:02 +0000)]
[analyzer] [NFC] Remove unused typedef from SVals.h

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

llvm-svn: 317537

6 years agoUse Path instead of Config->OutputFile. NFC.
Rafael Espindola [Tue, 7 Nov 2017 02:00:51 +0000 (02:00 +0000)]
Use Path instead of Config->OutputFile. NFC.

This function is always called with Config->OutputFile. That is not
obvious from reading the function. It should always use Path or take
no argument and always use Config->OutputFile.

llvm-svn: 317536

6 years ago[Support/UNIX] posix_fallocate() can fail with EINVAL.
Davide Italiano [Tue, 7 Nov 2017 00:47:04 +0000 (00:47 +0000)]
[Support/UNIX] posix_fallocate() can fail with EINVAL.

According to the docs on opegroup.org, the function can return
EINVAL if:

The len argument is less than zero, or the offset argument is less
than zero, or the underlying file system does not support this
operation.

I'd say it's a peculiar choice (when EONOTSUPP is right there), but
let's keep POSIX happy for now. This was independently discovered
by Mark Millard (on FreeBSD/ZFS).

Quickly ack'ed by Rui on IRC.

llvm-svn: 317535

6 years agoMake DIExpression::createFragmentExpression() return an Optional.
Adrian Prantl [Tue, 7 Nov 2017 00:45:34 +0000 (00:45 +0000)]
Make DIExpression::createFragmentExpression() return an Optional.

We can't safely split arithmetic into multiple fragments because we
can't express carry-over between fragments.

llvm-svn: 317534

6 years agoClarify the error message for unsupported aliases on Darwin
Alex Lorenz [Tue, 7 Nov 2017 00:31:19 +0000 (00:31 +0000)]
Clarify the error message for unsupported aliases on Darwin

rdar://35109556

llvm-svn: 317532

6 years ago[XRay] Minimal tool to convert xray traces to Chrome's Trace Event Format.
Keith Wyss [Tue, 7 Nov 2017 00:28:28 +0000 (00:28 +0000)]
[XRay] Minimal tool to convert xray traces to Chrome's Trace Event Format.

Minimal tool to convert xray traces to Chrome's Trace Event Format.

Summary:
Make use of Chrome Trace Event format's Duration events and stack frame dict to
produce Json files that chrome://tracing can visualize from xray function call
traces. Trace Event format is more robust and has several features like
argument logging, function categorization, multi process traces, etc. that we
can add as needed. Duration events cover an important base case.

Part of this change is rearranging the code so that the TrieNode data structure
can be used from multiple tools and can carry parameterized baggage on the
nodes. I put the actual behavior changes in llvm-xray convert exclusively.

Exploring the trace of instrumented llc was pretty nifty if overwhelming.
I can envision this being very useful for analyzing contention scenarios or
tuning parameters like batch sizes in a producer consumer queue. For more
targeted traces likemthis, let's talk about how we want to approach trace
pruning.

Reviewers: dberris, pelikan

Subscribers: llvm-commits

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

llvm-svn: 317531

6 years agoRemove dead code.
Rui Ueyama [Tue, 7 Nov 2017 00:26:04 +0000 (00:26 +0000)]
Remove dead code.

llvm-svn: 317530

6 years agoDisable tests in lang/c/shared_lib on Windows
Stephane Sezer [Tue, 7 Nov 2017 00:14:40 +0000 (00:14 +0000)]
Disable tests in lang/c/shared_lib on Windows

Summary: These fail because `-fPIC` is not supported on Windows.

Reviewers: zturner, jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 317529

6 years agoReport an error if an inferred alignment for a shared symbol is too large.
Rui Ueyama [Tue, 7 Nov 2017 00:12:05 +0000 (00:12 +0000)]
Report an error if an inferred alignment for a shared symbol is too large.

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

llvm-svn: 317528

6 years ago[IPO/LowerTypesTest] Skip blockaddress(es) when replacing uses.
Davide Italiano [Tue, 7 Nov 2017 00:09:25 +0000 (00:09 +0000)]
[IPO/LowerTypesTest] Skip blockaddress(es) when replacing uses.

Blockaddresses refer to the function itself, therefore replacing them
would cause an assertion in doRAUW.

Fixes https://bugs.llvm.org/show_bug.cgi?id=35201

This was found when trying CFI on a proprietary kernel by Dmitry Mikulin.

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

llvm-svn: 317527

6 years agoAMDGPU: Remove redundant combine
Matt Arsenault [Tue, 7 Nov 2017 00:06:32 +0000 (00:06 +0000)]
AMDGPU: Remove redundant combine

This combine was already done in two places. The
generic combiner already has done this since
r217610, for adds (with a single use).

This one was added in r303641, and added support for handling
or as well. r313251 later added support to the generic
combine for or. It also turns out the isOrEquivalentToAdd
check is not necessary for this combine.

Additionally, we already reproduce this combine in yet
another place in the backend, although in that version
multiple uses of the add are still folded if it will
allow a fold into the addressing mode. That version needs
to be improved to understand ors though, as well as the
correct legal offsets for private.

llvm-svn: 317526

6 years agoMove MIPS-specific code from Symbols.cpp to MIPS.cpp.
Rui Ueyama [Tue, 7 Nov 2017 00:04:22 +0000 (00:04 +0000)]
Move MIPS-specific code from Symbols.cpp to MIPS.cpp.

We have a lot of "if (MIPS)" conditions in lld because the MIPS' ABI
is different at various places than other arch's ABIs at where it
don't have to be different, but we at least want to reduce MIPS-ness
from the regular classes.

llvm-svn: 317525

6 years ago[DebugInfo] Unify logic to merge DILocations. NFC.
Vedant Kumar [Mon, 6 Nov 2017 23:15:21 +0000 (23:15 +0000)]
[DebugInfo] Unify logic to merge DILocations. NFC.

This makes DILocation::getMergedLocation() do what its comment says it
does when merging locations for an Instruction: set the common inlineAt
scope. This simplifies Instruction::applyMergedLocation() a bit.

Testing: check-llvm, check-clang

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

llvm-svn: 317524

6 years ago[Support][Chrono] Use explicit cast of text output of time values.
Simon Dardis [Mon, 6 Nov 2017 23:01:46 +0000 (23:01 +0000)]
[Support][Chrono] Use explicit cast of text output of time values.

rL316419 exposed a platform specific issue where the type of the values
passed to llvm::format could be different to the format string.

Debian unstable for mips uses long long int for std::chrono:duration,
while x86_64 uses long int.

For mips, this resulted in the value being corrupted when rendered to a
string. Address this by explicitly casting the result of the duration_cast
to the type specified in the format string.

Reviewers: sammccall

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

llvm-svn: 317523

6 years agoInstCombine: salvage the debug info of DCE'ed add instructions.
Adrian Prantl [Mon, 6 Nov 2017 22:49:39 +0000 (22:49 +0000)]
InstCombine: salvage the debug info of DCE'ed add instructions.

rdar://problem/31209283

llvm-svn: 317522

6 years ago[X86] Make FeatureAVX512 imply FeatureF16C.
Craig Topper [Mon, 6 Nov 2017 22:49:04 +0000 (22:49 +0000)]
[X86] Make FeatureAVX512 imply FeatureF16C.

The EVEX to VEX pass is already assuming this is true under AVX512VL. We had special patterns to use zmm instructions if VLX and F16C weren't available.

Instead just make AVX512 imply F16C to make the EVEX to VEX behavior explicitly legal and remove the extra patterns.

All known CPUs with AVX512 have F16C so this should safe for now.

llvm-svn: 317521

6 years ago[X86] Make FeatureAVX512 imply FeatureFMA.
Craig Topper [Mon, 6 Nov 2017 22:49:01 +0000 (22:49 +0000)]
[X86] Make FeatureAVX512 imply FeatureFMA.

Previously our VEX patterns were checking Subtarget.hasFMA() which checked FMA || AVX512. So we were behaving as if AVX512 implied it anyway. Which means we'd allow VEX encoded 128/256 FMA when AVX512F was enabled but AVX512VL is off. Regardless of the FMA flag.

EVEX to VEX also transforms scalar EVEX FMA instructions to their VEX versions even without the FMA flag. Similarly for 128/256 under AVX512VL.

So this makes AVX512 imply FeatureFMA to make our current behavior explicit.

All known CPUs that support AVX512 have VEX FMA instructions.

llvm-svn: 317520

6 years ago[ValueTracking] readonly (const) is a requirement for converting sqrt to llvm.sqrt...
Sanjay Patel [Mon, 6 Nov 2017 22:40:09 +0000 (22:40 +0000)]
[ValueTracking] readonly (const) is a requirement for converting sqrt to llvm.sqrt; nnan is not

As discussed in D39204, this is effectively a revert of rL265521 which required nnan
to vectorize sqrt libcalls based on the old LangRef definition of llvm.sqrt. Now that
the definition has been updated so the libcall and intrinsic have the same semantics
apart from potentially setting errno, we can remove the nnan requirement.

We have the right check to know that errno is not set:

if (!ICS.onlyReadsMemory())

...ahead of the switch.

This will solve https://bugs.llvm.org/show_bug.cgi?id=27435 assuming that's being
built for a target with -fno-math-errno.

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

llvm-svn: 317519

6 years agoRevert r317510 "[InstCombine] Pull shifts through a select plus binop with constant"
Hans Wennborg [Mon, 6 Nov 2017 22:28:02 +0000 (22:28 +0000)]
Revert r317510 "[InstCombine] Pull shifts through a select plus binop with constant"

This broke the CodeGen/Hexagon/loop-idiom/pmpy-mod.ll test on a bunch of buildbots.

> This pulls shifts through a select+binop with a constant where the select conditionally executes the binop. We already do this for just the binop, but not with the select.
>
> This can allow us to get the select closer to other selects to enable removing one.
>
> Differential Revision: https://reviews.llvm.org/D39222
>
> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317510 91177308-0d34-0410-b5e6-96231b3b80d8

llvm-svn: 317518

6 years agoRevert r316064 "Fix the incorrect detection of ICONV_LIBRARY_PATH"
Hans Wennborg [Mon, 6 Nov 2017 22:17:23 +0000 (22:17 +0000)]
Revert r316064 "Fix the incorrect detection of ICONV_LIBRARY_PATH"

This broke the use of libxml2 on machines where iconv() is provided by libc.
I'll follow up on the mailing list to discuss how to fix this properly.

> This is introduced in rL308711.
> Check for c library is incorrect here just because libc will be found always
> and it does not mean that iconv is presented.
>
> Thank to Andrew Krasny for narrowing down the root cause.
>
> Reviewers: ecbeckmann
> Reviewed By: ecbeckmann
> Subscribers: mgorny, llvm-commits
> Differential Revision: https://reviews.llvm.org/D38875

llvm-svn: 317517

6 years ago[analyzer] Model correct dispatch_once() 'done' value in BodyFarm
Devin Coughlin [Mon, 6 Nov 2017 22:12:19 +0000 (22:12 +0000)]
[analyzer] Model correct dispatch_once() 'done' value in BodyFarm

The analyzer's BodyFarm models dispatch_once() by comparing the passed-in
predicate against a known 'done' value. If the predicate does not have that
value, the model updates the predicate to have that value and executes the
passed in block.

Unfortunately, the current model uses the wrong 'done' value: 1 instead of ~0.
This interferes with libdispatch's static inline function _dispatch_once(),
which enables a fast path if the block has already been executed. That function
uses __builtin_assume() to tell the compiler that the done flag is set to ~0 on
exit. When r302880 added modeling of __builtin_assume(), this caused the
analyzer to assume 1 == ~0. This in turn caused the analyzer to never explore any code after a call to dispatch_once().

This patch regains the missing coverage by updating BodyFarm to use the correct
'done' value.

rdar://problem/34413048

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

llvm-svn: 317516

6 years ago[OMPT] Fix null pointer in parallel/no_thread_num_clause.c
Jonas Hahnfeld [Mon, 6 Nov 2017 22:06:14 +0000 (22:06 +0000)]
[OMPT] Fix null pointer in parallel/no_thread_num_clause.c

Looks like the implementation of printf on Darwin uses "0x0"
instead of "(nil)" like glibc does.

llvm-svn: 317515