1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

3073 Commits

Author SHA1 Message Date
Serge Pavlov
4088931555 [FPEnv] Use single enum to represent rounding mode
Now compiler defines 5 sets of constants to represent rounding mode.
These are:

1. `llvm::APFloatBase::roundingMode`. It specifies all 5 rounding modes
defined by IEEE-754 and is used in `APFloat` implementation.

2. `clang::LangOptions::FPRoundingModeKind`. It specifies 4 of 5 IEEE-754
rounding modes and a special value for dynamic rounding mode. It is used
in clang frontend.

3. `llvm::fp::RoundingMode`. Defines the same values as
`clang::LangOptions::FPRoundingModeKind` but in different order. It is
used to specify rounding mode in in IR and functions that operate IR.

4. Rounding mode representation used by `FLT_ROUNDS` (C11, 5.2.4.2.2p7).
Besides constants for rounding mode it also uses a special value to
indicate error. It is convenient to use in intrinsic functions, as it
represents platform-independent representation for rounding mode. In this
role it is used in some pending patches.

5. Values like `FE_DOWNWARD` and other, which specify rounding mode in
library calls `fesetround` and `fegetround`. Often they represent bits
of some control register, so they are target-dependent. The same names
(not values) and a special name `FE_DYNAMIC` are used in
`#pragma STDC FENV_ROUND`.

The first 4 sets of constants are target independent and could have the
same numerical representation. It would simplify conversion between the
representations. Also now `clang::LangOptions::FPRoundingModeKind` and
`llvm::fp::RoundingMode` do not contain the value for IEEE-754 rounding
direction `roundTiesToAway`, although it is supported natively on
some targets.

This change defines all the rounding mode type via one `llvm::RoundingMode`,
which also contains rounding mode for IEEE rounding direction `roundTiesToAway`.

Differential Revision: https://reviews.llvm.org/D77379
2020-04-09 13:26:47 +07:00
Eli Friedman
db20f1e2c5 Remove "mask" operand from shufflevector.
Instead, represent the mask as out-of-line data in the instruction. This
should be more efficient in the places that currently use
getShuffleVector(), and paves the way for further changes to add new
shuffles for scalable vectors.

This doesn't change the syntax in textual IR. And I don't currently plan
to change the bitcode encoding in this patch, although we'll probably
need to do something once we extend shufflevector for scalable types.

I expect that once this is finished, we can then replace the raw "mask"
with something more appropriate for scalable vectors.  Not sure exactly
what this looks like at the moment, but there are a few different ways
we could handle it.  Maybe we could try to describe specific shuffles.
Or maybe we could define it in terms of a function to convert a fixed-length
array into an appropriate scalable vector, using a "step", or something
like that.

Differential Revision: https://reviews.llvm.org/D72467
2020-03-31 13:08:59 -07:00
Ehud Katz
b99248f3f0 [ADT] Implement the Waymarking as an independent utility
This is the Waymarking algorithm implemented as an independent utility.
The utility is operating on a range of sequential elements.
First we "tag" the elements, by calling `fillWaymarks`.
Then we can "follow" the tags from every element inside the tagged
range, and reach the "head" (the first element), by calling
`followWaymarks`.

Differential Revision: https://reviews.llvm.org/D74415
2020-03-31 17:08:24 +03:00
Sam Clegg
7e969f4e53 [ADT] Allow empty string in StringSet
Also add a test case to wasm-ld that asserts without this change.
Internally wasm-ld builds a StringMap of exported functions and it seems
like allowing empty string in the set is preferable to adding checks.

This assert looks like it was most likely just a historical accident.
It started life here purely to support InputLanguagesSet:

  eeac27e38c5c567d63bbfa5410620d955696491b

Then got extracted here:

  e57a4033385c5976cbb17af1e962b1224a61183b

Then got moved to AST here

  5c48bae209bcbd261886f63abac695b1e30544e6

With the `InLang` paramater name still intact which suggested is
InputLanguagesSet origins.

Differential Revision: https://reviews.llvm.org/D74589
2020-03-30 12:59:34 -07:00
Nikita Popov
51f95f57fa [PostOrderIterator] Use SmallVector to store stack; NFC
We use a SmallPtrSet to track visited nodes, use a SmallVector
of the same size for the stack.
2020-03-29 14:29:02 +02:00
Benjamin Kramer
1c3423f774 [ADT] Automatically forward llvm::sort to array_pod_sort if safe
This is safe if the iterator type is a pointer and the comparator is
stateless. The enable_if pattern I'm adding here only uses
array_pod_sort for the default comparator (std::less).

