Commit Graph

352050 Commits

Author SHA1 Message Date
Amy Huang 1e1f5eb7c9 [NativeSession] Fix unchecked Expected type
(followup to https://reviews.llvm.org/D78128)
2020-04-21 12:36:55 -07:00
Valentin Clement a6c1692cb3 [Flang] fix dependency issues after D78215
Patch D78215 changes various dependencies in the CMakeLists.txt. This
results in error while compiling. This patch fixes the issue.

Reviewers: DavidTruby

Differential Revision: https://reviews.llvm.org/D78340
2020-04-21 20:32:11 +01:00
Louis Dionne 58f32435e8 [libc++abi] Add a rate limiter when logging dynamic_cast errors
This upstreams a fix that Howard made a long time ago, where so many
errors would be logged that applications were becoming sluggish. With
this patch, the first three errors will be printed, and after that the
printing frequency decreases exponentially.

_LIBCXX_DYNAMIC_FALLBACK is only enabled on Apple platforms, so this
should be NFC for other platforms.

rdar://14996273

Differential Revision: https://reviews.llvm.org/D78330
2020-04-21 15:27:33 -04:00
Matt Arsenault 7dece2fde3 AMDGPU: Use Register 2020-04-21 15:19:35 -04:00
Eli Friedman 704293b168 [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 b4b9faa120 [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
Evgenii Stepanov 2e1cfd02d0 Fix Solaris build of ubsan.
Summary: Broken in D78325.

Reviewers: ro

Subscribers: mgorny, fedor.sergeev, #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D78510
2020-04-21 12:06:30 -07:00
Michael Liao 21529355e1 Fix `-Wparentheses` warnings. NFC. 2020-04-21 15:02:59 -04:00
Fangrui Song c5d38924dc [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 352fef3f11
[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 a13dce1d90 Fix build. NFC. 2020-04-21 14:59:45 -04:00
Fangrui Song 4927ae0858 [PDB] Change llvm/object/COFF.h to llvm/Object/COFF.h after D78128 2020-04-21 11:54:05 -07:00
Amy Huang a6d8a055e9 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 9a08c30705 Bit-pack some pairs. No functionlity change intended. 2020-04-21 20:40:20 +02:00
Fangrui Song cca545ce46 [CallSite] Fix build breakage after D78538 2020-04-21 11:33:40 -07:00
Jonas Devlieghere 116c2da4b2 [lldb/Scripts] proc.returncode is set in proc.communicate
Make sure proc.returncode has been assigned before we compare it to 0.
2020-04-21 11:30:15 -07:00
Sanjay Patel cf30aafa2d [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 b349098d22 [InstCombine] add tests for logic-of-icmps; NFC 2020-04-21 14:23:05 -04:00
River Riddle cf60700853 [mlir] Remove braces to avoid ambiguous constructor of operand range 2020-04-21 11:20:36 -07:00
aartbik 8387bee94d [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 d702325af6 [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 d9af50efbc [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
Siva Chandra Reddy 7f12512db2 [libc][Take 2] Propagate entrypoint deps to downstream targets.
This reverts commit a8086ba4ac.
Setting couple of target properties to an empty string was missed in the
previous commit.
2020-04-21 10:29:09 -07:00
Pavel Iliin be881e2831 [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 1f9c169990
[NFC][InstCombine] sub-of-negatible.ll: some more test cases 2020-04-21 20:14:09 +03:00
Louis Dionne d632587664 [libc++] Do not enable assertions in the dylib in the Apple cache
It turns out that all this time, we've actually been building without
assertions enabled in the dylib. This commit updates the Apple CMake
cache to make it consistent with reality.
2020-04-21 13:12:03 -04:00
Siva Chandra Reddy a8086ba4ac [libc] Revert "Propagate entrypoint deps to downstream targets."
This reverts commit 20cb440ea2 as the
target llvmlibc seems to be failing on the bots.
2020-04-21 10:10:18 -07:00
Ana Pazos 66590e1e9e [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
Louis Dionne fccc4af658 [libc++] Re-enable warnings in the new format
When the new libc++ test format was enabled, warnings were accidentally
dropped cause they were not part of the %{compile_flags} substitution.
This commit adds them back, however `-Werror` is only used for non-verify
tests (cause it doesn't make sense for verify tests).

This commit is a re-application of 20fd624380, which was reverted in
5ec6fdb058 because it broke the C++03 bot. This failure should have
been fixed in b4fb705e77.
2020-04-21 13:01:08 -04:00
Benjamin Kramer d50bfd9764 Fix an unused-variable warning in Release mode. 2020-04-21 18:59:27 +02:00
Siva Chandra Reddy 20cb440ea2 [libc] Propagate entrypoint deps to downstream targets.
Deps are recrusively evaluated at the place they are needed. With this
change, one does not have to list recursive deps of entrypoints when
listing test targets. One will still have to explicitly list all
entrypoint objects when setting up an "add_entrypoint_library" target.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D78537
2020-04-21 09:58:55 -07:00
Fangrui Song 5771c98562 [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 44a8c5410e [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
Siva Chandra Reddy 8c2e66226f [libc] [NFC] Split the CMake rules into multiple files.
Summary:
The single file was getting too long to be convenient to navigate. This
patch splits it up two into 4 files one each for header rules,
object rules, library rules, and test rules.

Reviewers: abrachet, alexshap

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D78536
2020-04-21 09:24:17 -07:00
Johannes Doerfert 177c065e50 [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 99662c22cd [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 1f570e019d [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 40f3baeb20 [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 91a6c88349 [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
Pierre Oechsel 128d72751f [mlir] [linalg] Specify alignment during promotion.
The buffer allocated by a promotion can be subject to other transformations afterward. For example it could be vectorized, in which case it is needed to ensure that this buffer is memory-aligned.

Differential Revision: https://reviews.llvm.org/D78556
2020-04-21 18:13:40 +02:00
Nicolas Vasilache 538ac26f25 [mlir][Linalg] Create a named batch_matmul op and pipe it through.
This revision is the first in a set of improvements that aim at allowing
more generalized named Linalg op generation from a mathematical
specification.

This revision allows creating a new op and checks that the parser,
printer and verifier are hooked up properly.

This opened up a few design points that will be addressed in the future:
1. A named linalg op has a static region builder instead of an
explicitly parsed region. This is not currently compatible with
assemblyFormat so a custom parser / printer are needed.
2. The convention for structured ops and tensor return values needs to
evolve to allow tensor-land and buffer land specifications to agree
3. ReferenceIndexingMaps and referenceIterators will need to become
static to allow building attributes at parse time.
4. Error messages will be improved once we have 3. and we pretty print
in custom form.

Differential Revision: https://reviews.llvm.org/D78327
2020-04-21 12:09:46 -04:00
Stefan Pintilie a92ee77d85 [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 e477915bfe [PowerPC] Add a new test case expand-isel-liveness.mir 2020-04-21 16:00:34 +00:00
Jonas Devlieghere 2de52422ac [lldb/Test] Decode stdout and stderr in case it contains Unicode.
Lit's to_string will just return the string when it's a `str` instance,
which in Python 2 can still contain UTF-8 characters.

Differential revision: https://reviews.llvm.org/D76955
2020-04-21 08:32:30 -07:00
Nick Desaulniers d3fdafae06 [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 658f33dcea [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
Fangrui Song 497c76e96d [ELF] Keep local symbols when both --emit-relocs and --discard-all are specified
This fixes a bug as exposed by D77807.

Add tests for {--emit-relocs,-r} x {--discard-locals,--discard-all}. They add coverage for previously undertested cases:

* STT_SECTION associated to GCed sections (`gc`)
* STT_SECTION associated to retained sections (`text`)
* STT_SECTION associated to non-SHF_ALLOC sections (`.comment`)
* STB_LOCAL in GCed sections (`unused_gc`)

Reviewed By: grimar, ikudrin

Differential Revision: https://reviews.llvm.org/D78389
2020-04-21 08:28:12 -07:00
Louis Dionne b4fb705e77 [libc++] Fix warnings with Clang in C++03 2020-04-21 11:03:05 -04:00
Sean Fertile cd8e9e8fcd [PowerPC][AIX][NFC] Fix use of FileCheck variable in lit test. 2020-04-21 10:56:46 -04:00
Fangrui Song 58207d6fe1 [ELF] Fix "TLS attribute mismatch" false positives for STT_NOTYPE undefined symbols
D13550 added the diagnostic to address/work around a crash.
The rule was refined by D19836 (test/ELF/tls-archive.s) to exclude Lazy symbols.

https://bugs.llvm.org/show_bug.cgi?id=45598 reported another case where the current logic has a false positive:

Bitcode does not record undefined module-level inline assembly symbols
(`IRSymtab.cpp:Builder::addSymbol`). Such an undefined symbol does not
have the FB_tls bit and lld will not consider it STT_TLS. When the symbol is
later replaced by a STT_TLS Defined, lld will error "TLS attribute mismatch".

This patch fixes this false positive by allowing a STT_NOTYPE undefined
symbol to be replaced by a STT_TLS.

Considered alternative:

Moving the diagnostics to scanRelocs() can improve the diagnostics (PR36049)
but that requires a fair amount of refactoring. We will need more
RelExpr members. It requires more thoughts whether it is worthwhile.

See `test/ELF/tls-mismatch.s` for behavior differences. We will fail to
diagnose a likely runtime bug (STT_NOTYPE non-TLS relocation referencing
a TLS definition). This is probably acceptable because compiler
generated code sets symbol types properly.

Reviewed By: grimar, psmith

Differential Revision: https://reviews.llvm.org/D78438
2020-04-21 07:56:35 -07:00