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

3012 Commits

Author SHA1 Message Date
David Blaikie
6bae49b565 PointerLikeTypeTraits: Standardize NumLowBitsAvailable on static constexpr rather than anonymous enum
This is (more?) usable by GDB pretty printers and seems nicer to write.

There's one tricky caveat that in C++14 (LLVM's codebase today) the
static constexpr member declaration is not a definition - so odr use of
this constant requires an out of line definition, which won't be
provided (that'd make all these trait classes more annoyidng/expensive
to maintain). But the use of this constant in the library implementation
is/should always be in a non-odr context - only two unit tests needed to
be touched to cope with this/avoid odr using these constants.

Based on/expanded from D72590 by Christian Sigg.
2020-01-16 15:30:50 -08:00
Warren Ristow
427b51913e SCC: Allow ReplaceNode to safely support insertion
If scc_iterator::ReplaceNode is inserting a new entry in the map,
rather than replacing an existing entry, the possibility of growing
the map could cause a failure.  This change safely implements the
insertion.

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D72469
2020-01-14 10:30:24 -08:00
Dmitri Gribenko
fa88faafeb Removed PointerUnion3 and PointerUnion4 aliases in favor of the variadic template 2020-01-14 18:56:29 +01:00
Kazushi (Jam) Marukawa
e69a383b47 [VE] Target stub for NEC SX-Aurora
Summary:
This patch registers the 've' target: the NEC SX-Aurora TSUBASA Vector Engine.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D69103
2020-01-09 11:17:35 +01:00
Ehud Katz
4b88f1f253 [APFloat] Fix checked error assert failures
`APFLoat::convertFromString` returns `Expected` result, which must be
"checked" if the LLVM_ENABLE_ABI_BREAKING_CHECKS preprocessor flag is
set.
To mark an `Expected` result as "checked" we must consume the `Error`
within.
In many cases, we are only interested in knowing if an error occured,
without the need to examine the error info. This is achieved, easily,
with the `errorToBool()` API.
2020-01-09 09:42:32 +02:00
Justin Hibbits
d361e6028d [PowerPC]: Add powerpcspe target triple subarch component
Summary:
This allows the use of '-target powerpcspe-unknown-linux-gnu' or
'powerpcspe-unknown-freebsd' to be used, instead of
'-target powerpc-unknown-linux-gnu -mspe'.

Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D72014
2020-01-08 19:10:53 -06:00
Fangrui Song
3cceefd641 [PowerPC][Triple] Use elfv2 on freebsd>=13 and linux-musl
Summary:
Every powerpc64le platform uses elfv2.

For powerpc64, the environments "elfv1" and "elfv2" were added for
FreeBSD ELFv1->ELFv2 migration in D61950.  FreeBSD developers have
decided to use OS versions to select ABI, and no one is relying on the
environments.

Also use elfv2 on powerpc64-linux-musl.

Users can always use -mabi=elfv1 and -mabi=elfv2 to override the default
ABI.

Reviewed By: adalava

Differential Revision: https://reviews.llvm.org/D72352
2020-01-07 11:40:56 -08:00
Ehud Katz
094f071eba [APFloat] Fix fusedMultiplyAdd when this equals to Addend
Up until now, the arguments to `fusedMultiplyAdd` are passed by
reference. We must save the `Addend` value on the beginning of the
function, before we modify `this`, as they may be the same reference.

To fix this, we now pass the `addend` parameter of `multiplySignificand`
by value (instead of by-ref), and have a default value of zero.

Fix PR44051.

Differential Revision: https://reviews.llvm.org/D70422
2020-01-07 08:45:18 +02:00
Fangrui Song
ce9eae4112 Add Triple::isX86()
Reviewed By: craig.topper, skan

Differential Revision: https://reviews.llvm.org/D72247
2020-01-06 15:51:02 -08:00
James Henderson
91705af363 [NFC] Fix trivial typos in comments
Reviewed By: jhenderson

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