Using array_pod_sort has a potential performance impact, but I didn't
notice anything when testing clang. Sorting doesn't seem to be on the
hot path anywhere in LLVM.

Shrinks Release+Asserts clang by 73k.
2020-03-28 20:20:14 +01:00
David Blaikie
5704836e92 FunctionRef: Strip cv qualifiers in the converting constructor
Without this some instances of copy construction would use the
converting constructor & lead to the destination function_ref referring
to the source function_ref instead of the underlying functor.

Discovered in feedback from 857bf5da35af8e1f9425e1865dab5f5fce5e38f2

Thanks to Johannes Doerfert, Arthur O'Dwyer, and Richard Smith for the
discussion and debugging.
2020-03-27 16:31:58 -07:00
Sam McCall
61629ee475 Add BitWidth trait to BitmaskEnum, and use for clang DependenceFlags. NFC
Reviewers: hokein

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76942
2020-03-27 22:40:21 +01:00
Simon Pilgrim
acfaaa28b9 Revert rGa3c715e9788d829031989b0a5ea4eb43c7288be9 "Twine - fix uninitialized variable warnings. NFCI."
@dblaikie noticed that this may interfere with msan analysis
2020-03-27 11:44:04 +00:00
David Blaikie
a7f9ea705a Make llvm::function_ref's operator bool explicit
This can avoid all sorts of mistakes with implicit conversion
(indirectly) to int, etc. I'm quite surprise there aren't any things to
fixup with this - but I guess most uses of function_ref aren't
optional/nullable.
2020-03-26 20:09:57 -07:00
Ties Stuij
74a8dfdced [PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support
Summary:
This patch introduces command-line support for the Armv8.6-a architecture and assembly support for BFloat16. Details can be found
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

in addition to the GCC patch for the 8..6-a CLI:
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg02647.html

In detail this patch

- march options for armv8.6-a
- BFloat16 assembly

This is part of a patch series, starting with command-line and Bfloat16
assembly support. The subsequent patches will upstream intrinsics
support for BFloat16, followed by Matrix Multiplication and the
remaining Virtualization features of the armv8.6-a architecture.

Based on work by:
- labrinea
- MarkMurrayARM
- Luke Cheeseman
- Javed Asbar
- Mikhail Maltsev
- Luke Geeson

Reviewers: SjoerdMeijer, craig.topper, rjmccall, jfb, LukeGeeson

Reviewed By: SjoerdMeijer

Subscribers: stuij, kristof.beyls, hiraditya, dexonsmith, danielkiss, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D76062
2020-03-26 09:17:20 +00:00
Yaxun (Sam) Liu
501520a697 Add Triple::isAMDGPU
Differential Revision: https://reviews.llvm.org/D57707
2020-03-22 14:20:28 -04:00
Ehud Katz
adea146bf8 Revert "[ADT] Implement the Waymarking as an independent utility"
This reverts commit 73cf8abbe695aede9aac804f960513bb7355004a.
2020-03-21 22:47:17 +02:00
Ehud Katz
c23ba21e86 [ADT] Implement the Waymarking as an independent utility
This is the Waymarking algorithm implemented as an independent utility.
The utility is operating on a range of sequential elements.
First we "tag" the elements, by calling `fillWaymarks`.
Then we can "follow" the tags from every element inside the tagged
range, and reach the "head" (the first element), by calling
`followWaymarks`.

Differential Revision: https://reviews.llvm.org/D74415
2020-03-21 14:30:32 +02:00
Simon Pilgrim
df09235ad5 Revert rGd5d8569df14e95e2c53d167bd1b37995bcbec565 "Fix static analysis warnings about classes with virtual methods not having virtual destructors"
This reverts commit d5d8569df14e95e2c53d167bd1b37995bcbec565.
2020-03-21 11:39:34 +00:00
Simon Pilgrim
64102f02b9 Fix static analysis warnings about classes with virtual methods not having virtual destructors 2020-03-21 11:30:44 +00:00
Vedant Kumar
5f49ad1d16 [ADT] CoalescingBitVector: Add advanceToLowerBound iterator operation
advanceToLowerBound moves an iterator to the first bit set at, or after,
the given index. This can be faster than doing IntervalMap::find.

rdar://60046261

Differential Revision: https://reviews.llvm.org/D76466
2020-03-20 12:18:26 -07:00
Vedant Kumar
c1c993b3e8 [ADT] CoalescingBitVector: Avoid initial heap allocation, NFC
Avoid making a heap allocation when constructing a CoalescingBitVector.

This reduces time spent in LiveDebugValues when compiling sqlite3 by
700ms (0.5% of the total User Time).

rdar://60046261

Differential Revision: https://reviews.llvm.org/D76465
2020-03-20 12:18:25 -07:00
Tyker
eda3bf5428 [NFC] Add filters to hasNItems and hasNItemsOrMore
Reviewers: lebedev.ri, jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74967
2020-03-12 10:10:21 +01:00
Jay Foad
aae88c4b45 [APFloat] Make use of new overloaded comparison operators. NFC.
Reviewers: ekatz, spatel, jfb, tlively, craig.topper, RKSimon, nikic, scanon

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, dexonsmith, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75744
2020-03-06 16:42:53 +00:00
Jay Foad
a60e6b0428 [APFloat] Overload comparison operators
Summary:
These implement the usual IEEE-style floating point comparison
semantics, e.g. +0.0 == -0.0 and all operators except != return false
if either argument is NaN.

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, dexonsmith, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75237
2020-03-06 16:42:53 +00:00
Jay Foad
7fd61457ea [APFloat] Overload unary operator-
Summary:
We already have overloaded binary arithemetic operators so you can write
A+B etc. This patch lets you write -A instead of neg(A).

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75236
2020-03-06 09:11:38 +00:00
Matt Arsenault
7b8e05d66e Add constexpr to DenormalMode constructors
This will allow their use in member initializers in a future commit.
2020-03-04 18:46:46 -05:00
Stefanos Baziotis
9b680a0a2c [ADT][NFC] SCCIterator: Change hasLoop() to hasCycle() 2020-03-01 19:17:21 +02:00
Simon Pilgrim
3cec35fc47 Fix Wdocumentation warning - use tparam for template parameters. NFC. 2020-02-29 19:25:02 +00:00
Reid Kleckner
d32bedafdb [ADT] Allow K to be incomplete during DenseMap<K*, V> instantiation
DenseMap requires two sentinel values for keys: empty and tombstone
values. To avoid undefined behavior, LLVM aligns the two sentinel
pointers to alignof(T). This requires T to be complete, which is
needlessly restrictive.

Instead, assume that DenseMap pointer keys have a maximum alignment of
4096, and use the same sentinel values for all pointer keys. The new
sentinels are:
  empty:     static_cast<uintptr_t>(-1) << 12
  tombstone: static_cast<uintptr_t>(-2) << 12

These correspond to the addresses of -4096 and -8192. Hopefully, such a
key is never inserted into a DenseMap.

I encountered this while looking at making clang's SourceManager not
require FileManager.h, but it has several maps keyed on classes defined
in FileManager.h. FileManager depends on various LLVM FS headers, which
cumulatively take ~200ms to parse, and are generally not needed.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D75301
2020-02-28 14:24:04 -08:00
Vedant Kumar
dfa1bc247b [ADT] Add CoalescingBitVector, implemented using IntervalMap [1/3]
Add CoalescingBitVector to ADT. This is part 1 of a 3-part series to
address a compile-time explosion issue in LiveDebugValues.

---

CoalescingBitVector is a bitvector that, under the hood, relies on an
IntervalMap to coalesce elements into intervals.

CoalescingBitVector efficiently represents sets which predominantly
contain contiguous ranges (e.g.  the VarLocSets in LiveDebugValues,
which are very long sequences that look like {1, 2, 3, ...}). OTOH,
CoalescingBitVector isn't good at representing sets with lots of gaps
between elements. The first N coalesced intervals of set bits are stored
in-place (in the initial heap allocation).

Compared to SparseBitVector, CoalescingBitVector offers more predictable
performance for non-sequential find() operations. This provides a
crucial speedup in LiveDebugValues.

Differential Revision: https://reviews.llvm.org/D74984
2020-02-27 12:39:46 -08:00
Dan Gohman
2fd062d2cd [WebAssembly] Add an isWasm target triple predicate.
This simplies code which needs to apply the same logic to both wasm32
and wasm64.

This patch is part of https://reviews.llvm.org/D70700.
2020-02-27 07:55:01 -08:00
Rafael Ávila de Espíndola
8263acd297 Add a llvm::shuffle and use it in lld
With this --shuffle-sections=seed produces the same result in every
host.

Reviewed By: grimar, MaskRay

Differential Revision: https://reviews.llvm.org/D74971
2020-02-22 10:05:29 -08:00
David Tenty
d8d2de7471 [clang][XCOFF] Indicate that XCOFF does not support COMDATs
Summary: XCOFF doesn't support COMDATs, so clang shouldn't emit them.

Reviewers: stevewan, sfertile, Xiangling_L

Reviewed By: sfertile

Subscribers: dschuff, aheejin, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D74631
2020-02-18 16:10:11 -05:00
Benjamin Kramer
d4a80f2ae0 [ADT] Use inherited ctors to forward to base. NFCI. 2020-02-17 14:39:15 +01:00
Alexandre Ganea
047de94911 [ADT] Support BitVector as a key in DenseSet/Map
This patch adds DenseMapInfo<> support for BitVector and SmallBitVector.

This is part of https://reviews.llvm.org/D71775, where a BitVector is used as a thread affinity mask.
2020-02-14 10:24:22 -05:00
Vladimir Vereschaka
4bc72f1985 Revert "Replace std::foo with std::foo_t in LLVM."
This reverts commit a4384c756bd8a819051009b5b273b2a34be8261b.

These changes break LLVM build on Windows builders.

See https://reviews.llvm.org/rGa4384c756bd8a819051009b5b273b2a34be8261b
for details.
2020-02-12 20:54:21 -08:00
Caroline Lebar
7f726c91e2 Replace std::foo with std::foo_t in LLVM.
This patch is replacements missed in my last change doing this across LLVM.

No functional change, although I think there was a missing typename
in struct conjunction that is now fixed.
2020-02-12 16:14:36 -08:00
Justin Lebar
c138400f22 Fix SFINAE in llvm::bit_cast.
Summary:
As far as I can tell, the SFINAE was broken; there is no such thing as
std::is_trivially_constructible<T>::type.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74380
2020-02-12 08:26:10 -08:00
Justin Lebar
e09056c560 Fix compilation of Any.h header.
In a previous patch I changed `std::decay<T>::type` to `std::decay<T>`
rather than `std::decay_t<T>`.  This seems to have broken the build
*only for clang-cl*.  I don't know why.

Submitting with post-commit review because this is an obvious fix for a
build breakage and we've verified that it fixes the breakage.
2020-02-12 08:25:14 -08:00
Ehud Katz
fb68d59e9f [APFloat] Fix FP remainder operation
Reimplement IEEEFloat::remainder() function.

Fix PR3359.

Differential Revision: https://reviews.llvm.org/D69776
2020-02-12 10:42:55 +02:00
Justin Lebar
0e4d775a3f Use std::foo_t rather than std::foo in LLVM.
Summary: C++14 migration. No functional change.

Reviewers: bkramer, JDevlieghere, lebedev.ri

Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D74384
2020-02-11 15:12:51 -08:00
Justin Lebar
b77224b68f Use C++14-style return type deduction in LLVM.
Summary:
Simplifies the C++11-style "-> decltype(...)" return-type deduction.

Note that you have to be careful about whether the function return type
is `auto` or `decltype(auto)`.  The difference is that bare `auto`
strips const and reference, just like lambda return type deduction.  In
some cases that's what we want (or more likely, we know that the return
type is a value type), but whenever we're wrapping a templated function
which might return a reference, we need to be sure that the return type
is decltype(auto).

