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

195483 Commits

Author SHA1 Message Date
Eli Friedman
c63956f575 [TargetPassConfig] Run MachineVerifier after more passes.
We were disabling verification for no reason in a bunch of places; just
turn it on.

At this point, there are two key places where we don't run verification:
during register allocation, and after addPreEmitPass.  Regalloc probably
isn't worth messing with; it has its own invariants, and verifying
afterwards is probably good enough.  For after addPreEmitPass, it's
probably worth investigating improvements.
2020-04-21 21:05:07 -07:00
Sameer Sahasrabuddhe
20f2dc251d FixIrreducible: don't crash when moving a child loop
Summary:
When an irreducible SCC is converted into a new natural loop, existing
loops included in that SCC now become children of the new loop. The
logic that moves these loops from the parent loop to the new loop
invoked undefined behaviour when it modified the container that it was
iterating over. Fixed this by first extracting all the loops that are
to be removed from the parent.

Fixes bug 45623.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D78544
2020-04-22 07:47:30 +05:30
Andrew Browne
0b9b4fd582 Make SmallVector assert if it cannot grow.
Context:

  /// Double the size of the allocated memory, guaranteeing space for at
  /// least one more element or MinSize if specified.
  void grow(size_t MinSize = 0) { this->grow_pod(MinSize, sizeof(T)); }

  void push_back(const T &Elt) {
    if (LLVM_UNLIKELY(this->size() >= this->capacity()))
      this->grow();
    memcpy(reinterpret_cast<void *>(this->end()), &Elt, sizeof(T));
    this->set_size(this->size() + 1);
  }

When grow is called in push_back() without a MinSize specified, this is
relying on the guarantee of space for at least one more element.

There is an edge case bug where the SmallVector is already at its maximum size
and push_back() calls grow() with default MinSize of zero. Grow is unable to
provide space for one more element, but push_back() assumes the additional
element it will be available. This can result in silent memory corruption, as
this->end() will be an invalid pointer and the program may continue executing.

Another alternative to fix would be to remove the default argument from
grow(), which would mean several changing grow() to grow(this->size()+1)
in several places.

No test case added because it would require allocating ~4GB.

Reviewers: echristo

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77601
2020-04-21 17:53:39 -07:00
LLVM GN Syncbot
85fa188140 [gn build] Port 23609331472 2020-04-21 23:36:07 +00:00
Amy Huang
46a7f5a6dc Reland "Implement some functions in NativeSession." with fixes so that
the tests pass on Linux.

Summary:
This change implements readFromExe, and calculating VA and RVA, which
are some of the functionalities that will be used for native PDB reading
for llvm symbolizer.

bug: https://bugs.llvm.org/show_bug.cgi?id=41795
2020-04-21 16:35:27 -07:00
Mircea Trofin
9d8ecfe68b [llvm][NFC][CallSite] Remove CallSite from FunctionAttrs
Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78584
2020-04-21 16:16:00 -07:00
LLVM GN Syncbot
2fd1216c39 [gn build] Port 352fef3f11f 2020-04-21 21:22:08 +00:00
LLVM GN Syncbot
e202557326 [gn build] Port 060efd24c7f 2020-04-21 21:22:07 +00:00
Amy Huang
7487f3d198 Revert "Implement some NativeSession functions" along with some
followup fixes.

This reverts commits
a6d8a055e92eb4853805d1ad1be0b1a6523524ef
4927ae085807731eb4052e0a682443fe9399b512
1e1f5eb7c978da3b062daaf3c32c459704e65a55
2020-04-21 14:20:13 -07:00
Christopher Tetreault
47b07ad5b9 [SVE] Remove VectorType::getBitWidth()
Summary:
* VectorType::getBitWidth() is just an unsafe version of
getPrimitiveSizeInBits() that assumes all vectors are fixed width.

Reviewers: efriedma, sdesmalen, huntergr, craig.topper

