1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
Commit Graph

208589 Commits

Author SHA1 Message Date
Paul C. Anagnostopoulos
415c2c940a [TableGen] Add the !substr() bang operator
Update the documentation and add a test.

Differential Revision: https://reviews.llvm.org/D93419
2020-12-21 09:41:59 -05:00
Sanjay Patel
5dc0906af9 [InstSimplify] reduce logic with inverted add/sub ops
https://llvm.org/PR48559
This could be part of a larger ValueTracking API,
but I don't see that currently.

https://rise4fun.com/Alive/gR0

  Name: and
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = and i8 %sub, %sub1
  =>
  %r = 0

  Name: or
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = or i8 %sub, %sub1
  =>
  %r = -1

  Name: xor
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = xor i8 %sub, %sub1
  =>
  %r = -1
2020-12-21 08:51:43 -05:00
Sanjay Patel
e7bf73e793 [InstSimplify] add tests for inverted logic operands; NFC 2020-12-21 08:51:42 -05:00
Kazushi (Jam) Marukawa
920c28fbd1 [VE] Correct VMP allocation in calling conv
VE used to allocate VM1, VM2, VMP2 (VM4+VM5), and VM3.  This patch
corrects to allocate VM1, VM2, VMP2 (VM4+VM5), and VM6.  Also add
a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93570
2020-12-21 22:42:24 +09:00
Florian Hahn
2c9bb42ba6 [VPlan] Make VPRecipeBase inherit from VPDef.
This patch makes VPRecipeBase a direct subclass of VPDef, moving the
SubclassID to VPDef.

Reviewed By: gilr

Differential Revision: https://reviews.llvm.org/D90564
2020-12-21 13:34:00 +00:00
Denis Antrushin
ff5b573256 [Statepoints] Disable VReg lowering for values used on exception path of invoke.
Currently we lower invokes the same way as usual calls, e.g.:

V1 = STATEPOINT ... V (tied-def 0)

But this is incorrect is V1 is used on exceptional path.
By LLVM rules V1 neither dominates its uses in landing pad, nor
its live range is live on entry to landing pad. So compiler is
allowed to do various weird transformations like splitting live
range after statepoint and use split LR in catch block.

Until (and if) we find better solution to this problem, let's
use old lowering (spilling) for those values which are used on
exceptional path and allow VReg lowering for values used only
on normal path.

Differential Revision: https://reviews.llvm.org/D93449
2020-12-21 20:27:05 +07:00
Kazushi (Jam) Marukawa
52b2d862f9 [VE] Optimize LEA combinations
Change to optimize references of elements of aggregate data.  Also
add regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93627
2020-12-21 22:21:10 +09:00
Jan Svoboda
203781f285 [TableGen] NFC: Rename variables in OptParserEmitter
Switch to the LLVM naming convention.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D93527
2020-12-21 12:36:46 +01:00
Jan Svoboda
7b0c9bd48f [TableGen] NFC: Switch to range-based for loops in OptParserEmitter
This simplifies the code a bit. No functionality change.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D93526
2020-12-21 12:36:46 +01:00
Kazushi (Jam) Marukawa
79cd9eb4ec [VE] Support STACKSAVE and STACKRESTORE
Change to use default expanded code.  Add regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93539
2020-12-21 20:15:50 +09:00
Kazushi (Jam) Marukawa
0779b25bba [VE] Support RETURNADDR
Implement RETURNADDR for VE.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93545
2020-12-21 20:06:03 +09:00
Florian Hahn
e5ba40d3e8 [VPlan] Use VPDef for VPInterleaveRecipe.
This patch turns updates VPInterleaveRecipe to manage the values it defines
using VPDef. The VPValue is used  during VPlan construction and
codegeneration instead of the plain IR reference where possible.

Reviewed By: gilr

Differential Revision: https://reviews.llvm.org/D90562
2020-12-21 10:56:53 +00:00
Simon Moll
dfd5261b45 [VP][NFC] ISD::VP_Sub -> ISD::VP_SUB 2020-12-21 11:43:07 +01:00
Jan Svoboda
cd4c816c24 [clang][cli] Let denormalizer decide how to render the option based on the option class
Before this patch, you needed to use `AutoNormalizeEnumJoined` whenever you wanted to **de**normalize joined enum.
Besides the naming confusion, this means the fact the option is joined is specified in two places: in the normalization multiclass and in the `Joined<["-"], ...>` multiclass.
This patch makes this work automatically, taking into account the `OptionClass` of options.

