1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
Commit Graph

209717 Commits

Author SHA1 Message Date
Mircea Trofin
81706d6547 [NFC] Disallow unused prefixes under MC/RISCV
Differential Revision: https://reviews.llvm.org/D94836
2021-01-15 16:21:30 -08:00
Derek Schuff
89e4eef882 Revert "[WebAssembly] MC layer writes table symbols to object files"
This reverts commit e9f1ed2306b1b3aedcb1acef2b50e252a77a04b9.

Reverting because it depends on 38dfce706f
2021-01-15 15:50:22 -08:00
Dávid Bolvanský
6682491496 [SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument
Example:

```
__attribute__((nonnull,noinline)) char * pinc(char *p)  {
  return ++p;
}

char * foo(bool b, char *a) {
       return pinc(b ? 0 : a);

}
```

optimize to

```
char * foo(bool b, char *a) {
       return pinc(a);

}
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94180
2021-01-15 23:53:43 +01:00
Vladislav Vinogradov
3d786653b8 [ADT][Support] Fix C4146 error from MSVC
Unary minus operator applied to unsigned type, result still unsigned.

Use `~0U` instead of `-1U` and `1 + ~VAL` instead of `-VAL`.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D94417
2021-01-15 14:34:14 -08:00
Amara Emerson
fd9f6bd39c [AArch64][GlobalISel] Select immediate fcmp if the zero is on the LHS. 2021-01-15 14:31:39 -08:00
Duncan P. N. Exon Smith
d845ab560b Revert "Revert "ADT: Fix reference invalidation in SmallVector...""
This reverts commit 33be50daa9ce1074c3b423a4ab27c70c0722113a,
effectively reapplying:

- 260a856c2abcef49c7cb3bdcd999701db3e2af38
- 3043e5a5c33c4c871f4a1dfd621a8839f9a1f0b3
- 49142991a685bd427d7e877c29c77371dfb7634c

... with a fix to skip a call to `SmallVector::isReferenceToStorage()`
when we know the parameter had been taken by value for small, POD-like
`T`. See https://reviews.llvm.org/D93779 for the discussion on the
revert.

At a high-level, these commits fix reference invalidation in
SmallVector's push_back, append, insert (one or N), and resize
operations. For more details, please see the original commit messages.

This commit fixes a bug that crept into
`SmallVectorTemplateCommon::reserveForAndGetAddress()` during the review
process after performance analysis was done. That function is now called
`reserveForParamAndGetAddress()`, clarifying that it only works for
parameter values. It uses that knowledge to bypass
`SmallVector::isReferenceToStorage()` when `TakesParamByValue`. This is
`constexpr` and avoids adding overhead for "small enough", trivially
copyable `T`.

Performance could potentially be tuned further by increasing the
threshold for `TakesParamByValue`, which is currently defined as:
```
bool TakesParamByValue = sizeof(T) <= 2 * sizeof(void *);
```
in the POD-like version of SmallVectorTemplateBase (else, `false`).

Differential Revision: https://reviews.llvm.org/D94800
2021-01-15 14:27:48 -08:00
Sanjay Patel
7fe9e5078b [SLP] remove dead code in reduction matching; NFC
To get into this block we had: !A || B || C
and we checked C in the first 'if' clause
leaving !A || B. But the 2nd 'if' is checking:
A && !B --> !(!A || B)
2021-01-15 17:03:26 -05:00
Nick Desaulniers
3160d09d4e BreakCriticalEdges: do not split the critical edge from a CallBr indirect successor
Otherwise we'll fail the assertion in SplitBlockPredecessors() related
to splitting the edges from CallBr's.

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1161
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1252

Reviewed By: void, MaskRay, jyknight

Differential Revision: https://reviews.llvm.org/D88438
2021-01-15 13:51:47 -08:00
Roman Lebedev
79593946d7 [SimplifyCFG] switchToSelect(): don't forget to insert DomTree edge iff needed
DestBB might or might not already be a successor of SelectBB,
and it wasn't we need to ensure that we record the fact in DomTree.

The testcase used to crash in lazy domtree updater mode + non-per-function
domtree validity checks disabled.
2021-01-15 23:35:57 +03:00
Roman Lebedev
492a2d1bf2 [SimplifyCFG][BasicBlockUtils] Port SplitBlockPredecessors()/SplitLandingPadPredecessors() to DomTreeUpdater
This is not nice, but it's the best transient solution possible,
and is better than just duplicating the whole function.

The problem is, this function is widely used,
and it is not at all obvious that all the users
could be painlessly switched to operate on DomTreeUpdater,
and somehow i don't feel like porting all those users first.

This function is one of last three that not operate on DomTreeUpdater.
2021-01-15 23:35:56 +03:00
Roman Lebedev
09671c5647 [SimplifyCFG] Port SplitBlockAndInsertIfThen() to DomTreeUpdater
This is not nice, but it's the best transient solution possible,
and is better than just duplicating the whole function.

The problem is, this function is widely used,
and it is not at all obvious that all the users
could be painlessly switched to operate on DomTreeUpdater,
and somehow i don't feel like porting all those users first.

This function is one of last three that not operate on DomTreeUpdater.
2021-01-15 23:35:56 +03:00
Roman Lebedev
203773f989 [Utils][SimplifyCFG] Port SplitBlock() to DomTreeUpdater
This is not nice, but it's the best transient solution possible,
and is better than just duplicating the whole function.

The problem is, this function is widely used,
and it is not at all obvious that all the users
could be painlessly switched to operate on DomTreeUpdater,
and somehow i don't feel like porting all those users first.

This function is one of last three that not operate on DomTreeUpdater.
2021-01-15 23:35:56 +03:00
Roman Lebedev
a3c98e219e [Utils] splitBlockBefore() always operates on DomTreeUpdater, so take it, not DomTree
Even though not all it's users operate on DomTreeUpdater,
it itself internally operates on DomTreeUpdater,
so it must mean everything is fine with that,
so just do that globally.
2021-01-15 23:35:56 +03:00
Roman Lebedev
830eac616c [NFC][SimplifyCFG] Add testcase showing that we fail to preserve DomTree in switchToSelect() 2021-01-15 23:35:55 +03:00
Reid Kleckner
0b284f3729 Revert "[BasicAA] Handle recursive queries more efficiently"
This reverts commit a3904cc77f181cff7355357688edfc392a236f5d.
It causes the compiler to crash while building Harfbuzz for ARM in
Chromium, reduced reproducer forthcoming:
https://crbug.com/1167305
2021-01-15 12:29:57 -08:00
Sanjay Patel
8de34477a1 [SLP] remove unused reduction functions; NFC
These were made obsolete by simplifying the code in recent patches.
2021-01-15 14:59:33 -05:00
Craig Topper
c1ee16cbaa [CodeGen] Removes unwanted optimisation for TargetConstantFP
This 'FIXME' popped up in the development of an out-of-tree backend.
Quick fix, but first llvm upstream patch, therefore I do not have commit rights, so if approved please commit?

- Test is not included as this came up in an out-of-tree backend (if required, please hint on how to test this).

Patch by simveg (Simon)

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D93219
2021-01-15 11:52:53 -08:00
Craig Topper
331e5e4187 [RISCV] Add implementation of targetShrinkDemandedConstant to optimize AND immediates.
SimplifyDemandedBits can remove set bits from immediates from instructions
like AND/OR/XOR. This can prevent them from being efficiently
codegened on RISCV.

This adds an initial version that tries to keep or form 12 bit
sign extended immediates for AND operations to enable use of ANDI.
If that doesn't work we'll try to create a 32 bit sign extended immediate
to use LUI+ADDIW.

More optimizations are possible for different size immediates or
different operations. But this is a good starting point that already
has test coverage.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D94628
2021-01-15 11:14:14 -08:00
Jessica Paquette
2d7fe6a565 [MIPatternMatch] Add m_OneNonDBGUse
Add a matcher that checks if the given subpattern has only one non-debug use.

Also improve existing m_OneUse testcase.

Differential Revision: https://reviews.llvm.org/D94705
2021-01-15 10:18:46 -08:00
David Green
652806af9c [ARM] Tail predication with constant loop bounds
The TripCount for a predicated vector loop body will be
ceil(ElementCount/Width). This alters the conversion of an
active.lane.mask to a VCPT intrinsics to match.

Differential Revision: https://reviews.llvm.org/D94608
2021-01-15 18:17:31 +00:00
David Green
179a18e97b [ARM] Constant tripcount tail predication loop tests. NFC 2021-01-15 18:02:07 +00:00
Craig Topper
6ca12b7100 [TargetLowering] Don't speculatively call ComputeNumSignBits. NFC
These methods are recursive so a little costly.

We only look at the result in one place in this function and it's
conditional. We also only need the second call if the first had
enough returned enough sign bits.
2021-01-15 09:09:35 -08:00
Simon Pilgrim
af7839a428 [X86][SSE] Attempt to fold shuffle(binop(),binop()) -> binop(shuffle(),shuffle())
If this will help us fold shuffles together, then push the shuffle through the merged binops.

Ideally this would be performed in DAGCombiner::visitVECTOR_SHUFFLE but getting an efficient+legal merged shuffle can be tricky - on SSE we can be confident that for 32/64-bit elements vectors shuffles should easily fold.
2021-01-15 16:25:25 +00:00
Sam Tebbs
2130c92201 [ARM][Block placement] Check the predecessor exists before processing it
Not all machine loops will have a predecessor. so the pass needs to
check it before continuing.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D94780
2021-01-15 15:45:13 +00:00
Michael Munday
0648d8efb7 [RISCV][NFC] Fix order of parameters in cmov ge/le tests
The first parameter should be selected if the condition is true and
the last parameter if the condition is false. Prior to this change
it was the other way round which was confusing.

Differential Revision: https://reviews.llvm.org/D94729
2021-01-15 15:35:13 +00:00
Simon Pilgrim
53f4f7d6c1 [DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - improve shuffle(shuffle(x,y),shuffle(x,y)) merging
MergeInnerShuffle currently attempts to merge shuffle(shuffle(x,y),z) patterns into a single shuffle, using 1 or 2 of the x,y,z ops.

However if we already match 2 ops we might be able to handle the third op if its also a shuffle that references one of the previous ops, allowing us to handle some cases like:

shuffle(shuffle(x,y),shuffle(x,y))
shuffle(shuffle(shuffle(x,z),y),z)
shuffle(shuffle(x,shuffle(x,y)),z)
etc.

This isn't an exhaustive match and is dependent on the order the candidate ops are encountered - if one of the matched ops was a shuffle that was peek-able we don't go back and try to split that, I haven't found much need for that amount of analysis yet.

This is a preliminary patch that will allow us to later improve x86 HADD/HSUB matching - but needs to be reviewed separately as its in generic code and affects existing Thumb2 tests.

Differential Revision: https://reviews.llvm.org/D94671
2021-01-15 15:08:31 +00:00
Jamie Schmeiser
6203d3aa8a Set option default for enabling memory ssa for new pass manager loop sink pass to true.
Summary:
Set the default for the option enabling memory ssa use in the loop sink
pass to true for the new pass manager.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea)
Differential Revision: https://reviews.llvm.org/D92486
2021-01-15 09:56:44 -05:00
Simon Pilgrim
5ae0f73fee [X86] Add umin knownbits/demandedbits ult test for D94532 2021-01-15 14:42:55 +00:00
Stephan Herhut
eb94ce849b [SVE] Fix unused variable.
Introduced by [SVE] Restrict the usage of REINTERPRET_CAST.

Differential Revision: https://reviews.llvm.org/D94773
2021-01-15 15:10:33 +01:00
Sam Tebbs
c433dd3e09 [ARM] Don't run the block placement pass at O0
The block placement pass shouldn't run unless optimisations are enabled.

Differential Revision: https://reviews.llvm.org/D94691
2021-01-15 13:59:29 +00:00
Andy Wingo
29cfe36e3d [WebAssembly] MC layer writes table symbols to object files
Now that the linker handles table symbols, we can allow the frontend to
produce them.

Depends on D91870.

Differential Revision: https://reviews.llvm.org/D92215
2021-01-15 14:55:55 +01:00
Simon Pilgrim
000e9cc0d3 [X86][AVX] combineHorizOpWithShuffle - support target shuffles in HOP(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(HOP(X,Y))
Be more aggressive on (AVX2+) folds of lane shuffles of 256-bit horizontal ops by working on target/faux shuffles as well.
2021-01-15 13:55:30 +00:00
Raphael Isemann
79aa560add Revert "[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference"
This reverts commit bab121a1b66e85390cad019ec921febcba35519d. It seems the
docs buildbot doesn't have the required Python headers.
2021-01-15 14:07:45 +01:00
Stefan Gränitz
249736daff [Orc] Fix OrcV2Examples after D94690
Differential Revision: https://reviews.llvm.org/D94690
2021-01-15 13:45:46 +01:00
Raphael Isemann
b9583453c6 [lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference
Currently LLDB uses epydoc to generate the Python API reference for the website.
epydoc however is unmaintained since more than a decade and no longer works with
Python 3. Also whatever setup we had once for generating the documentation on
the website server no longer seems to work, so the current website documentation
has been stale since more than a year.

This patch replaces epydoc with sphinx and its automodapi plugin that can
generate Python API references. LLVM already uses sphinx for the rest of the
documentation, so this way we are more consistent with the rest of LLVM. The
only new dependency is the automodapi plugin for sphinx.

This patch effectively does the following things:
* Remove the epydoc code.
* Make a new dummy Python API page in our website that just calls the Sphinx
  command for generated the API documentation.
* Add a mock _lldb module that is only used when generating the Python API.
 This way we don't have to build all of LLDB to generate the API reference.

Some notes:
* The long list of skips is necessary due to boilerplate functions that SWIG
  is generating. Sadly automodapi is not really scriptable from what I can see,
  so we have to blacklist this stuff manually.
* The .gitignore change because automodapi wants a subfolder of our
  documentation directory to place generated documentation files there. The path
  is also what is used on the website, so we can't really workaround this
  (without copying the whole `docs` dir somewhere else when we build).
* We have to use environment variables to pass our build path to our sphinx
  configuration. Sphinx doesn't support passing variables onto that script.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D94489
2021-01-15 13:26:42 +01:00
Hsiangkai Wang
e1896a5f9e [NFC][RISCV] Remove useless code in RISCVRegisterInfo.td.
Differential Revision: https://reviews.llvm.org/D94750
2021-01-15 20:08:51 +08:00
Stefan Gränitz
9bbc173276 [Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors
It can be useful for an ObjectLinkingLayerCreator to allow callee errors to get propagated to the builder. Specifically, this is the case when the ObjectLayer uses the EHFrameRegistrationPlugin, because it requires a TPCEHFrameRegistrar and instantiation for it may fail (e.g. if the required registration symbols are missing in the target process).

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D94690
2021-01-15 12:53:41 +01:00
Stefan Gränitz
ff70fba453 [Orc][NFC] Turn LLJIT member ObjTransformLayer into unique_ptr
All other layers in LLJIT are stored as unique_ptr's already. At this point, it is not strictly necessary for ObjTransformLayer, but it makes a follow-up change more straightforward.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D94689
2021-01-15 12:53:24 +01:00
Paul Walker
1ea911176e [SVE] Restrict the usage of REINTERPRET_CAST.
In order to limit the number of combinations of REINTERPRET_CAST,
whilst at the same time prevent overlap with BITCAST, this patch
establishes the following rules:

1. The operand and result element types must be the same.
2. The operand and/or result type must be an unpacked type.

Differential Revision: https://reviews.llvm.org/D94593
2021-01-15 11:32:13 +00:00
Sam Elliott
9d86600dd8 [RISCV] Optimize Branch Comparisons
I noticed in D94450 that there were quite a few places where we generate
the sequence:
```
  xN <- comparison ...
  xN <- xor xN, 1
  bnez xN, symbol
```

Given we know the XOR will be used by BRCOND, which only looks at the lowest
bit, I think we can remove the XOR and just invert the branch condition in
these cases?

The case mostly seems to come up in floating point tests, where there is often
more logic to combine the results of multiple SETCCs, rather than a single
(BRCOND (SETCC ...) ...).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D94535
2021-01-15 11:28:19 +00:00
Georgii Rymar
9f93bb7857 [llvm-readobj][test] - Remove excessive YAML fields from tests.
This removes excessive YAML keys from `SHT_GNU_verdef` sections.
Those keys are set by default.

Differential revision: https://reviews.llvm.org/D94660
2021-01-15 12:46:39 +03:00
Georgii Rymar
14b8975a20 [yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.
This patch:
1) Makes `Version`, `Flags`, `VersionNdx` and `Hash` fields to be `Optional<>`.
2) Disallows dumping version definitions that have `vd_version != 1`.
   `vd_version` identifies the version of the structure itself.
   (https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html,
    https://docs.oracle.com/cd/E19683-01/816-7777/chapter6-80869/index.html)
3) Stops dumping default values for `Version`, `Flags`, `VersionNdx` and `Hash` fields.
4) Refines testing.

Differential revision: https://reviews.llvm.org/D94659
2021-01-15 12:40:42 +03:00
Oliver Stannard
9bb8e55b12 [ARM][GISel] Treat calls as variadic even if only fixed arguments provided
For the ARM hard-float calling convention, calls to variadic functions
need to be treated diffrently, even if only the fixed arguments are
provided.

This fixes GCC-C-execute-pr68390 in the test-suite, which is failing on
the ARM GlobaISel bot.
2021-01-15 09:37:01 +00:00
Georgii Rymar
e13cf8d1c8 [llvm-nm] - Simplify the code in dumpSymbolNamesFromObject. NFC.
It is possible to simplify the logic that extracts symbol names.

D94667 made the `NMSymbol::Name` to be `std::string`,
what allowed this simplification.

Differential revision: https://reviews.llvm.org/D94669
2021-01-15 12:29:49 +03:00
Georgii Rymar
0906a7aca7 [llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.
`dumpSymbolNamesFromObject` is the method that dumps symbol names.

It has 563 lines, mostly because of huge piece of MachO specific code.
In this patch I move it to separate helper method.

The new size of `dumpSymbolNamesFromObject` is 93 lines. With it it becomes
much easier to maintain it.

I had to change the type of 2 name fields to `std::string`, because MachO logic
uses temporarily buffer strings (e.g `ExportsNameBuffer`, `BindsNameBuffer` etc):

```
  std::string ExportsNameBuffer;
  raw_string_ostream EOS(ExportsNameBuffer);
```

these buffers were moved to `dumpSymbolsFromDLInfoMachO` by this patch and
invalidated after return. Technically, before this patch we had a situation
when local pointers (symbol names) were assigned to members of global static `SymbolList`,
what is dirty by itself.

Differential revision: https://reviews.llvm.org/D94667
2021-01-15 12:18:37 +03:00
Alok Kumar Sharma
5ffb093588 [Debuginfo][DW_OP_implicit_pointer] (1/7) Support for DW_OP_LLVM_implicit_pointer
New dwarf operator DW_OP_LLVM_implicit_pointer is introduced (present only in LLVM IR)
This operator is required as it is different than DWARF operator
DW_OP_implicit_pointer in representation and specification (number
and types of operands) and later can not be used as multiple level.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D84113
2021-01-15 14:45:04 +05:30
Amara Emerson
a3504b2324 [AArch64][GlobalISel] Fix fallbacks introduced for G_SITOFP in 8f283cafddfa8d6d01a94b48cdc5d25817569e91
If we have an integer->fp convert that has differing sizes, e.g. s32 to s64,
then don't try to convert it to AArch64::G_SITOF since it won't select.
2021-01-15 01:10:49 -08:00
Georgii Rymar
d2ec69d971 [llvm-readobj] - Fix the compilation with GCC < 7.0.
This addressed post commit comments for D93900.

GCC had an issue and requires placing a specialization of
`printUnwindInfo` to a namespace to compile:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
2021-01-15 11:58:04 +03:00
Nikita Popov
886badc15d Revert "Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single-element insert""
This reverts commit 260a856c2abcef49c7cb3bdcd999701db3e2af38.
This reverts commit 3043e5a5c33c4c871f4a1dfd621a8839f9a1f0b3.
This reverts commit 49142991a685bd427d7e877c29c77371dfb7634c.

This change had a larger than anticipated compile-time impact,
possibly because the small value optimization is not working as
intended. See D93779.
2021-01-15 09:28:42 +01:00
KAWASHIMA Takahiro
008c1588a4 [AArch64] Add Fujitsu A64FX scheduling model
Basic support of A64FX was added in D75594 but its scheduling model
was missing. This commit adds the scheduling model. Also, this commit
amends/adds some subtarget parameters of A64FX.

The A64FX Microarchitecture Manual, which is source information of
this commit, is on GitHub.

https://github.com/fujitsu/A64FX/

Differential Revision: https://reviews.llvm.org/D93791
2021-01-15 17:14:04 +09:00