Reviewed By: efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77833
2020-04-21 13:33:46 -07:00
Johannes Doerfert
6eb54478ab [Attributor] Remove dependence edges eagerly
If we have a dependence between an abstract attribute A to an abstract
attribute B such hat changes in A should trigger an update of B, we do
not need to keep the dependence around once the update was triggered. If
the dependence is still required the update will reinsert it into the
dependence map, if it is not we avoid triggering B in the future. This
replaces the "recompute interval" mechanism we used before to prune
stale dependences.

Number of required iterations is generally down, compile time for the
module pass (not really the CGSCC pass) is down quite a bit.

There is one test change which looks like an artifact in the undefined
behavior AA that needs to be looked at.
2020-04-21 15:22:10 -05:00
Johannes Doerfert
52b98ed84b [Attributor][NFC] Track the number of created AAs in the statistics 2020-04-21 15:22:10 -05:00
Johannes Doerfert
c4a52b9a17 [Attributor][PM] Introduce -attributor-enable={none,cgscc,module,all}
The old command line option `-attributor-disable` was too coarse grained
as we want to measure the effects of the module or cgscc pass without
the other as well.

Since `none` is the default there is no real functional change.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D78571
2020-04-21 15:22:10 -05:00
Johannes Doerfert
2ebd299e0e [Attributor][NFC] Remove obsolete option from tests
Since D76871 it is sufficient to run `opt -atributor` or
`-attributor-cgscc`.
2020-04-21 15:22:10 -05:00
Michael Liao
3102f5a0d5 Fix -Wpedantic warnings. NFC. 2020-04-21 16:09:17 -04:00
Amy Huang
c74fd0c180 [NativeSession] Fix unchecked Expected type
(followup to https://reviews.llvm.org/D78128)
2020-04-21 12:36:55 -07:00
Matt Arsenault
9d35bf6a9c AMDGPU: Use Register 2020-04-21 15:19:35 -04:00
Eli Friedman
6f59ec7d26 [ARM] Fix MIR tests with invalid live-ins.
A register can't be live if it isn't defined; fix issues in various
testcases.

Differential Revision: https://reviews.llvm.org/D78529
2020-04-21 12:13:35 -07:00
Eli Friedman
a8ca298c3c [AArch64] Fix MIR tests with invalid live-ins.
A register can't be live if it isn't defined; fix issues in various
testcases.

Differential Revision: https://reviews.llvm.org/D78531
2020-04-21 12:13:32 -07:00
Michael Liao
626ccbc573 Fix -Wparentheses warnings. NFC. 2020-04-21 15:02:59 -04:00
Fangrui Song
80f1762659 [XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations
In a future change we should properly fix xray_fn_idx to use PC-relative
addresses as well, but for now let's keep absolute addresses until sled
addresses are all fixed.
2020-04-21 12:02:29 -07:00
Roman Lebedev
b6333cc946 [InstCombine] Negator - sink sinkable negations
Summary:
As we have discussed previously (e.g. in D63992 / D64090 / [[ https://bugs.llvm.org/show_bug.cgi?id=42457 | PR42457 ]]), `sub` instruction
can almost be considered non-canonical. While we do convert `sub %x, C` -> `add %x, -C`,
we sparsely do that for non-constants. But we should.

Here, i propose to interpret `sub %x, %y` as `add (sub 0, %y), %x` IFF the negation can be sinked into the `%y`

This has some potential to cause endless combine loops (either around PHI's, or if there are some opposite transforms).
For former there's `-instcombine-negator-max-depth` option to mitigate it, should this expose any such issues
For latter, if there are still any such opposing folds, we'd need to remove the colliding fold.
In any case, reproducers welcomed!

Reviewers: spatel, nikic, efriedma, xbolva00

Reviewed By: spatel

Subscribers: xbolva00, mgorny, hiraditya, reames, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68408
2020-04-21 22:00:23 +03:00
Michael Liao
45866e6621 Fix build. NFC. 2020-04-21 14:59:45 -04:00
Fangrui Song
312f303b26 [PDB] Change llvm/object/COFF.h to llvm/Object/COFF.h after D78128 2020-04-21 11:54:05 -07:00
Amy Huang
ae87806c29 Implement some functions in NativeSession.
Summary:
This change implements readFromExe, and calculating VA and RVA, which
are some of the functionalities that will be used for native PDB reading
for llvm symbolizer.

bug: https://bugs.llvm.org/show_bug.cgi?id=41795

Reviewers: hans, amccarth, rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78128
2020-04-21 11:48:40 -07:00
Benjamin Kramer
f0aed43927 Bit-pack some pairs. No functionlity change intended. 2020-04-21 20:40:20 +02:00
Fangrui Song
47ac02d8c8 [CallSite] Fix build breakage after D78538 2020-04-21 11:33:40 -07:00
Sanjay Patel
39ea45de0b [Analysis] recognize the 'null' pointer constant as not poison
Differential Revision: https://reviews.llvm.org/D78575
2020-04-21 14:23:06 -04:00
Sanjay Patel
e047599624 [InstCombine] add tests for logic-of-icmps; NFC 2020-04-21 14:23:05 -04:00
aartbik
4340698ffa [llvm] [X86] Fixed type bug in vselect for AVX masked load
Summary:
Bugzilla issue 45563
https://bugs.llvm.org/show_bug.cgi?id=45563

Reviewers: nicolasvasilache, mehdi_amini, craig.topper

Reviewed By: craig.topper

Subscribers: RKSimon, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78527
2020-04-21 11:11:35 -07:00
Mircea Trofin
f122c28571 [llvm][NFC][CallSite] Remove CallSite from DeadArgumentElimination
Summary: Also capitalized some induction variables, to match coding style.

Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78538
2020-04-21 10:48:38 -07:00
Simon Pilgrim
b5d13acb69 [Transforms] getOrEnforceKnownAlignment - fix MSVC result of 32-bit shift implicitly converted to 64 bits warning. NFCI
We don't overflow here so we can use a U64 shift directly.
2020-04-21 18:32:12 +01:00
Pavel Iliin
5403bb4617 [AArch64] FMLA/FMLS patterns improvement.
FMLA/FMLS f16 indexed patterns added.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45467
Removed redundant v2f32 vector_extract indexed pattern since
Instruction Selection is able to match v4f32 instead.
2020-04-21 18:23:21 +01:00
Roman Lebedev
d54de329dc [NFC][InstCombine] sub-of-negatible.ll: some more test cases 2020-04-21 20:14:09 +03:00
Ana Pazos
8024ba9bb0 [MC][PGO][PGSO] Cleanup unused MBFI in AsmPrinter
Summary:
Machine Block Frequency Info (MBFI) is being computed but unused in AsmPrinter.

MBFI computation was introduced with PGO change D71149 and then its use was
removed in D71106. No need to keep computing it.

Reviewers: MaskRay, jyknight, skan, yamauchi, davidxl, efriedma, huihuiz

Reviewed By: MaskRay, skan, yamauchi

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78526
2020-04-21 10:01:56 -07:00
Benjamin Kramer
f8bca900d0 Fix an unused-variable warning in Release mode. 2020-04-21 18:59:27 +02:00
Fangrui Song
e8dd5bcb82 [XRay] Change xray_instr_map sled addresses from absolute to PC relative for x86-64
xray_instr_map contains absolute addresses of sleds, which are relocated
by `R_*_RELATIVE` when linked in -pie or -shared mode.

By making these addresses relative to PC, we can avoid the dynamic
relocations and remove the SHF_WRITE flag from xray_instr_map.  We can
thus save VM pages containg xray_instr_map (because they are not
modified).

This patch changes x86-64 and bumps the sled version to 2. Subsequent
changes will change powerpc64le and AArch64.

Reviewed By: dberris, ianlevesque

Differential Revision: https://reviews.llvm.org/D78082
2020-04-21 09:36:09 -07:00
Sanjay Patel
1d148ac389 [InstCombine] add tests for logic-of-icmps; NFC
These are mostly replicated from D78430 (instsimplify).
If we implement more general transforms for instcombine,
then we probably don't need to add that complexity to instsimplify.
2020-04-21 12:26:45 -04:00
Johannes Doerfert
901eef3953 [Attributor] Use a pointer value type for the OpcodeInstMap
This reduces memory consumption and the need to copy complex data
structures repeatedly.

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 490390 (320725/s)
temporary memory allocations: 84601 (55330/s)
peak heap memory consumption: 41.70MB
peak RSS (including heaptrack overhead): 131.18MB
total memory leaked: 269.04KB
```

After:
```
calls to allocation functions: 489359 (301144/s)
temporary memory allocations: 82983 (51066/s)
peak heap memory consumption: 36.76MB
peak RSS (including heaptrack overhead): 126.48MB
total memory leaked: 269.04KB
```

Difference:
```
calls to allocation functions: -1031 (-10739/s)
temporary memory allocations: -1618 (-16854/s)
peak heap memory consumption: -4.94MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

---
2020-04-21 11:20:09 -05:00
Johannes Doerfert
7e065e876c [Attributor] Use a pointer value type for the QueryMap
This reduces memory consumption and the need to copy complex data
structures repeatedly.

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 596180 (374484/s)
temporary memory allocations: 84979 (53378/s)
peak heap memory consumption: 52.14MB
peak RSS (including heaptrack overhead): 139.79MB
total memory leaked: 269.04KB
```

After:
```
calls to allocation functions: 489200 (303285/s)
temporary memory allocations: 83406 (51708/s)
peak heap memory consumption: 41.70MB
peak RSS (including heaptrack overhead): 131.76MB
total memory leaked: 269.04KB
```

Difference:
```
calls to allocation functions: -106980 (-5094285/s)
temporary memory allocations: -1573 (-74904/s)
peak heap memory consumption: -10.44MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

---
2020-04-21 11:20:04 -05:00
Johannes Doerfert
e1f644edc6 [Attributor] Use a pointer value type for the access kind -> accesses map
This reduces memory consumption and the need to copy complex data
structures repeatedly.

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 616219 (381559/s)
temporary memory allocations: 83294 (51575/s)
peak heap memory consumption: 72.15MB
peak RSS (including heaptrack overhead): 160.04MB
total memory leaked: 269.04KB
```

After:
```
calls to allocation functions: 595004 (357145/s)
temporary memory allocations: 83840 (50324/s)
peak heap memory consumption: 52.14MB
peak RSS (including heaptrack overhead): 138.32MB
total memory leaked: 269.04KB
```

Difference:
```
calls to allocation functions: -21215 (-415980/s)
temporary memory allocations: 546 (10705/s)
peak heap memory consumption: -20.01MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

---
2020-04-21 11:20:02 -05:00
Johannes Doerfert
100494f780 [Attributor] Pass the Attributor to the AbstractAttribute constructors
AbstractAttribute::initialize is used to initialize the deduction and
the object we do not always call it. To make sure we have the option to
initialize the object even if initialize is not called we pass the
Attributor to AbstractAttribute constructors now.
2020-04-21 11:20:02 -05:00
Johannes Doerfert
5f65e29ab6 [Attributor] Use a pointer value type for the AAMap
This reduces memory consumption and the need to copy complex data
structures repeatedly.

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 613353 (376521/s)
temporary memory allocations: 83636 (51341/s)
peak heap memory consumption: 75.64MB
peak RSS (including heaptrack overhead): 162.97MB
total memory leaked: 269.04KB
```

After:
```
calls to allocation functions: 616575 (349929/s)
temporary memory allocations: 83650 (47474/s)
peak heap memory consumption: 72.15MB
peak RSS (including heaptrack overhead): 159.81MB
total memory leaked: 269.04KB
```

Difference:
```
calls to allocation functions: 3222 (24225/s)
temporary memory allocations: 14 (105/s)
peak heap memory consumption: -3.49MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

---
2020-04-21 11:19:58 -05:00
Stefan Pintilie
b69f1904be [PowerPC][Future] Add offsets to PC Relative relocations.
This is an optimization that applies to global addresses and
allows for the following transformation:
Convert this:

paddi r3, 0, symbol@PCREL, 1
ld r4, 8(r3)

To this:

pld r4, symbol@PCREL+8(0), 1

An instruction is saved and the linker can do the addition when
the symbol is resolved.

Differential Revision: https://reviews.llvm.org/D76160
2020-04-21 11:08:19 -05:00
Kang Zhang
70d4ad5aec [PowerPC] Add a new test case expand-isel-liveness.mir 2020-04-21 16:00:34 +00:00
Nick Desaulniers
35d2b83690 [InlineSpiller] simplify insertReload() NFC
Summary:
The repeated use of std::next() on a MachineBasicBlock::iterator was
clever, but we only need to reconstruct the iterator post creation of
the spill instruction.

This helps simplifying where we plan to place the spill, as discussed in
D77849.

From here, we can simplify the code a little by flipping the return code
of a helper.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: qcolombet, hiraditya, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78520
2020-04-21 08:31:20 -07:00
Jay Foad
bd08402d21 [AMDGPU] Remove selectSGPRVectorRegClassID. NFC.
This was yet another function that had to be updated whenever you added
a new register class. Remove it by refactoring its only caller to use
standard helper functions from SIRegisterInfo.

Differential Revision: https://reviews.llvm.org/D78557
2020-04-21 16:29:21 +01:00
Sean Fertile
ac14acbc42 [PowerPC][AIX][NFC] Fix use of FileCheck variable in lit test. 2020-04-21 10:56:46 -04:00
Pavel Labath
4e52ec5b13 [DWARFDebugLine] Check for errors when parsing v2 file/dir lists
Summary:
Without this we could silently accept an invalid prologue because the
default DataExtractor behavior is to return an empty string when
reaching the end of file. And empty string is also used to terminate
these lists.

This makes the parsing code slightly more complicated, but this
complexity will go away once the parser starts working with truncating
data extractors. The reason I am doing it this way is because without
this, the truncation would regress the quality of error messages (right
now, we produce bad error messages only near EOF, but truncation would
make everything behave as if it was near EOF).

Reviewers: dblaikie, probinson, jhenderson

Subscribers: hiraditya, MaskRay, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77555
2020-04-21 16:55:36 +02:00
Pavel Labath
3b6fda8c6b [DWARFDataExtractor] Add a "truncating" constructor
Summary:
This constructor allows us to create a new DWARFDataExtractor which will
only present a subrange of an entire debug section. Since debug sections
typically consist of multiple contributions, it is expected that one
will create a new data extractor for each contribution in order to
avoid unexpectedly running off into the next one.

This is very useful for unifying the flows for detecting parse errors.
Without it, the code needs to consider two very different scenarios:
1. If there is another contribution after the current one, the
   DataExtractor functions will just start reading from there. This is
   detectable by comparing the current offset against the known
   end-of-contribution offset.
2. If this is the last contribution, the data extractor will just start
   returning zeroes (or other default values). This situation can *not*
   be detected by checking the parsing offset, as this will not be
   advanced in case of errors.

Using a truncated data extractor simplifies the code (and reduces
cognitive load) by making these two cases behave identically -- a
running off the end of a contribution will _always_ produce an EOF error
(if one uses error-aware parsing methods) or return default values.

Reviewers: dblaikie, probinson, jhenderson, ikudrin

Subscribers: aprantl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77556
2020-04-21 16:48:09 +02:00