platform/upstream/llvm.git
6 years agoFactor out common condition into an easier to understand helper function (NFC).
Adrian Prantl [Mon, 12 Feb 2018 21:11:14 +0000 (21:11 +0000)]
Factor out common condition into an easier to understand helper function (NFC).

llvm-svn: 324935

6 years ago[ScopBuilder] scalar-indep: Fix mutually referencing PHIs.
Michael Kruse [Mon, 12 Feb 2018 21:09:40 +0000 (21:09 +0000)]
[ScopBuilder] scalar-indep: Fix mutually referencing PHIs.

Two or more PHIs mutually using each other directly or indirectly as
incoming value could cause that a PHI WRITE be added before the PHI READ
(i.e. it overwrites the current incoming value with the next incoming
value before it being read).

Fix by ensuring that the PHI WRITE and PHI READ are in the same statement.

This should fix the miscompile of SingleSource/Benchmark/Misc/whetstone
from the test-suite.

llvm-svn: 324934

6 years agoMove the debuginfo-dce-or test into debuginfo-variables.ll, NFC
Vedant Kumar [Mon, 12 Feb 2018 21:02:45 +0000 (21:02 +0000)]
Move the debuginfo-dce-or test into debuginfo-variables.ll, NFC

llvm-svn: 324933

6 years agoRevert "[ThinLTO] Add GraphTraits for FunctionSummaries"
Volodymyr Sapsai [Mon, 12 Feb 2018 20:43:31 +0000 (20:43 +0000)]
Revert "[ThinLTO] Add GraphTraits for FunctionSummaries"

It caused assertion failure
Assertion failed: (!DD.IsLambda && !MergeDD.IsLambda && "faked up lambda definition?"), function MergeDefinitionData, file /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp, line 1675.

on the second stage build bots.

llvm-svn: 324932

6 years agoRevert "Follow on to rL324854 (Added tests)" as part of r324854 revert.
Volodymyr Sapsai [Mon, 12 Feb 2018 20:42:18 +0000 (20:42 +0000)]
Revert "Follow on to rL324854 (Added tests)" as part of r324854 revert.

r324854 caused broken build on the second stage build bots.

llvm-svn: 324931

6 years agoRemove the pubnames support from the Xcode project.
Jim Ingham [Mon, 12 Feb 2018 20:25:37 +0000 (20:25 +0000)]
Remove the pubnames support from the Xcode project.

llvm-svn: 324930

6 years ago[DebugInfo] Update Checksum handling in CGDebugInfo
Scott Linder [Mon, 12 Feb 2018 19:47:05 +0000 (19:47 +0000)]
[DebugInfo] Update Checksum handling in CGDebugInfo

Update to match new DIFile API.

llvm-svn: 324929

6 years ago[DebugInfo] Unify ChecksumKind and Checksum value in DIFile
Scott Linder [Mon, 12 Feb 2018 19:45:54 +0000 (19:45 +0000)]
[DebugInfo] Unify ChecksumKind and Checksum value in DIFile

Rather than encode the absence of a checksum with a Kind variant, instead put
both the kind and value in a struct and wrap it in an Optional.

Differential Revision: http://reviews.llvm.org/D43043

llvm-svn: 324928

6 years ago[InstCombine] X / (X * Y) --> 1.0 / Y
Sanjay Patel [Mon, 12 Feb 2018 19:39:21 +0000 (19:39 +0000)]
[InstCombine] X / (X * Y) --> 1.0 / Y

This is similar to the instsimplify fold added with D42385
( rL323716 )
...but this can't be in instsimplify because we're creating/morphing
a different instruction.

llvm-svn: 324927

6 years ago[InstCombine] add tests for missing fdiv fold; NFC
Sanjay Patel [Mon, 12 Feb 2018 19:23:39 +0000 (19:23 +0000)]
[InstCombine] add tests for missing fdiv fold; NFC

llvm-svn: 324926

6 years agoRemove dead code for handling DWARF pubnames
Adrian McCarthy [Mon, 12 Feb 2018 19:19:04 +0000 (19:19 +0000)]
Remove dead code for handling DWARF pubnames

Summary:
LLDB doesn't use this code, the code has no tests, and the code does suspicious
things like hashing pointers to strings instead of the strings themselves.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 324925

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Mon, 12 Feb 2018 19:14:01 +0000 (19:14 +0000)]
[InstCombine] regenerate checks; NFC

llvm-svn: 324924

6 years agoImplement LWG 2835 - fix <tgmath.h>
Marshall Clow [Mon, 12 Feb 2018 19:13:24 +0000 (19:13 +0000)]
Implement LWG 2835 - fix <tgmath.h>

llvm-svn: 324923

6 years ago[InstCombine] various clean-ups for div transforms; NFC
Sanjay Patel [Mon, 12 Feb 2018 18:38:35 +0000 (18:38 +0000)]
[InstCombine] various clean-ups for div transforms; NFC

llvm-svn: 324922

6 years ago[testsuite] Reintroduce test to check leaking.
Davide Italiano [Mon, 12 Feb 2018 18:06:34 +0000 (18:06 +0000)]
[testsuite] Reintroduce test to check leaking.

It wasn't python leaking, it was lldb. Thanks to Pavel for the
explanation. Pointy-hat to me.

llvm-svn: 324919

6 years agoAdd a unit test for Driver::getDefaultModuleCachePath().
Adrian Prantl [Mon, 12 Feb 2018 17:59:54 +0000 (17:59 +0000)]
Add a unit test for Driver::getDefaultModuleCachePath().

llvm-svn: 324917

6 years ago[LICM] update BlockColors after splitting predecessors
Jun Bum Lim [Mon, 12 Feb 2018 17:56:55 +0000 (17:56 +0000)]
[LICM] update BlockColors after splitting predecessors

Update BlockColors after splitting predecessors. Do not allow splitting
EHPad for sinking when the BlockColors is not empty, so we can
simply assign predecessor's color to the new block.

Fixes PR36184