No functional change.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74383
2020-02-11 07:38:42 -08:00
Hans Wennborg
477faeef90 Try to fix ilist.h after 529e6f8791b6 2020-02-06 12:33:44 +01:00
Hans Wennborg
a388be5b5d StringRef.h: __builtin_strlen seems to exist in VS 2017 MSVC 19.16 or later
This is a follow-up to ff837aa63cd, as discussed on the llvm-commits
thread for that one.
2020-02-06 12:33:44 +01:00
Simon Pilgrim
317267c8fd [ADT] Fix iplist_impl - use after move warnings (PR43943)
As detailed on PR43943, we're seeing static analyzer use after move warnings in the iplist_impl move constructor/operator as they call std::move to both the TraitsT and IntrusiveListT base classes.

As suggested by @dexonsmith this patch casts the moved value to the base classes to silence the warnings.

Differential Revision: https://reviews.llvm.org/D74062
2020-02-06 11:22:21 +00:00
Hans Wennborg
b854393fbf Fix some typos in ArrayRef.h 2020-02-06 09:34:29 +01:00
Matt Arsenault
5025270c03 Try to fix buildbot failure 2020-02-04 13:12:46 -05:00
Matt Arsenault
0e9ab3b9f6 Separately track input and output denormal mode
AMDGPU and x86 at least both have separate controls for whether
denormal results are flushed on output, and for whether denormals are
implicitly treated as 0 as an input. The current DAGCombiner use only
really cares about the input treatment of denormals.
2020-02-04 12:59:21 -05:00
Hans Wennborg
494b532127 Actually, don't try to use __builtin_strlen in StringRef.h before VS 2019
The fix in b3d7d1061dc375bb5ea725e6597382fcd37f41d6 compiled nicely,
but didn't link because at least the VS 2017 version I use doesn't
have the builtin yet. Instead, make use of the builtin with MSVC
conditional on VS 2019 or later.
2020-02-03 17:49:29 +01:00
Hans Wennborg
41105ccc60 Declare __builtin_strlen in StringRef.h as constexpr
Otherwise Visual Studio 2017 will complain about
llvm::StringRef::strlen not being constexpr:

  StringRef.h(80): error C3615: constexpr function 'llvm::StringRef::strLen' cannot result in a constant expression
  StringRef.h(84): note: failure was caused by call of undefined function or one not declared 'constexpr'