Also, the enum denormalizer now just looks up the spelling of the present enum case in a table and forwards it to the string denormalizer.

I also added more tests that exercise this.

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84189
2020-12-21 11:32:47 +01:00
Jan Svoboda
087fddcd13 [clang][cli] Streamline MarshallingInfoFlag description
This replaces the existing `MarshallingInfoFlag<...>, IsNegative` with simpler `MarshallingInfoNegativeFlag`.

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84675
2020-12-21 11:32:46 +01:00
David Sherwood
4e8cf9578e [NFC][InstructionCost] Remove isValid() asserts in SLPVectorizer.cpp
An earlier patch introduced asserts that the InstructionCost is
valid because at that time the ReuseShuffleCost variable was an
unsigned. However, now that the variable is an InstructionCost
instance the asserts can be removed.

See this thread for context:
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

See this patch for the introduction of the type:
https://reviews.llvm.org/D91174
2020-12-21 09:12:28 +00:00
Fangrui Song
a33c20ac72 [AsmPrinter] Replace a reachable report_fatal_error with MCContext::reportError 2020-12-20 23:45:49 -08:00
Fangrui Song
0f5b80de09 MCContext::reportError: don't call report_fatal_error
Errors from MCAssembler, MCObjectStreamer and *ObjectWriter typically cause a crash:

```
% cat c.c
int bar;
extern int foo __attribute__((alias("bar")));
% clang -c -fcommon c.c
fatal error: error in backend: Common symbol 'bar' cannot be used in assignment expr
PLEASE submit a bug report to ...
Stack dump:
...
```

`LLVMTargetMachine::addPassesToEmitFile` constructs `MachineModuleInfoWrapperPass`
which creates a MCContext without SourceMgr. `MCContext::reportError` calls
`report_fatal_error` which gets captured by Clang `LLVMErrorHandler` and gets translated
to the output above.

Since `MCContext::reportError` errors indicate user errors, such a crashing style error
is inappropriate. So this patch changes `report_fatal_error` to `SourceMgr().PrintMessage`.
```
% clang -c -fcommon c.c
<unknown>:0: error: Common symbol 'bar' cannot be used in assignment expr
```

Ideally we should at least recover the original filename (the line information
is generally lost).  That requires general improvement to MC diagnostics,
because currently in many cases SMLoc information is lost.
2020-12-20 23:23:12 -08:00
Pushpinder Singh
bfe8c5655b [FastRA] Fix handling of bundled MIs
Fast register allocator skips bundled MIs, as the main assignment
loop uses MachineBasicBlock::iterator (= MachineInstrBundleIterator)
This was causing SIInsertWaitcnts to crash which expects all
instructions to have registers assigned.

This patch makes sure to set everything inside bundle to the same
assignments done on BUNDLE header.

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D90369
2020-12-21 02:10:55 -05:00
Monk Chiang
d08126ad3e [RISCV] Define the remaining vector fixed-point arithmetic intrinsics.
This patch base on D93366, and define vector fixed-point intrinsics.
    1. vaaddu/vaadd/vasubu/vasub
    2. vsmul
    3. vssrl/vssra
    4. vnclipu/vnclip

  We work with @rogfer01 from BSC to come out this patch.

  Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
  Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>

  Differential Revision: https://reviews.llvm.org/D93508
2020-12-20 22:57:07 -08:00
Jian Cai
b15716a6d4 [AsmParser] make .ascii support spaces as separators
Currently the integrated assembler only allows commas as the separator
between string arguments in .ascii. This patch adds support to using
space as separators and make IAS consistent with GNU assembler.

Link: https://github.com/ClangBuiltLinux/linux/issues/1196

Reviewed By: nickdesaulniers, jrtc27