llvm-svn: 324916

6 years agoFurther cleanup to Driver mode code, as suggested by dblaikie [NFC]
Erich Keane [Mon, 12 Feb 2018 17:47:01 +0000 (17:47 +0000)]
Further cleanup to Driver mode code, as suggested by dblaikie [NFC]

llvm-svn: 324915

6 years ago[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo
Fangrui Song [Mon, 12 Feb 2018 17:42:09 +0000 (17:42 +0000)]
[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo

Summary:
CXIdxEntityRefInfo contains the member `CXIdxEntityRefKind kind;` to
differentiate implicit and direct calls. However, there are more roles
defined in SymbolRole. Among them, `Read/Write` are probably the most
useful ones as they can be used to differentiate Read/Write occurrences
of a symbol for document highlight in a text document.

See `export namespace DocumentHighlightKind`
on https://microsoft.github.io/language-server-protocol/specification

Subscribers: cfe-commits

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

llvm-svn: 324914

6 years ago[Sema] Don't mark plain MS enums as fixed
Reid Kleckner [Mon, 12 Feb 2018 17:37:06 +0000 (17:37 +0000)]
[Sema] Don't mark plain MS enums as fixed

Summary:
This fixes a flaw in our AST: PR27098

MSVC always gives plain enums the underlying type 'int'. Clang does this
as well, but we claim the enum is "fixed", as if the user actually wrote
': int'. It means we end up emitting spurious -Wsign-compare warnings on
code like this:

  enum Vals { E1, E2, E3 };
  bool f(unsigned v1, Vals v2) {
    return v1 == v2;
  }

We think 'v2' can take on negative values because we think 'Vals' is
fixed. This fixes that.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 324913

6 years ago[AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - llvm portion
Abderrazek Zaafrani [Mon, 12 Feb 2018 17:35:42 +0000 (17:35 +0000)]
[AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - llvm portion

https://reviews.llvm.org/D42993

llvm-svn: 324912

6 years agoImplement LWG#2908 - The less-than operator for shared pointers could do more, and...
Marshall Clow [Mon, 12 Feb 2018 17:26:40 +0000 (17:26 +0000)]
Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that)

llvm-svn: 324911

6 years ago[X86] Add missing scheduling class tag for i64 absolute address moves
Simon Pilgrim [Mon, 12 Feb 2018 17:21:28 +0000 (17:21 +0000)]
[X86] Add missing scheduling class tag for i64 absolute address moves

Expand existing SchedRW to encompass these like it did for the other memory offset movs - added comments to closing braces to keep track of def scopes.

We only tagged it with the itinerary class, so completeness checks were erroneously passed (PR35639).

llvm-svn: 324910

6 years agoUpdate target-note-test to be current with the AMDGPU changes
Erich Keane [Mon, 12 Feb 2018 17:19:57 +0000 (17:19 +0000)]
Update target-note-test to be current with the AMDGPU changes

llvm-svn: 324909

6 years ago[AArch64] Improve v8.1-A code-gen for atomic load-and
Oliver Stannard [Mon, 12 Feb 2018 17:03:11 +0000 (17:03 +0000)]
[AArch64] Improve v8.1-A code-gen for atomic load-and

Armv8.1-A added an atomic load-clear instruction (which performs bitwise
and with the complement of it's operand), but not a load-and
instruction. Our current code-generation for atomic load-and always
inserts an MVN instruction to invert its argument, even if it could be
folded into a constant or another instruction.

This adds lowering early in selection DAG to convert a load-and
operation into an xor with -1 and a load-clear, allowing the normal DAG
optimisations to work on it.

To do this, I've had to add a new ISD opcode, ATOMIC_LOAD_CLR. I don't
see any easy way to do this with an AArch64-specific ISD node, because
the code-generation for atomic operations assumes the SDNodes are of
type AtomicSDNode.

I've left the old tablegen patterns in because they are still needed for
global isel.

Differential revision: https://reviews.llvm.org/D42478

llvm-svn: 324908

6 years agoMake attribute-target on a Definition-after-use update the LLVM attributes
Erich Keane [Mon, 12 Feb 2018 17:01:41 +0000 (17:01 +0000)]
Make attribute-target on a Definition-after-use update the LLVM attributes

As reported here: https://bugs.llvm.org/show_bug.cgi?id=36301
The issue is that the 'use' causes the plain declaration to emit
the attributes to LLVM-IR. However, if the definition added it
later, these would silently disappear.

This commit extracts that logic to its own function in CodeGenModule,
and has the attribute-applications done during 'definition' update
the attributes properly.

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

llvm-svn: 324907

6 years ago[sanitizer] Size class map & local cache improvements
Kostya Kortchinsky [Mon, 12 Feb 2018 16:59:17 +0000 (16:59 +0000)]
[sanitizer] Size class map & local cache improvements

Summary:
- Reland rL324263, this time allowing for a compile-time decision as to whether
  or not use the 32-bit division. A single test is using a class map covering
  a maximum size greater than 4GB, this can be checked via the template
  parameters, and allows SizeClassAllocator64PopulateFreeListOOM to pass;
- `MaxCachedHint` is always called on a class id for which we have already
  computed the size, but we still recompute `Size(class_id)`. Change the
  prototype of the function to work on sizes instead of class ids. This also
  allows us to get rid of the `kBatchClassID` special case. Update the callers
  accordingly;
- `InitCache` and `Drain` will start iterating at index 1: index 0 contents are
  unused and can safely be left to be 0. Plus we do not pay the cost of going
  through an `UNLIKELY` in `MaxCachedHint`, and touching memory that is
  otherwise not used;
- `const` some variables in the areas modified;
- Remove an spurious extra line at the end of a file.

Reviewers: alekseyshl, tl0gic, dberris

Reviewed By: alekseyshl, dberris

Subscribers: dberris, kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 324906

6 years ago[X86][AVX512] Add missing scheduling class tag for KMOVB/KMOVW/KMOVD/KMOVQ moves...
Simon Pilgrim [Mon, 12 Feb 2018 16:59:04 +0000 (16:59 +0000)]
[X86][AVX512] Add missing scheduling class tag for KMOVB/KMOVW/KMOVD/KMOVQ moves/loads/stores.

We only tagged it with the itinerary class, so completeness checks were erroneously passed (PR35639).

llvm-svn: 324905

6 years ago[OpenMP][libomptarget] Enable the compilation of multiple bc libraries for runtime...
Gheorghe-Teodor Bercea [Mon, 12 Feb 2018 16:45:20 +0000 (16:45 +0000)]
[OpenMP][libomptarget] Enable the compilation of multiple bc libraries for runtime inlining

Summary:
Different NVIDIA GPUs support different compute capabilities. To enable the inlining of runtime functions and the best performance on different generations of NVIDIA GPUs, a bc library for each compute capability needs to be compiled. The same compiler build will then be usable in conjunction with multiple generations of NVIDIA GPUs.
To differentiate between versions of the same bc lib, the output file name will contain the compute capability ID.
Depends on D14254

Reviewers: Hahnfeld, hfinkel, carlo.bertolli, caomhin, ABataev, grokos

Reviewed By: Hahnfeld, grokos

Subscribers: guansong, mgorny, openmp-commits

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

llvm-svn: 324904

6 years ago[AArch64] Refactor identification of SIMD immediates
Evandro Menezes [Mon, 12 Feb 2018 16:41:41 +0000 (16:41 +0000)]
[AArch64] Refactor identification of SIMD immediates

Get rid of icky goto loops and make the code easier to maintain (NFC).

Differential revision: https://reviews.llvm.org/D42723

llvm-svn: 324903

6 years agoAdd Invalid-note test negllected in R324673,324674,324675,324676
Erich Keane [Mon, 12 Feb 2018 16:24:08 +0000 (16:24 +0000)]
Add Invalid-note test negllected in R324673,324674,324675,324676

llvm-svn: 324902

6 years ago[X86][AVX512] Add missing scheduling class tag for VMOVQ/VMOVHLPS/VMOVLHPS/VMOVHPD...
Simon Pilgrim [Mon, 12 Feb 2018 16:18:36 +0000 (16:18 +0000)]
[X86][AVX512] Add missing scheduling class tag for VMOVQ/VMOVHLPS/VMOVLHPS/VMOVHPD/VMOVHPS/VMOVLPD/VMOVLPS

Tag AVX512 variants to match SSE/AVX originals.

We only tagged it with the itinerary class, so completeness checks were erroneously passed (PR35639).

llvm-svn: 324901

6 years agoRe-commit r324490: [DebugInfo] Improvements to representation of enumeration types...
Momchil Velikov [Mon, 12 Feb 2018 16:12:52 +0000 (16:12 +0000)]
Re-commit r324490: [DebugInfo] Improvements to representation of enumeration types (PR36168)

Differential revision: https://reviews.llvm.org/D42736

llvm-svn: 324900

6 years agoRe-commit r324489: [DebugInfo] Improvements to representation of enumeration types...
Momchil Velikov [Mon, 12 Feb 2018 16:10:09 +0000 (16:10 +0000)]
Re-commit r324489: [DebugInfo] Improvements to representation of enumeration types (PR36168)

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

llvm-svn: 324899

6 years ago[X86] Tag CET-IBT instruction scheduler classes
Simon Pilgrim [Mon, 12 Feb 2018 15:57:00 +0000 (15:57 +0000)]
[X86] Tag CET-IBT instruction scheduler classes

llvm-svn: 324898

6 years ago[X86][MMX] Add missing scheduling class tag for EMMS/FEMMS
Simon Pilgrim [Mon, 12 Feb 2018 15:52:59 +0000 (15:52 +0000)]
[X86][MMX] Add missing scheduling class tag for EMMS/FEMMS

We only tagged it with the itinerary class, so completeness checks were erroneously passed (PR35639).

AMD targets can perform these a lot quicker than WriteMicrocoded so will need an override in the models.

llvm-svn: 324897

6 years ago[clang-format] Fix comment indentation in text protos
Krasimir Georgiev [Mon, 12 Feb 2018 15:49:09 +0000 (15:49 +0000)]
[clang-format] Fix comment indentation in text protos

Summary: This patch fixes a bug where the comment indent of comments in text protos gets messed up because by default paren states get created with AlignColons = true (which makes snese for ObjC).

Subscribers: klimek, cfe-commits

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

llvm-svn: 324896

6 years agoWhile implementing P0777 - preventing unnecessary decay, I found some non-public...
Marshall Clow [Mon, 12 Feb 2018 15:41:25 +0000 (15:41 +0000)]
While implementing P0777 - preventing unnecessary decay, I found some non-public uses of decay that could be replaced by __uncvref. NFC intented

llvm-svn: 324895

6 years ago[NFC] Fix comment of class InstrStage
Krzysztof Parzyszek [Mon, 12 Feb 2018 15:02:49 +0000 (15:02 +0000)]
[NFC] Fix comment of class InstrStage

Patch by Wei-Ren Chen.

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

llvm-svn: 324894

6 years ago[SLP] Take user instructions cost into consideration in insertelement vectorization.
Alexey Bataev [Mon, 12 Feb 2018 14:54:48 +0000 (14:54 +0000)]
[SLP] Take user instructions cost into consideration in insertelement vectorization.

Summary:
For better vectorization result we should take into consideration the
cost of the user insertelement instructions when we try to
vectorize sequences that build the whole vector. I.e. if we have the
following scalar code:
```
<Scalar code>
insertelement <ScalarCode>, ...
```
we should consider the cost of the last `insertelement ` instructions as
the cost of the scalar code.

Reviewers: RKSimon, spatel, hfinkel, mkuper

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 324893

6 years ago[AArch64] Improve v8.1-A code-gen for atomic load-subtract
Oliver Stannard [Mon, 12 Feb 2018 14:22:03 +0000 (14:22 +0000)]
[AArch64] Improve v8.1-A code-gen for atomic load-subtract

Armv8.1-A added an atomic load-add instruction, but not a load-subtract
instruction. Our current code-generation for atomic load-subtract always
inserts a NEG instruction to negate it's argument, even if it could be
folded into a constant or another instruction.

This adds lowering early in selection DAG to convert a load-subtract
operation into a subtract and a load-add, allowing the normal DAG
optimisations to work on it.

I've left the old tablegen patterns in because they are still needed for
global isel.

Some of the tests in this patch are copied from D35375 by Chad Rosier (which
was abandoned).

Differential revision: https://reviews.llvm.org/D42477

llvm-svn: 324892

6 years ago[InstCombine] various clean-ups for commonIDivTransforms; NFC
Sanjay Patel [Mon, 12 Feb 2018 14:14:56 +0000 (14:14 +0000)]
[InstCombine] various clean-ups for commonIDivTransforms; NFC

llvm-svn: 324891

6 years agoAllow the NS, CF, and ObjC attributes to be used with -fdouble-square-bracket-attribu...
Aaron Ballman [Mon, 12 Feb 2018 13:38:25 +0000 (13:38 +0000)]
Allow the NS, CF, and ObjC attributes to be used with -fdouble-square-bracket-attributes. The syntactic locations for such attributes on ObjC constructs have been specifically chosen to follow the GNU attribute syntactic locations.

llvm-svn: 324890

6 years agoTest commit: reformat comment
Nicholas Wilson [Mon, 12 Feb 2018 13:17:09 +0000 (13:17 +0000)]
Test commit: reformat comment

llvm-svn: 324889

6 years ago[clangd] Log all ignored diagnostics.
Ilya Biryukov [Mon, 12 Feb 2018 12:48:51 +0000 (12:48 +0000)]
[clangd] Log all ignored diagnostics.

Summary:
To aid debugging failures and crashes.
Only part of ignored diagnostics was logged before, now we log all of
them.

Reviewers: ioeric, hokein, sammccall

Reviewed By: hokein

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 324888

6 years agoRevert r324835 "[X86] Reduce Store Forward Block issues in HW"
Hans Wennborg [Mon, 12 Feb 2018 12:43:39 +0000 (12:43 +0000)]
Revert r324835 "[X86] Reduce Store Forward Block issues in HW"

It asserts building Chromium; see PR36346.

(This also reverts the follow-up r324836.)

> If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
> A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
> The estimated penalty for a store forward block is ~13 cycles.
>
> This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
> of a load and a store.
>
> The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
> breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

llvm-svn: 324887

6 years ago[clang-move] Fix the incorrect expansion end location.
Haojian Wu [Mon, 12 Feb 2018 12:26:12 +0000 (12:26 +0000)]
[clang-move] Fix the incorrect expansion end location.

Summary:
Before the fix, if clang-move decides to move the following macro statement, it only moves the first line `DEFINE(A,`.

```
DEFINE(A,
       B);
```

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits

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

llvm-svn: 324886

6 years ago[mips] Fix 'l' constraint handling for types smaller than 32 bits
Simon Atanasyan [Mon, 12 Feb 2018 12:21:55 +0000 (12:21 +0000)]
[mips] Fix 'l' constraint handling for types smaller than 32 bits

In case of correct using of the 'l' constraint llvm now generates valid
code; otherwise it shows an error message. Initially these triggers an
assertion.

This commit is the same as r324869 with fixed the test's file name.

llvm-svn: 324885

6 years agoASan+operator new[]: Add an option for more thorough operator new[] cookie poisoning
Filipe Cabecinhas [Mon, 12 Feb 2018 11:49:02 +0000 (11:49 +0000)]
ASan+operator new[]: Add an option for more thorough operator new[] cookie poisoning

Summary:
Right now clang is skipping array cookie poisoning for any operator
new[] which is not part of the set of replaceable global allocation
functions.

This commit adds a flag to tell clang to poison all operator new[]
cookies.

A previous review was poisoning all array cookies unconditionally, but
there is an edge case which would stop working under ASan (a custom
operator new[] saves whatever pointer it returned, and then accesses
it).

This newer revision adds a command line argument to toggle this feature.

Original revision: https://reviews.llvm.org/D41301
Compiler-rt test revision with an explanation of the edge case: https://reviews.llvm.org/D41664

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

llvm-svn: 324884

6 years ago[clangd] Remove codeComplete that returns std::future<>
Ilya Biryukov [Mon, 12 Feb 2018 11:37:28 +0000 (11:37 +0000)]
[clangd] Remove codeComplete that returns std::future<>

Summary:
It was deprecated and callback version and is used everywhere.
Only changes to the testing code were needed.

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: mgorny, klimek, jkorous-apple, cfe-commits

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

llvm-svn: 324883

6 years ago[mips] Revert rL324869
Simon Atanasyan [Mon, 12 Feb 2018 11:15:37 +0000 (11:15 +0000)]
[mips] Revert rL324869

This commit adds inlineasm-cnstrnt-bad-l.ll which is clashing
with inlineasm-cnstrnt-bad-L.ll on case insensitive file systems.

llvm-svn: 324882

6 years ago[LoopInterchange] Simplify splitInnerLoopHeader logic (NFC).
Florian Hahn [Mon, 12 Feb 2018 11:10:58 +0000 (11:10 +0000)]
[LoopInterchange] Simplify splitInnerLoopHeader logic (NFC).

We can use SplitBlock for both cases, which makes the code slightly
simpler and updates both LoopInfo and the dominator tree.

llvm-svn: 324881

6 years ago[CodeGen] Add a -trap-unreachable option for debugging
David Green [Mon, 12 Feb 2018 11:06:27 +0000 (11:06 +0000)]
[CodeGen] Add a -trap-unreachable option for debugging

Add a common -trap-unreachable option, similar to the target
specific hexagon equivalent, which has been replaced. This
turns unreachable instructions into traps, which is useful for
debugging.

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

llvm-svn: 324880

6 years ago[libomptarget] Fix detection of CUDA stubs library
Jonas Hahnfeld [Mon, 12 Feb 2018 11:01:56 +0000 (11:01 +0000)]
[libomptarget] Fix detection of CUDA stubs library

CUDA_LIBRARIES contains additional linker arguments since CMake 3.3
which breakes the current way of finding the stubs library.

llvm-svn: 324879

6 years ago[CUDA] Add option to generate relocatable device code
Jonas Hahnfeld [Mon, 12 Feb 2018 10:46:45 +0000 (10:46 +0000)]
[CUDA] Add option to generate relocatable device code

As a first step, pass '-c/--compile-only' to ptxas so that it
doesn't complain about references to external function. This
will successfully generate object files, but they won't work
at runtime because the registration routines need to adapted.

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

llvm-svn: 324878

6 years ago[CUDA] Fix test cuda-external-tools.cu
Jonas Hahnfeld [Mon, 12 Feb 2018 10:46:34 +0000 (10:46 +0000)]
[CUDA] Fix test cuda-external-tools.cu

This didn't verify the CHECK prefix before!

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

llvm-svn: 324877

6 years ago[gtest] Support raw_ostream printing functions more comprehensively.
Sam McCall [Mon, 12 Feb 2018 10:20:09 +0000 (10:20 +0000)]
[gtest] Support raw_ostream printing functions more comprehensively.

Summary:
These are functions like operator<<(raw_ostream&, Foo).

Previously these were only supported for messages. In the assertion
  EXPECT_EQ(A, B) << C;
the local modifications would explicitly try to use raw_ostream printing for C.
However A and B would look for a std::ostream printing function, and often fall
back to gtest's default "168 byte object <00 01 FE 42 ...>".

This patch pulls out the raw_ostream support into a new header under `custom/`.

I changed the mechanism: instead of a convertible stream, we wrap the printed
value in a proxy object to allow it to be sent to a std::ostream.
I think the new way is clearer.

I also changed the policy: we prefer raw_ostream printers over std::ostream
ones. This is because the fallback printers are defined using std::ostream,
while all the raw_ostream printers should be "good".

Reviewers: ilya-biryukov, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 324876

6 years agoSkip TestTargetXMLArch on non-darwin OSs
Pavel Labath [Mon, 12 Feb 2018 09:46:06 +0000 (09:46 +0000)]
Skip TestTargetXMLArch on non-darwin OSs

This test uses XML packets, but libxml is an optional dependency of
lldb, and this test fails if it is not present.

I'm leaving this enabled on mac, as thats the only platform that's
likely to have libxml always available, but ideally we should have a way
to skip this based on build configuration. I'll see if I can whip
something like that up soon, but for the time being, this unblocks the
buildbots.

llvm-svn: 324870

6 years ago[mips] Fix 'l' constraint handling for types smaller than 32 bits
Simon Atanasyan [Mon, 12 Feb 2018 07:51:21 +0000 (07:51 +0000)]
[mips] Fix 'l' constraint handling for types smaller than 32 bits

In case of correct using of the 'l' constraint llvm now generates valid
code; otherwise it shows an error message. Initially these triggers an
assertion.

llvm-svn: 324869

6 years ago[MC] Issue error message when data region is not terminated
Gerolf Hoflehner [Mon, 12 Feb 2018 07:19:05 +0000 (07:19 +0000)]
[MC] Issue error message when data region is not terminated

llvm-svn: 324868

6 years ago[NFC] Fix typos
Max Kazantsev [Mon, 12 Feb 2018 05:16:28 +0000 (05:16 +0000)]
[NFC] Fix typos

llvm-svn: 324867

6 years ago[SCEV] Make getPostIncExpr guaranteed to return AddRec
Max Kazantsev [Mon, 12 Feb 2018 05:09:38 +0000 (05:09 +0000)]
[SCEV] Make getPostIncExpr guaranteed to return AddRec

The current implementation of `getPostIncExpr` invokes `getAddExpr` for two recurrencies
and expects that it always returns it a recurrency. But this is not guaranteed to happen if we
have reached max recursion depth or refused to make SCEV simplification for other reasons.

This patch changes its implementation so that now it always returns SCEVAddRec without
relying on `getAddExpr`.

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

llvm-svn: 324866

6 years ago[X86] Don't look for TEST instruction shrinking opportunities when the root node...
Craig Topper [Mon, 12 Feb 2018 03:02:02 +0000 (03:02 +0000)]
[X86] Don't look for TEST instruction shrinking opportunities when the root node is a X86ISD::SUB.

I don't believe we ever create an X86ISD::SUB with a 0 constant which is what the TEST handling needs. The ternary operator at the end of this code shows up as only going one way in the llvm-cov report from the bots.

llvm-svn: 324865

6 years ago[X86] Remove check for X86ISD::AND with no flag users from the TEST instruction immed...
Craig Topper [Mon, 12 Feb 2018 03:02:01 +0000 (03:02 +0000)]
[X86] Remove check for X86ISD::AND with no flag users from the TEST instruction immediate shrinking code.

We turn X86ISD::AND with no flag users back to ISD::AND in PreprocessISelDAG.

llvm-svn: 324864

6 years ago[X86] Change some compare patterns to use loadi8/loadi16/loadi32/loadi64 helper fragm...
Craig Topper [Mon, 12 Feb 2018 02:48:42 +0000 (02:48 +0000)]
[X86] Change some compare patterns to use loadi8/loadi16/loadi32/loadi64 helper fragments.

This enables CMP8mi to fold zextloadi8i1 which in all tests allows us to avoid creating a TEST8rr that peephole can't fold.

llvm-svn: 324863

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Mon, 12 Feb 2018 02:03:36 +0000 (02:03 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 324862

6 years ago[X86] Add KADD X86ISD opcode instead of reusing ISD::ADD.
Craig Topper [Mon, 12 Feb 2018 01:33:38 +0000 (01:33 +0000)]
[X86] Add KADD X86ISD opcode instead of reusing ISD::ADD.

ISD::ADD implies individual vector element addition with no carries between elements. But for a vXi1 type that would be the same as XOR. And we already turn ISD::ADD into ISD::XOR for all vXi1 types during lowering. So the ISD::ADD pattern would never be able to match anyway.

KADD is different, it adds the elements but also propagates a carry between them. This just a way of doing an add in k-register without bitcasting to the scalar domain. There's still no way to match the pattern, but at least its not obviously wrong.

llvm-svn: 324861

6 years ago[X86] Allow zextload/extload i1->i8 to be folded into instructions during isel
Craig Topper [Mon, 12 Feb 2018 01:33:36 +0000 (01:33 +0000)]
[X86] Allow zextload/extload i1->i8 to be folded into instructions during isel

Previously we just emitted this as a MOV8rm which would likely get folded during the peephole pass anyway. This just makes it explicit earlier.

The gpr-to-mask.ll test changed because the kaddb instruction has no memory form.

llvm-svn: 324860

6 years agoFollow on to rL324854 (Added tests)
Charles Saternos [Mon, 12 Feb 2018 00:20:16 +0000 (00:20 +0000)]
Follow on to rL324854 (Added tests)

llvm-svn: 324859

6 years ago[X86] Remove MASK_BINOP intrinsic type. NFC
Craig Topper [Sun, 11 Feb 2018 22:32:30 +0000 (22:32 +0000)]
[X86] Remove MASK_BINOP intrinsic type. NFC

llvm-svn: 324858

6 years ago[X86] Remove dead code from getMaskNode that looked for a i64 mask with a maskVT...
Craig Topper [Sun, 11 Feb 2018 22:32:29 +0000 (22:32 +0000)]
[X86] Remove dead code from getMaskNode that looked for a i64 mask with a maskVT that wasn't v64i1. NFC

llvm-svn: 324857

6 years ago[X86] Remove LowerBoolVSETCC_AVX512, we get this with a target independent DAG combin...
Craig Topper [Sun, 11 Feb 2018 22:32:27 +0000 (22:32 +0000)]
[X86] Remove LowerBoolVSETCC_AVX512, we get this with a target independent DAG combine now. NFC

llvm-svn: 324856

6 years agoAdd default C++ ABI libname and include paths for FreeBSD
Dimitry Andric [Sun, 11 Feb 2018 22:31:05 +0000 (22:31 +0000)]
Add default C++ ABI libname and include paths for FreeBSD

Summary:
As noted in a discussion about testing the LLVM 6.0.0 release candidates
(with libc++) for FreeBSD, many tests turned out to fail with
"exception_ptr not yet implemented".  This was because libc++ did not
choose the correct C++ ABI library, and therefore it fell back to the
`exception_fallback.ipp` header.

Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library,
and its headers have always been installed in /usr/include/c++/v1,
together with the (system) libc++ headers.  (Older versions of FreeBSD
used GNU libsupc++ by default, but these are now unsupported.)

Therefore, if we are building libc++ for FreeBSD, set:
* `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt"
* `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1"
by default.

Reviewers: emaste, EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: mgorny, cfe-commits, krytarowski

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

llvm-svn: 324855

6 years ago[ThinLTO] Add GraphTraits for FunctionSummaries
Charles Saternos [Sun, 11 Feb 2018 22:06:20 +0000 (22:06 +0000)]
[ThinLTO] Add GraphTraits for FunctionSummaries

Add GraphTraits definitions to the FunctionSummary and ModuleSummaryIndex classes. These GraphTraits will be used to construct find SCC's in ThinLTO analysis passes.

llvm-svn: 324854

6 years agoFix libcxx MSVC C++17 redefinition of 'align_val_t'
Eric Fiselier [Sun, 11 Feb 2018 22:00:19 +0000 (22:00 +0000)]
Fix libcxx MSVC C++17 redefinition of 'align_val_t'

Patch from  charlieio@outlook.com

Reviewed as https://reviews.llvm.org/D42354

When the following command is used:

> clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib

An error occurred:

In file included from hello.cc:1:
In file included from include\c++\v1\iostream:38:
In file included from include\c++\v1\ios:216:
In file included from include\c++\v1\__locale:15:
In file included from include\c++\v1\string:477:
In file included from include\c++\v1\string_view:176:
In file included from include\c++\v1\__string:56:
In file included from include\c++\v1\algorithm:643:
In file included from include\c++\v1\memory:656:
include\c++\v1\new(165,29):  error: redefinition of 'align_val_t'
enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
                            ^
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16):  note:
      previous definition is here
    enum class align_val_t : size_t {};
               ^
1 error generated.
vcruntime_new.h has defined align_val_t, libcxx need hide align_val_t.

This patch fixes that error.

llvm-svn: 324853

6 years agoMark two issues as complete
Eric Fiselier [Sun, 11 Feb 2018 21:57:25 +0000 (21:57 +0000)]
Mark two issues as complete

llvm-svn: 324852

6 years agoFix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch
Marshall Clow [Sun, 11 Feb 2018 21:51:49 +0000 (21:51 +0000)]
Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch

llvm-svn: 324851

6 years ago[CodeView] Allow variable names to be as long as the codeview format supports
Brock Wyma [Sun, 11 Feb 2018 21:26:46 +0000 (21:26 +0000)]
[CodeView] Allow variable names to be as long as the codeview format supports

Instead of reserving 0xF00 bytes for the fixed length portion of the CodeView
symbol name, calculate the actual length of the fixed length portion.

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

llvm-svn: 324850

6 years agoRevert r324847, there's bot failures.
Kuba Mracek [Sun, 11 Feb 2018 20:44:04 +0000 (20:44 +0000)]
Revert r324847, there's bot failures.

llvm-svn: 324849

6 years ago[sanitizer] Implement NanoTime() on Darwin
Kuba Mracek [Sun, 11 Feb 2018 19:25:34 +0000 (19:25 +0000)]
[sanitizer] Implement NanoTime() on Darwin

Currently NanoTime() on Darwin is unimplemented and always returns 0. Looks like there's quite a few things broken because of that (TSan periodic memory flush, ASan allocator releasing pages back to the OS). Let's fix that.

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

llvm-svn: 324847

6 years ago[compiler-rt] Replace forkpty with posix_spawn
Kuba Mracek [Sun, 11 Feb 2018 19:23:42 +0000 (19:23 +0000)]
[compiler-rt] Replace forkpty with posix_spawn

On Darwin, we currently use forkpty to communicate with the "atos" symbolizer. There are several problems that fork or forkpty has, e.g. that after fork, interceptors are still active and this sometimes causes crashes or hangs. This is especially problematic for TSan, which uses interceptors for OS-provided locks and mutexes, and even Libc functions use those.

This patch replaces forkpty with posix_spawn. Since posix_spawn doesn't fork (at least on Darwin), the interceptors are not a problem. Additionally, this also fixes a latent threading problem with ptsname (it's unsafe to use this function in multithreaded programs). Yet another benefit is that we'll handle post-fork failures (e.g. sandbox disallows "exec") gracefully now.

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

llvm-svn: 324846

6 years ago[X86] Update some required-vector-width.ll test cases to not pass 512-bit vectors...
Craig Topper [Sun, 11 Feb 2018 18:52:16 +0000 (18:52 +0000)]
[X86] Update some required-vector-width.ll test cases to not pass 512-bit vectors in arguments or return.

ABI for these would require 512 bits support so we don't want to test that.

llvm-svn: 324845

6 years ago[X86][SSE] Use SplitBinaryOpsAndApply to recognise PSUBUS patterns before they're...
Simon Pilgrim [Sun, 11 Feb 2018 17:29:42 +0000 (17:29 +0000)]
[X86][SSE] Use SplitBinaryOpsAndApply to recognise PSUBUS patterns before they're split on AVX1

This needs to be generalised further to support AVX512BW cases but I want to add non-uniform constants first.

llvm-svn: 324844

6 years ago[InstCombine] X / (X * Y) -> 1 / Y if the multiplication does not overflow
Sanjay Patel [Sun, 11 Feb 2018 17:20:32 +0000 (17:20 +0000)]
[InstCombine] X / (X * Y) -> 1 / Y if the multiplication does not overflow

The related cases for (X * Y) / X were handled in rL124487.

https://rise4fun.com/Alive/6k9

The division in these tests is subsequently eliminated by existing instcombines
for 1/X.

llvm-svn: 324843

6 years ago[X86] Use min/max for vector ult/ugt compares if avoids a sign flip.
Craig Topper [Sun, 11 Feb 2018 17:11:40 +0000 (17:11 +0000)]
[X86] Use min/max for vector ult/ugt compares if avoids a sign flip.

Summary:
Currently we only use min/max to help with ule/uge compares because it removes an invert of the result that would otherwise be needed. But we can also use it for ult/ugt compares if it will prevent the need for a sign bit flip needed to use pcmpgt at the cost of requiring an invert after the compare.

I also refactored the code so that the max/min code is self contained and does its own return instead of setting up a flag to manipulate the rest of the function's behavior.

Most of the test cases look ok with this. I did notice that we added instructions when one of the operands being sign flipped is a constant vector that we were able to constant fold the flip into.

I also noticed that sometimes the SSE min/max clobbers a register that is needed after the compare. This resulted in an extra move being inserted before the min/max to preserve the register. We could try to detect this and switch from min to max and change the compare operands to use the operand that gets reused in the compare.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 324842

6 years ago[X86][SSE] Moved SplitBinaryOpsAndApply earlier so more methods can use it. NFCI.
Simon Pilgrim [Sun, 11 Feb 2018 17:01:43 +0000 (17:01 +0000)]
[X86][SSE] Moved SplitBinaryOpsAndApply earlier so more methods can use it. NFCI.

llvm-svn: 324841

6 years ago[InstCombine] add tests for div-mul folds; NFC
Sanjay Patel [Sun, 11 Feb 2018 16:52:44 +0000 (16:52 +0000)]
[InstCombine] add tests for div-mul folds; NFC

The related cases for (X * Y) / X were handled in rL124487.

llvm-svn: 324840

6 years ago[TargetLowering] try to create -1 constant operand for math ops via demanded bits
Sanjay Patel [Sun, 11 Feb 2018 14:38:23 +0000 (14:38 +0000)]
[TargetLowering] try to create -1 constant operand for math ops via demanded bits

This reverses instcombine's demanded bits' transform which always tries to clear bits in constants.

As noted in PR35792 and shown in the test diffs:
https://bugs.llvm.org/show_bug.cgi?id=35792
...we can do better in codegen by trying to form -1. The x86 sub test shows a missed opportunity.

I did investigate changing instcombine's behavior, but it would be more work to change
canonicalization in IR. Clearing bits / shrinking constants can allow killing instructions,
so we'd have to figure out how to not regress those cases.

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

llvm-svn: 324839

6 years ago[X86] Add PR33747 test case
Simon Pilgrim [Sun, 11 Feb 2018 13:12:50 +0000 (13:12 +0000)]
[X86] Add PR33747 test case

llvm-svn: 324838

6 years ago[X86][SSE] Enable SMIN/SMAX/UMIN/UMAX custom lowering for all legal types
Simon Pilgrim [Sun, 11 Feb 2018 10:52:37 +0000 (10:52 +0000)]
[X86][SSE] Enable SMIN/SMAX/UMIN/UMAX custom lowering for all legal types

This allows us to recognise more saturation patterns and also simplify some MINMAX codegen that was failing to combine CMPGE comparisons to a legal CMPGT.

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

llvm-svn: 324837

6 years agofix test/CodeGen/X86/fixup-sfb.ll test failure after commit https://reviews.llvm...
Lama Saba [Sun, 11 Feb 2018 10:33:06 +0000 (10:33 +0000)]
fix test/CodeGen/X86/fixup-sfb.ll test failure after commit https://reviews.llvm.org/rL324835

Change-Id: I2526c2f342654e85ce054237de03ae9db9ab4994
llvm-svn: 324836

6 years ago[X86] Reduce Store Forward Block issues in HW
Lama Saba [Sun, 11 Feb 2018 09:34:12 +0000 (09:34 +0000)]
[X86] Reduce Store Forward Block issues in HW

If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Change-Id: I620b6dc91583ad9a1444591e3ddc00dd25d81748
llvm-svn: 324835

6 years ago[X86] Don't make 512-bit vectors legal when preferred vector width is 256 bits and...
Craig Topper [Sun, 11 Feb 2018 08:06:27 +0000 (08:06 +0000)]
[X86] Don't make 512-bit vectors legal when preferred vector width is 256 bits and 512 bits aren't required

This patch adds a new function attribute "required-vector-width" that can be set by the frontend to indicate the maximum vector width present in the original source code. The idea is that this would be set based on ABI requirements, intrinsics or explicit vector types being used, maybe simd pragmas, etc. The backend will then use this information to determine if its save to make 512-bit vectors illegal when the preference is for 256-bit vectors.

For code that has no vectors in it originally and only get vectors through the loop and slp vectorizers this allows us to generate code largely similar to our AVX2 only output while still enabling AVX512 features like mask registers and gather/scatter. The loop vectorizer doesn't always obey TTI and will create oversized vectors with the expectation the backend will legalize it. In order to avoid changing the vectorizer and potentially harm our AVX2 codegen this patch tries to make the legalizer behavior similar.

This is restricted to CPUs that support AVX512F and AVX512VL so that we have good fallback options to use 128 and 256-bit vectors and still get masking.

I've qualified every place I could find in X86ISelLowering.cpp and added tests cases for many of them with 2 different values for the attribute to see the codegen differences.

We still need to do frontend work for the attribute and teach the inliner how to merge it, etc. But this gets the codegen layer ready for it.

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

llvm-svn: 324834

6 years ago[X86] Remove setOperationAction lines for promoting vXi1 SINT_TO_FP/UINT_TO_FP.
Craig Topper [Sun, 11 Feb 2018 07:44:33 +0000 (07:44 +0000)]
[X86] Remove setOperationAction lines for promoting vXi1 SINT_TO_FP/UINT_TO_FP.

We promote these via a DAG combine now before lowering gets the chance.

Also remove the v2i1 custom handling since it will no longer be triggered.

llvm-svn: 324833

6 years ago[SelectionDAG] Remove TargetLowering::getConstTrueVal. Use SelectionDAG::getBoolConst...
Craig Topper [Sun, 11 Feb 2018 04:58:58 +0000 (04:58 +0000)]
[SelectionDAG] Remove TargetLowering::getConstTrueVal. Use SelectionDAG::getBoolConstant in the one place it was used.

SelectionDAG::getBoolConstant was recently introduced. At the time I didn't know getConstTrueVal existed, but I think getBoolConstant is better as it will use the source VT to make sure it can properly detect floating point if it is configured differently.

llvm-svn: 324832

6 years ago[X86] Remove some redundant qualifications from the setOperationAction blocks. NFC
Craig Topper [Sun, 11 Feb 2018 03:07:19 +0000 (03:07 +0000)]
[X86] Remove some redundant qualifications from the setOperationAction blocks. NFC

These were added as part of the refactoring for prefer vector width. At the time I thought the hasAVX512 here would be replaced with "allow 512 bit vectors" so that it would read "allow 512 bit vectors OR VLX". But now the plan is to only give the option of disabling 512 bit vectors when VLX is enabled. So we don't need this qualification at all

llvm-svn: 324831

6 years agoFixed extra ‘;’ warning
Galina Kistanova [Sun, 11 Feb 2018 02:32:21 +0000 (02:32 +0000)]
Fixed extra ‘;’ warning

llvm-svn: 324830

6 years ago[X86][SSE] Add SMIN/SMAX combine test
Simon Pilgrim [Sat, 10 Feb 2018 23:38:50 +0000 (23:38 +0000)]
[X86][SSE] Add SMIN/SMAX combine test

As discussed on D43014, we need the ability to flip SMIN/SMAX to (legal) UMIN/UMAX

llvm-svn: 324829

6 years ago[X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1...
Craig Topper [Sat, 10 Feb 2018 23:34:27 +0000 (23:34 +0000)]
[X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1 mask. Make bitcasts to scalar explicit in IR

Summary: This is the clang equivalent of r324827

Reviewers: zvi, delena, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 324828

6 years ago[X86] Change signatures of avx512 packed fp compare intrinsics to return a vXi1 mask...
Craig Topper [Sat, 10 Feb 2018 23:33:55 +0000 (23:33 +0000)]
[X86] Change signatures of avx512 packed fp compare intrinsics to return a vXi1 mask type to be closer to an fcmp.

Summary:
This patch changes the signature of the avx512 packed fp compare intrinsics to return a vXi1 vector and no longer take a mask as input. The casts to scalar type will now need to be explicit in the IR. The masking node will now be an explicit and in the IR.

This makes the intrinsic look much more similar to an fcmp instruction that we wish we could use for these but can't. We already use icmp instructions for integer compares.

Previously the lowering step of isel would turn the intrinsic into an X86 specific ISD node and a emit the masking nodes as well as some bitcasts. This means DAG combines can't see the vXi1 type until somewhat late, making it more difficult to combine out gpr<->mask transition sequences. By exposing the vXi1 type explicitly in the IR and initial SelectionDAG we give earlier DAG combines and even InstCombine the chance to see it and optimize it.

This should make any issues with gpr<->mask sequences the same between integer and fp. Meaning we only have to fix them once.

Reviewers: spatel, delena, RKSimon, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 324827