2020-02-03 16:58:01 +01:00
Johannes Doerfert
f0f6b46554 [OpenMP][Part 1] Reusable OpenMP context/traits handling
This is the first of multiple parts to make OpenMP context/trait
handling reusable and generic. This patch was originally part of D71830
but with the unit tests it can be tested independently.

This patch implements an almost complete handling of OpenMP
contexts/traits such that we can reuse most of the logic in Flang
through the OMPContext.{h,cpp} in llvm/Frontend/OpenMP.

All but construct SIMD specifiers, e.g., inbranch, and the device ISA
selector are define in llvm/lib/Frontend/OpenMP/OMPKinds.def. From
these definitions we generate the enum classes TraitSet,
TraitSelector, and TraitProperty as well as conversion and helper
functions in llvm/lib/Frontend/OpenMP/OMPContext.{h,cpp}.

The OpenMP context is now an explicit object (see `struct OMPContext`).
This is in anticipation of construct traits that need to be tracked. The
OpenMP context, as well as the VariantMatchInfo, are basically made up
of a set of active or respectively required traits, e.g., 'host', and an
ordered container of constructs which allows duplication. Matching and
scoring is kept as generic as possible to allow easy extension in the
future.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D71847
2020-02-02 23:18:25 -06:00
Brian Gesiak
7fa671ec47 [ADT] 'PointerUnion::is' returns 'bool'
Summary:
The return type of 'PointerUnion::is' has been 'int' since it was first
added in March 2009, in SVN r67987, or
https://github.com/llvm/llvm-project/commit/a9c6de15fb3.

The only other change to this member function was a clang-format applied
in December 2015, in SVN r256513, or
https://github.com/llvm/llvm-project/commit/548a49aacc0.

However, since the return value is the result of a `==` comparison, an
implicit cast must be made converting the boolean result to an `int`.
Change the return type to `bool` to remove the need for such a cast.

Test Plan:
I ran llvm-project `check-all` under ASAN, no failures were reported
(other than obviously unrelated tests that were already failing in
ASAN buildbots).

Reviewers: gribozavr, gribozavr2, rsmith, bkramer, dblaikie

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73836
2020-02-01 16:50:20 -05:00
Reid Kleckner
10818e3b15 Move DenseMapInfo traits to TypeSize.h
Saves 2427 unneeded includes of TypeSize.h, which instantiates
std::tie<uint64_t, bool>, which instantiates std::tuple<uint64_t, bool>,
which is slow.

I'll remove the tie in a follow-up, since it's just for operator==.
2020-01-31 16:50:11 -08:00