Differential Revision: https://reviews.llvm.org/D91460
2020-12-20 22:41:00 -08:00
Esme-Yi
1a2a0ec179 [PowerPC][NFC] Added assertion of shift exponent is too large for 'uint64_t'. 2020-12-21 06:16:50 +00:00
Fangrui Song
6fb1f18bac [MC][ELF] Remove unneeded MCSymbol::setExternal calls
ELF code uses symbol bindings and does not call isExternal().
2020-12-20 21:26:36 -08:00
Esme-Yi
f83e7bf498 [PowerPC] Materialize i64 constants by enumerated patterns.
Summary: Some constants can be handled with less instructions than our current results. And it seems our original approach is not very easy to extend. Therefore this patch proposes to materialize all 64-bit constants by enumerated patterns.
I traversed almost all constants to verified the functionality of these pattens. A traversed comparison of the number of instructions used by the original method and the new method has also been completed, where no degradation was caused by this patch. This patch also passed Bootstrap test and SPEC test.
Improvements of this patch are shown in llvm/test/CodeGen/PowerPC/constants-i64.ll

Reviewed By: steven.zhang, stefanp

Differential Revision: https://reviews.llvm.org/D92089
2020-12-21 05:21:07 +00:00
Fangrui Song
3dbfad767c [MC][ELF] Drop MCSymbol::isExternal call sites
ELF uses symbol bindings and MCSymbol::isExternal is not really useful.
The function is no longer used in ELF code now.
2020-12-20 21:18:22 -08:00
Fangrui Song
f274823e08 [MC] Report locations for .symver errors 2020-12-20 21:04:12 -08:00
Fangrui Song
ed0a358593 [llvm-reduce][test] Make remove-alias.ll CHECK patterns more specific after D90302
`CHECK-FINAL-NOT: global` can match the input filename (e.g. clang-cmake-aarch64-global-isel)
and fail spuriously.
2020-12-20 20:06:02 -08:00
Fangrui Song
b9e92f17ed [MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets
This relands D64327 with a more specific workaround for R_386_GOTOFF
(gold<2.34 bug https://sourceware.org/bugzilla/show_bug.cgi?id=16794)

.debug_info has quite a few .debug_str relocations (R_386_32/R_ARM_ABS32).
The original workaround was too general and introduced too many .L symbols
used just as relocation targets.

From the original review:

  ... it reduced the size of a big ARM-32 debug image by 33%. It contained ~68M
  of relocations symbols out of total ~71M symbols (96% of symbols table was
  generated for relocations with symbol).
2020-12-20 18:37:14 -08:00
Ben Shi
f1b04222fd [RISCV][NFC] Add tests for multiplication with constant
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D93589
2020-12-21 10:20:36 +08:00
Kazu Hirata
60f8df7d01 [Target] Use llvm::erase_if (NFC) 2020-12-20 17:43:22 -08:00
Chen Zheng
4ba7062add [PowerPC] add has side effect for SAT bit clobber intrinsics/instructions
This patch does two things:
1: fix the typo that intrinsic mfvscr should be with no readmem property
2: since VSCR is not modeled yet, add has side effect for SAT bit clobber
   intrinsics/instructions.

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D90807
2020-12-20 19:48:26 -05:00
Chen Zheng
d1ab1dfd14 [MachineLICM] delete dead flag if the duplicated def outside of loop is dead.
Fixup dead flags for CSE-ed instructions.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D92557
2020-12-20 19:26:22 -05:00
Arthur Eubanks
5479e7404d [test] Fix reg-usage.ll under NPM
The -O2 isn't used in the test.
2020-12-20 15:41:29 -08:00
Shilei Tian
b888a79274 [OpenMP] Fixed the issue that CMake variables for OpenMP were not passed through when building OpenMP with LLVM_ENABLE_RUNTIMES
Currently when building OpenMP along with LLVM, CMake variables for OpenMP (prefix with `LIBOMP` and `LIBOMPTARGET`) will not be passed through because by default it uses the prefix of the runtime name, aka `OPENMP` in this case. This patch fixed this issue.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D93603
2020-12-20 18:40:12 -05:00
Fangrui Song
4460105032 [MC] Reject byte alignment if larger than or equal to 2**32
This is consistent with the resolution to power-of-2 alignments.
Otherwise, emitCodeAlignment and emitValueToAlignment cannot handle alignments
larger than 2**32 and will trigger assertion failure (PR35218).

Note: GNU as as of 2.35 will use 1 for such a large byte `.align`
2020-12-20 14:17:00 -08:00
Samuel Eubanks
939f38fb2b Make NPM OptBisectInstrumentation use global singleton OptBisect
Currently there is an issue where the legacy pass manager uses a different OptBisect counter than the new pass manager.
This fix makes the npm OptBisectInstrumentation use the global OptBisect.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D92897
2020-12-20 13:47:56 -08:00
David Green
3ee566ce00 [ARM] Extra vecreduce tests with smaller than legal types. NFC 2020-12-20 21:20:39 +00:00
Nikita Popov
3d38cdb1c2 [BasicAA] Add test for byval argument (NFC) 2020-12-20 21:58:22 +01:00
Fangrui Song
4da240ef54 [Object] Fix LFFile<ELFT>::getEntry on sizeof(size_t)==4 platforms
This should fix:

Failed Tests (2):
  LLVM-Unit :: Object/./ObjectTests/ELFObjectFileTest.InvalidSymbolTest
  LLVM :: tools/llvm-readobj/ELF/relocation-errors.test
2020-12-20 10:39:59 -08:00
Kazu Hirata
6f875863cc [PGO] Remove dead member variable InstrumentFuncEntry (NFC)
This patch removes InstrumentFuncEntry as it is dead.

The constructor of FuncPGOInstrumentation passes InstrumentFuncEntry
to MST, but it doesn't make a local copy as a member variable.
2020-12-20 09:57:05 -08:00
Kazu Hirata
0abf9f34bf [Analysis, IR, CodeGen] Use llvm::erase_if (NFC) 2020-12-20 09:19:35 -08:00
Nikita Popov
4a14b47a89 [MemLoc] Fix debug print for LocationSize 2020-12-20 17:52:48 +01:00
ShihPo Hung
318bf818da [RISCV] Define vslideup/vslidedown intrinsics
Differential Revision: https://reviews.llvm.org/D93286
2020-12-20 05:08:15 -08:00
Hsiangkai Wang
4d4ca62bdb [RISCV] Define vector vfwmul intrinsics.
Define vector vfwmul intrinsics and lower them to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Differential Revision: https://reviews.llvm.org/D93584
2020-12-20 17:39:20 +08:00
Hsiangkai Wang
cd40f44592 [RISCV] Define vector vfwadd/vfwsub intrinsics.
Define vector vfwadd/vfwsub intrinsics and lower them to V
instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Differential Revision: https://reviews.llvm.org/D93583
2020-12-20 17:39:13 +08:00
Hsiangkai Wang
fbcf513ea3 [RISCV] Define vector vfsgnj/vfsgnjn/vfsgnjx intrinsics.
Define vector vfsgnj/vfsgnjn/vfsgnjx intrinsics and lower them to V
instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Differential Revision: https://reviews.llvm.org/D93581
2020-12-20 17:39:04 +08:00
Hsiangkai Wang
9f83b59a15 [RISCV] Define vector vfmul/vfdiv/vfrdiv intrinsics.
Define vector vfmul/vfdiv/vfrdiv intrinsics and lower them to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Differential Revision: https://reviews.llvm.org/D93580
2020-12-20 17:38:57 +08:00
Reid Kleckner
bf5fdca4c8 Fix left shift overflow UB in PPC backend on LLP64 platforms 2020-12-19 17:46:09 -08:00
Andrew Litteken
ff58b9b50b [IROutliner] Deduplicating functions that only require inputs.
Extracted regions can have both inputs and outputs.  In addition, the
CodeExtractor removes inputs that are only used in llvm.assumes, and
sunken allocas (values are used entirely in the extracted region as
denoted by lifetime intrinsics).  We also cannot combine sections that
have different constants in the same structural location, and these
constants will have to elevated to argument. This patch deduplicates
extracted functions that only have inputs and non of the special cases.

We test that correctly deduplicate in:
test/Transforms/IROutliner/outlining-same-globals.ll
test/Transforms/IROutliner/outlining-same-constants.ll
test/Transforms/IROutliner/outlining-different-structure.ll

Reviewers: jroelofs, paquette

Differential Revision: https://reviews.llvm.org/D86978
2020-12-19 17:34:34 -06:00
Andrew Litteken
af060387a5 Revert "[IROutliner] Deduplicating functions that only require inputs."
Missing reviewers and differential revision in commit message.

This reverts commit 5cdc4f57e50bbe0d211c109517c17defe78e0b73.
2020-12-19 17:33:49 -06:00