Patch by Kazuaki Ishizaki.
2020-01-06 10:50:26 +00:00
Ehud Katz
c279732bd6 [APFloat] Add recoverable string parsing errors to APFloat
Implementing the APFloat part in PR4745.

Differential Revision: https://reviews.llvm.org/D69770
2020-01-06 10:09:01 +02:00
Brian Gesiak
7b40a57a5a [ADT] Fix FoldingSet documentation typos
* "If found then M with be non-NULL" should be "will be non-NULL".
* The documentation examples (1) and (2) declare and use a variable
  `MyNode *M`, but examples (3) and (4) switch midway to using a
  variable named `N`. Unify the examples to all use `M`.
* The examples demonstrate the use of member functions of
  `FoldingSet`, but (3) and (4) invoke these as if they were free
  functions. Modify them to call member functions on the `MyFoldingSet`
  object constructed in the code above example (1).
2019-12-27 21:27:59 -05:00
Daniel Sanders
c57301aa25 Revert "Temporarily Revert "[gicombiner] Add the MatchDag structure and parse instruction DAG's from the input""
This reverts commit e62e760f29567fe0841af870c65a4f8ef685d217.

The issue @uweigand raised should have been fixed by iterating over the
vector that owns the operand list data instead of the FoldingSet.

The MSVC issue raised by @thakis should have been fixed by relaxing the
regexes a little. I don't have a Windows machine available to test that so
I tested it by using `perl -p -e 's/0x([0-9a-f]+)/\U\1\E/g' to convert the
output of %p to the windows style.

I've guessed at the issue @phosek raised as there wasn't enough information
to investigate it. What I think is happening on that bot is the -debug
option isn't available because the second stage build is a release build.
I'm not sure why other release-mode bots didn't report it though.
2019-12-18 11:37:12 +00:00
Eric Christopher
3a4584f42c Temporarily Revert "[gicombiner] Add the MatchDag structure and parse instruction DAG's from the input"
and follow-on patches.

This is breaking a few build bots and local builds with follow-up already
on the patch thread.

This reverts commits 390c8baa5440dda8907688d9ef860f6982bd925f and
520e3d66e7257c77f1226185504bbe1cb90afcfa.
2019-12-17 16:23:29 -08:00
Daniel Sanders
67474bbe7f [gicombiner] Process the MatchDag such that every node is reachable from the roots
Summary:
When we build the walk across these DAG's we need to be able to reach every node
from the roots. Flip and traversal edges (so that use->def becomes def->uses)
that make nodes unreachable. Note that early on we'll just error out on these
flipped edges as def->uses edges are more complicated to match due to their
one->many nature.

Depends on D69077

Reviewers: volkan, bogner

Subscribers: llvm-commits
2019-12-17 17:03:24 +00:00
John McCall
77a4abe86e Add Optional::map. 2019-12-16 13:34:00 -05:00
Nikita Popov
baba8dd94a [ADT] Fix SmallDenseMap assertion with large InlineBuckets
Fixes issue encountered in D56362, where I tried to use a
SmallSetVector<Instruction*, 128> with an excessively large number
of inline elements. This triggers an "Must allocate more buckets
than are inline" assertion inside allocateBuckets() under certain
usage patterns.

The issue is as follows: The grow() method is used either to grow
the map, or to rehash it and remove tombstones. The latter is done
if the fraction of empty (non-used, non-tombstone) elements is
below 1/8. In this case grow() is invoked with the current number
of buckets.

This is currently incorrectly handled for dense maps using the small
rep. The current implementation will switch them over to the large
rep, which violates the invariant that the large rep is only used
if there are more than InlineBuckets buckets.

This patch fixes the issue by staying in the small rep and only
moving the buckets. An alternative, if we do want to switch to the
large rep in this case, would be to relax the assertion in
allocateBuckets().

Differential Revision: https://reviews.llvm.org/D56455
2019-12-11 21:41:14 +01:00
Ehud Katz
924a552b44 [APFloat] Prevent construction of APFloat with Semantics and FP value
Constructor invocations such as `APFloat(APFloat::IEEEdouble(), 0.0)`
may seem like they accept a FP (floating point) value, but the overload
they reach is actually the `integerPart` one, not a `float` or `double`
overload (which only exists when `fltSemantics` isn't passed).

This may lead to possible loss of data, by the conversion from `float`
or `double` to `integerPart`.

To prevent future mistakes, a new constructor overload, which accepts
any FP value and marked with `delete`, to prevent its usage.

Fixes PR34095.

Differential Revision: https://reviews.llvm.org/D70425
2019-12-04 12:02:04 +02:00
Roman Lebedev
1610cbae56 [APInt][PatternMatch] Add 'is non-positive' predicate
It will be useful for implementing the fold mentioned in
https://bugs.llvm.org/show_bug.cgi?id=44100#c4
2019-12-03 21:34:12 +03:00
Dávid Bolvanský
0fcaad5414 Reland 'Fixed -Wdeprecated-copy warnings. NFCI.'
Fixed hashtable copy ctor.
2019-11-23 23:09:39 +01:00
Dávid Bolvanský
0154fb24b2 Revert 'Fixed -Wdeprecated-copy warnings. NFCI.'
pdbutil's test is failing.
2019-11-23 21:31:27 +01:00
Dávid Bolvanský
3298e73cdd Fixed -Wdeprecated-copy warnings. NFCI. 2019-11-23 21:05:07 +01:00
Ehud Katz
96773fc887 [APFloat] Enlarge ExponentType to 32bit integer
Enlarge the size of ExponentType from 16bit integer to 32bit. This is
required to prevent exponent overflow/underflow.

Note that IEEEFloat size and alignment don't change in 64bit or 32bit
compilation targets (and in turn, neither does APFloat).

Fixes PR34851.

Differential Revision: https://reviews.llvm.org/D69771
2019-11-22 21:26:35 +02:00
Simon Pilgrim
d53b84ad2b Statistic - Fix MSVC shadow warning against global PrintOnExit static variable. NFC. 2019-11-21 12:08:01 +00:00
Reid Kleckner
ce03a2121f [ADT] Move to_vector from STLExtras.h to SmallVector.h
Nothing breaks, so this probably has zero impact, but it seems nice,
since to_vector is more like makeArrayRef, and should really live in
SmallVector.h.
2019-11-20 16:35:19 -08:00
Alex Lorenz
eeeffdc6ba [ADT][Expensive checks] Create a std::random_device seed only once when shuffling before sorting
This speeds up the build of compiler-rt with an expensive checks enabled clang by an order of
1 or 2 magnitudes on my machine. I was hoping this would also fix the 'large.test' libFuzzer
timeout on the expensive checks bot on green dragon http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/,
but the fuzzer test still takes too long to compile because of other IR/MIR verification inefficiencies.

Differential Revision: https://reviews.llvm.org/D70288
2019-11-19 11:07:58 -08:00
Matt Arsenault
00e1bbce35 Work on cleaning up denormal mode handling
Cleanup handling of the denormal-fp-math attribute. Consolidate places
checking the allowed names in one place.

This is in preparation for introducing FP type specific variants of
the denormal-fp-mode attribute. AMDGPU will switch to using this in
place of the current hacky use of subtarget features for the denormal
mode.

Introduce a new header for dealing with FP modes. The constrained
intrinsic classes define related enums that should also be moved into
this header for uses in other contexts.

The verifier could use a check to make sure the denorm-fp-mode
attribute is sane, but there currently isn't one.

Currently, DAGCombiner incorrectly asssumes non-IEEE behavior by
default in the one current user. Clang must be taught to start
emitting this attribute by default to avoid regressions when this is
switched to assume ieee behavior if the attribute isn't present.
2019-11-19 22:01:14 +05:30
Pavel Labath
8d1cc55d9b [cmake] Disable GCC 9's -Winit-list-lifetime warning in ArrayRef
Summary:
This is a new warning which fires when one stores a reference to the
initializer_list contents in a way which may outlive the
initializer_list which it came from. In llvm this warning is triggered
whenever someone uses the initializer_list ArrayRef constructor.

This is indeed a dangerous thing to do (I myself was bitten by that at
least once), but it is not more dangerous than calling other ArrayRef
constructors with temporary objects -- something which we are used to
and have accepted as a tradeoff for ArrayRef's efficiency.

Currently, this warnings generates so much output that it completely
obscures any actionable warnings, so this patch disables it.

Reviewers: rnk, aaron.ballman

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70122
2019-11-19 17:26:57 +01:00
czhengsz
151a0b69c7 [APInt] add wrap support for setBits and getBitsSet
Add two new interfaces getBitsSet and getBitsSetWithWrap

Reviewed by: lebedev.ri, craig.topper

Differential Revision: https://reviews.llvm.org/D69032
2019-11-19 03:57:48 -05:00
Cyndy Ishida
9adfe896d8 Fix iOSDarwin()'s doc comment.
Summary:
I saw the doc comment using the Option + Click in Xcode and I was
confused by the fact that tvOS wasn't listed. The method definition
also doesn't make it clear that the check for tvOS is taking place as
the tvOS check is hidden in the isiOS() check.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

This patch is from Varun Gandhi <varun_gandhi@apple.com>
2019-11-18 13:18:06 -08:00
Lang Hames
2b37eeb76e [ADT] Move drop_begin from iterator_range.h into STLExtras.
Summary:
drop_begin depends on adl_begin/adl_end, which are defined in STLExtras.h,
but we can't just #include STLExtras.h in iterator_range.h as that would
introduce a circular reference (STLExtras.h already depends on
iterator_range.h). The simplest solution is to move drop_begin into
STLExtras.h, which is a reasonable home for it anyway.

Reviewers: dblaikie

Subscribers: dexonsmith, ributzka, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70189
2019-11-14 08:10:59 -08:00
Reid Kleckner
bf08ccdd26 Revert "Forward declare Optional<T> in STLExtras.h"
This reverts commit a36f316390d4bc1bcb0e9de0f55831385ab24099.

I did not intend to push this with the InitializePasses.h change.
2019-11-13 16:36:21 -08:00
Reid Kleckner
965da96cbe Forward declare Optional<T> in STLExtras.h
WIP stats
2019-11-13 16:34:00 -08:00
Tsang Whitney W.H
7a28678422 [DirectedGraph]: Add setTargetNode member function
Summary:Add the setTargetNode member function to class DGEdge.
Authored By:etiotto
Reviewer:bmahjour, Whitney, jdoerfert, Meinersbur, fhahn, kbarton,
dmgreen
Reviewed By:Meinersbur
Subscribers:dexonsmith, kristina, llvm-commits
Tag:LLVM
Differential Revision:https://reviews.llvm.org/D68474
2019-11-11 03:36:23 +00:00
Simon Pilgrim
0b799a2c48 Twine - fix uninitialized variable warnings. NFCI. 2019-11-10 11:21:43 +00:00
bmahjour
d3fb929e1b [DDG] Data Dependence Graph - Pi Block
Summary:
    This patch adds Pi Blocks to the DDG. A pi-block represents a group of DDG
    nodes that are part of a strongly-connected component of the graph.
    Replacing all the SCCs with pi-blocks results in an acyclic representation
    of the DDG. For example if we have:
       {a -> b}, {b -> c, d}, {c -> a}
    the cycle a -> b -> c -> a is abstracted into a pi-block "p" as follows:
       {p -> d} with "p" containing: {a -> b}, {b -> c}, {c -> a}
    In this implementation the edges between nodes that are part of the pi-block
    are preserved. The crossing edges (edges where one end of the edge is in the
    set of nodes belonging to an SCC and the other end is outside that set) are
    replaced with corresponding edges to/from the pi-block node instead.

    Authored By: bmahjour

    Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert

    Reviewed By: Meinersbur

    Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack

    Tag: #llvm

    Differential Revision: https://reviews.llvm.org/D68827
2019-11-08 15:46:08 -05:00
Roman Lebedev
5eb53ddf94 [APInt] Add saturating truncation methods
Summary:
The signed one is needed for implementation of `ConstantRange::smul_sat()`,
unsigned is for completeness only.

Reviewers: nikic, RKSimon, spatel

Reviewed By: nikic

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69993
2019-11-08 17:52:43 +03:00
Simon Pilgrim
bb167ef549 Hashing - fix uninitialized variable warnings. NFCI. 2019-11-08 14:46:22 +00:00
Simon Pilgrim
6ac66de93f ImutAVLTree::validateTree - fix null dereference typo warning. NFCI.
Noticed by static analyzer.
2019-11-07 18:42:01 +00:00
Miloš Stojanović
1ac6de2765 [NFC][APInt] Fix typos in comments.
Testing git commit access.
2019-11-06 16:01:58 +01:00
Simon Pilgrim
f32861caf3 [APInt] Fix implicit truncation warning in bitsToFloat(). NFCI. 2019-11-06 12:30:04 +00:00
Yevgeny Rouban
a162363827 [ADT] Add equality operator for SmallPtrSet
Reviewed By: tellenbach
Differential Revision: https://reviews.llvm.org/D69429
2019-11-06 11:17:51 +07:00
Fedor Sergeev
106eaa30ed [ADT] add equality operator for SmallSet
Makes it easier to migrate existing code that uses std::set.

Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D69417
2019-10-29 17:33:57 -07:00
Simon Pilgrim
da968525d0 [BitVector] Define BitWord as uintptr_t
Define BitVector::BitWord as uintptr_t instead of unsigned long, as long does not necessarily translates to a pointer size (especially on 64-bit Visual Studio).

Committed on behalf of @ekatz (Ehud Katz)

Differential Revision: https://reviews.llvm.org/D69336
2019-10-29 13:53:04 +00:00
Simon Pilgrim
0f045592d7 [BitVector] Cast integer literals to BitWord [NFC]
Associate the integer literals with BitWord, instead of the embedded UL suffix.

Required for https://reviews.llvm.org/D69336.

Committed on behalf of @ekatz (Ehud Katz)

Differential Revision: https://reviews.llvm.org/D69357
2019-10-29 12:56:31 +00:00
Joerg Sonnenberger
c1dccf4cc8 Replace abort with llvm_unreachable.
The former depended on header pollution to be found and doesn't fit the
LLVM style of error handling.
2019-10-29 01:08:11 +01:00
Roman Lebedev
10b251e6c5 [APInt] Introduce APIntOps::GetMostSignificantDifferentBit()
Summary:
Compare two values, and if they are different, return the position of the
most significant bit that is different in the values.

Needed for D69387.

Reviewers: nikic, spatel, sanjoy, RKSimon

Reviewed By: nikic

Subscribers: xbolva00, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69439
2019-10-26 23:20:58 +03:00
Reid Kleckner
dbabe32386 Use __builtin_strlen in constexpr StringRef ctor with MSVC
MSVC supports it. Fixes the major MSVC compile time regression
introduced in r369961. Now
clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp compiles in 18s
instead of 7+ minutes.

Fixes PR43369
2019-10-25 15:53:54 -07:00
Roman Lebedev
992c28afd0 [APInt] Add saturating left-shift ops
Summary:
There are `*_ov()` functions already, so at least for consistency it may be good to also have saturating variants.
These may or may not be needed for `ConstantRange`'s `shlWithNoWrap()`

Reviewers: spatel, nikic

Reviewed By: nikic

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69398
2019-10-25 18:20:00 +03:00
Roman Lebedev
e17580f84d [APInt] Add saturating multiply ops
Summary:
There are `*_ov()` functions already, so at least for consistency it may be good to also have saturating variants.
These may or may not be needed for `ConstantRange`'s `mulWithNoWrap()`

Reviewers: spatel, nikic

Reviewed By: nikic

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69397
2019-10-25 18:19:54 +03:00