Commit Graph

392569 Commits

Author SHA1 Message Date
Fangrui Song 814dffa4b7 [llvm-objcopy][MachO] Support LC_LINKER_OPTIMIZATION_HINT load command
The load command is currently specific to arm64 and holds information
for instruction rewriting, e.g.  converting a GOT load to an ADR to
compute a local address.
(On ELF the information is usually conveyed by relocations, e.g.
R_X86_64_REX_GOTPCRELX, R_PPC64_TOC16_HA)

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D104968
2021-06-29 18:47:55 -07:00
Greg Clayton 43f6dad234 Fix buildbot compile error for https://reviews.llvm.org/D105160. 2021-06-29 18:03:25 -07:00
Greg Clayton c8164d0276 Create synthetic symbol names on demand to improve memory consumption and startup times.
This fix was created after profiling the target creation of a large C/C++/ObjC application that contained almost 4,000,000 redacted symbol names. The symbol table parsing code was creating names for each of these synthetic symbols and adding them to the name indexes. The code was also adding the object file basename to the end of the symbol name which doesn't allow symbols from different shared libraries to share the names in the constant string pool.

Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol names and was taking a long time to generate each name, add them to the string pool and then add each of these names to the name index.

This patch fixes the issue by:
- not adding a name to synthetic symbols at creation time, and allows name to be dynamically generated when accessed
- doesn't add synthetic symbol names to the name indexes, but catches this special case as name lookup time. Users won't typically set breakpoints or lookup these synthetic names, but support was added to do the lookup in case it does happen
- removes the object file baseanme from the generated names to allow the names to be shared in the constant string pool

Prior to this fix the startup times for a large application was:
12.5 seconds (cold file caches)
8.5 seconds (warm file caches)

After this fix:
9.7 seconds (cold file caches)
5.7 seconds (warm file caches)

The names of the symbols are auto generated by appending the symbol's UserID to the end of the "___lldb_unnamed_symbol" string and is only done when the name is requested from a synthetic symbol if it has no name.

Differential Revision: https://reviews.llvm.org/D105160
2021-06-29 17:44:33 -07:00
Nick Desaulniers 98b9fc9b93 [Test] delete LPM RUNs in inline_nossp.ll
This test was modified in D104958. Invoking opt with -{passname} (vs
-passes={passname}) without -enable-new-pm={0|1} is now ambiguous and
dependent on how LLVM was configured.  Drop the LPM runs rather than
fix since there unlikely to be any users still on LPM that rely on the
behavior in this test.

See also:
https://lists.llvm.org/pipermail/llvm-dev/2021-June/151553.html

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D105154
2021-06-29 17:09:42 -07:00
David Blaikie 632e15e766 Conditionalize function only used in an assert to address -Wunused-function 2021-06-29 16:39:59 -07:00
Akira Hatanaka 6cda73e3c4 [CodeGen] Add ParmVarDecls to FunctionDecls that are created to generate
ObjC property getter/setter functions

This is needed to prevent clang from crashing when we make the changes
proposed in https://reviews.llvm.org/D98799.

Differential Revision: https://reviews.llvm.org/D104883
2021-06-29 16:27:24 -07:00
Lei Huang 1df981f43a Revert "Attempt to disable MLIR JIT tests on PowerPC to unbreak the bot"
This reverts commit 652f4b5140.

Re-enable MLLIR JIT tests.
The MLIR Bot was updated to export LD_LIBRARY_PATH=/usr/lib64, which
seem to fix this issue.
2021-06-29 18:03:23 -05:00
Steffen Larsen 3644726a78 [Clang][NVPTX] Add NVPTX intrinsics and builtins for CUDA PTX 6.5 and 7.0 WMMA and MMA instructions
Adds NVPTX builtins and intrinsics for the CUDA PTX `wmma.load`, `wmma.store`, `wmma.mma`, and `mma` instructions added in PTX 6.5 and 7.0.

PTX ISA description of

  - `wmma.load`: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-instructions-wmma-ld
  - `wmma.store`: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-instructions-wmma-st
  - `wmma.mma`: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-instructions-wmma-mma
  - `mma`: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-instructions-mma

Overview of `wmma.mma` and `mma` matrix shape/type combinations added with specific PTX versions: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-shape

Authored-by: Steffen Larsen <steffen.larsen@codeplay.com>
Co-Authored-by: Stuart Adams <stuart.adams@codeplay.com>

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D104847
2021-06-29 15:44:07 -07:00
Dhruva Chakrabarti e0b713a035 [libomptarget] [amdgpu] Change default number of teams per computation unit
This patch is related to https://reviews.llvm.org/D98832. Based on discussions there, I decided to separate out the teams default as this patch. This change is to increase the number of teams per computation unit so as to provide more wavefronts for hiding latency. This change improves performance for some programs, including 20-50% for some Stream benchmarks.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D99003
2021-06-29 15:34:35 -07:00
Adrian Prantl 21e013303b Improve path remapping in cross-debugging scenarios
This patch implements a slight improvement when debugging across
platforms and remapping source paths that are in a non-native
format. See the unit test for examples.

rdar://79205675

Differential Revision: https://reviews.llvm.org/D104407
2021-06-29 15:27:01 -07:00
Adrian Prantl a0e1b11fac Modernize Module::RemapFile to return an Optional (NFC)
This addresses feedback raised in https://reviews.llvm.org/D104404.

Differential Revision: https://reviews.llvm.org/D104724
2021-06-29 15:19:31 -07:00
Adrian Prantl 302b1b9718 Express PathMappingList::FindFile() in terms of PathMappingList::RemapPath()
NFC.

This patch replaces the function body FindFile() with a call to
RemapPath(), since the two functions implement the same functionality.

Differential Revision: https://reviews.llvm.org/D104406
2021-06-29 15:14:31 -07:00
Adrian Prantl a346372200 Change PathMappingList::FindFile to return an optional result (NFC)
This is an NFC modernization refactoring that replaces the combination
of a bool return + reference argument, with an Optional return value.

Differential Revision: https://reviews.llvm.org/D104405
2021-06-29 15:10:46 -07:00
Aaron Puchert e0b90771c3 Thread safety analysis: Rename parameters of ThreadSafetyAnalyzer::intersectAndWarn (NFC)
In D104261 we made the parameters' meaning slightly more specific, this
changes their names accordingly. In all uses we're building a new lock
set by intersecting existing locksets. The first (modifiable) argument
is the new lock set being built, the second (non-modifiable) argument is
the exit set of a preceding block.

Reviewed By: aaron.ballman, delesley

Differential Revision: https://reviews.llvm.org/D104649
2021-06-29 23:56:52 +02:00
Aaron Puchert f664e2ec37 Thread safety analysis: Always warn when dropping locks on back edges
We allow branches to join where one holds a managed lock but the other
doesn't, but we can't do so for back edges: because there we can't drop
them from the lockset, as we have already analyzed the loop with the
larger lockset. So we can't allow dropping managed locks on back edges.

We move the managed() check from handleRemovalFromIntersection up to
intersectAndWarn, where we additionally check if we're on a back edge if
we're removing from the first lock set (the entry set of the next block)
but not if we're removing from the second lock set (the exit set of the
previous block). Now that the order of arguments matters, I had to swap
them in one invocation, which also causes some minor differences in the
tests.

Reviewed By: delesley

Differential Revision: https://reviews.llvm.org/D104261
2021-06-29 23:56:52 +02:00
Arthur Eubanks cb3580e7ad [OpaquePtr][BitcodeWriter] Handle attributes with types
For example, byval.

Skip the type attribute auto-upgrade if we already have the type.

I've actually seen this error of the ValueEnumerator missing a type
attribute's type in a non-opaque pointer context.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D105138
2021-06-29 14:47:29 -07:00
Nikita Popov b810600a93 [Test] Regenerate test checks (NFC)
Make these follow the update_test_checks.py format.
2021-06-29 23:44:56 +02:00
Matt Arsenault 990278d026 CodeGen: Store LLT instead of uint64_t in MachineMemOperand
GlobalISel is relying on regular MachineMemOperands to track all of
the memory properties of accesses. Just the raw byte size is
insufficent to disambiguate all situations. For example, if we need to
split an unaligned extending load, we need to know the number of bits
in the original source value and can't infer it from the result
type. This is also a problem for extending vector loads.

This does decrease the maximum representable size from the full
uint64_t bytes to a maximum of 16-bits. No in tree testcases hit this,
other than places using UINT64_MAX for unknown sizes. This may be an
issue for G_MEMCPY and co., although they can just use unknown size
for large static sizes. This also has potential for backend abuse by
relying on the type when it really shouldn't be relevant after
selection.

This does not include the necessary MIR printer/parser changes to
represent this.
2021-06-29 17:38:51 -04:00
Matt Arsenault 49fa6abf74 Revert "GlobalISel: Use MMO helper for getting the size in bits"
This reverts commit dc98adfb44.

This should still be done, but this is currently causing some commit
ordering issues.
2021-06-29 17:38:51 -04:00
Akira Hatanaka 8d21d54725 [CodeGen] Stop creating fake FunctionDecls when generating IR for
functions implicitly generated by the compiler

These fake functions would cause clang to crash if the changes proposed
in https://reviews.llvm.org/D98799 were made.
2021-06-29 14:22:33 -07:00
Duncan P. N. Exon Smith ac2bec5add OpaquePtr: Support i32** with --force-opaque-pointers
4506f614cb fixed parsing of textual IR to
reject `ptr*`, but broke the auto-conversion of `i32**` to `ptr` with
`--force-opaque-pointers`.

Get that working again by refactoring LLParser::parseType to only send
`ptr`-spelled pointers into the type suffix logic when it's the return
of a function type. This also rejects `ptr addrspace(3) addrspace(2)`,
which 1e6303e60c invadvertently started
accepting. Just the default top-level error message for the
double-addrspace since I had trouble thinking of something nice;
probably it's fine as is (it doesn't look valid the way that `ptr*`
does).

Differential Revision: https://reviews.llvm.org/D105146
2021-06-29 14:10:29 -07:00
Alexander Shaposhnikov 6d72845a85 [llvm-objcopy][MachO] Code cleanup
1. Remove unnecessary templates.
2. Fix potentially unaligned reads inside constructSection.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D105089
2021-06-29 14:08:23 -07:00
Stella Stamenova c8a9c78e17 [lldb] Fix debug_loc.s which was broken after https://reviews.llvm.org/D103502
An empty location is now printed as <empty>
2021-06-29 13:54:48 -07:00
Dhruva Chakrabarti 2240b41ee4 [libomptarget] [amdgpu] Fix default setting of max flat workgroup size
When max flat workgroup size is not specified, it is set to the default
workgroup size. This prevents kernel launch with a workgroup size larger
than the default. The fix is to ignore a size of 0 and treat it as
unspecified.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D105073
2021-06-29 13:47:24 -07:00
Siva Chandra Reddy 58af0d567d [libc] Allow target architecture independent configs
Previously, we required entrypoints.txt for every target architecture
supported by a target OS. With this change, we allow architecture
independent config for a target OS. That is, if an architecture specific
entrypoints.txt is missing, then a generic entrypoints.txt for that
target OS will be used.

Reviewed By: caitlyncano

Differential Revision: https://reviews.llvm.org/D105147
2021-06-29 20:41:28 +00:00
Stella Stamenova 9952d591cc [lldb] Fix globals-bss.cpp which was broken in https://reviews.llvm.org/D105055
-S replaced -s, so the test needs to be updated to use the new option
2021-06-29 13:39:18 -07:00
Jianzhou Zhao ae6648cee0 [dfsan] Expose dfsan_get_track_origins to get origin tracking status
This allows application code checks if origin tracking is on before
printing out traces.

-dfsan-track-origins can be 0,1,2.
The current code only distinguishes 1 and 2 in compile time, but not at runtime.
Made runtime distinguish 1 and 2 too.

Reviewed By: browneee

Differential Revision: https://reviews.llvm.org/D105128
2021-06-29 20:32:39 +00:00
Stella Laurenzo 485cc55edf [mlir] Generare .cpp.inc files for dialects.
* Previously, we were only generating .h.inc files. We foresee the need to also generate implementations and this is a step towards that.
* Discussed in https://llvm.discourse.group/t/generating-cpp-inc-files-for-dialects/3732/2
* Deviates from the discussion above by generating a default constructor in the .cpp.inc file (and adding a tablegen bit that disables this in case if this is user provided).
* Generating the destructor started as a way to flush out the missing includes (produces a link error), but it is a strict improvement on its own that is worth doing (i.e. by emitting key methods in the .cpp file, we root vtables in one translation unit, which is a non-controversial improvement).

Differential Revision: https://reviews.llvm.org/D105070
2021-06-29 20:10:30 +00:00
Stella Stamenova bb2cfca2f3 Revert D104488 and friends since it broke the windows bot
Reverts commits:
"Fix failing tests after https://reviews.llvm.org/D104488."
"Fix buildbot failure after https://reviews.llvm.org/D104488."
"Create synthetic symbol names on demand to improve memory consumption and startup times."

This series of commits broke the windows lldb bot and then failed to fix all of the failing tests.
2021-06-29 12:58:55 -07:00
Eugene Zhulenev c1194c2ec3 [mlir:Async] Change async-parallel-for block size/count calculation
Depends On D105037

Avoid creating too many tasks when the number of workers is large.

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D105126
2021-06-29 12:57:11 -07:00
Eugene Zhulenev f57b2420b2 [mlir:Async] Add an async reference counting pass based on the user defined policy
Depends On D104999

Automatic reference counting based on the liveness analysis can add a lot of reference counting overhead at runtime. If the IR is known to be constrained to few particular "shapes", it's much more efficient to provide a custom reference counting policy that will specify where it is required to update the async value reference count.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D105037
2021-06-29 12:53:09 -07:00
Nicolas Vasilache a77524cd2c [mlir][Linalg] Add a ComprehensiveModuleBufferizePass and support for CallOp analysis(9/n)
This revision adds the minimal plumbing to create a simple ComprehensiveModuleBufferizePass that can behave conservatively in the presence of CallOps.

A topological sort of caller/callee is performed and, if the call-graph is cycle-free, analysis can proceed.

Differential revision: https://reviews.llvm.org/D104859
2021-06-29 19:18:22 +00:00
Stefan Pintilie 90dfd05919 [Clang] Add option to handle behaviour of vector bool/vector pixel.
Added the option `-altivec-src-compat=[mixed,gcc,xl]`. The default at this time is `mixed`.

The default behavior for clang is for all vector compares to return a scalar unless the vectors being
compared are vector bool or vector pixel. In that case the compare returns a
vector. With the gcc case all vector compares return vectors and in the xl case
all vector compares return scalars.

This patch does not change the default behavior of clang.

This option will be used in future patches to implement behaviour compatibility for the vector bool/pixel types.

Reviewed By: bmahjour

Differential Revision: https://reviews.llvm.org/D103615
2021-06-29 14:07:12 -05:00
Leonard Chan 8e74668e96 [NFC][compiler-rt][hwasan] Re-use ring buffer size calculation
Users can call HwasanThreadList::GetRingBufferSize rather than RingBufferSize
to prevent having to do the calculation in RingBufferSize. This will be useful
for Fuchsia where we plan to initialize the stack ring buffer separately from
the rest of thread initialization.

Differential Revision: https://reviews.llvm.org/D104823
2021-06-29 11:57:33 -07:00
Fangrui Song d4dcb55c70 [llvm-readobj] Make -s and -t match llvm-readelf
llvm-readobj is an internal testing tool for binary formats. Its output and
command line options do not need to be stable. It isn't supposed to be part of a
build process.

llvm-readelf was created as a user-facing utility and its interface intends to
be compatible with GNU readelf (unless there are good reasons not to).

The two tools have mostly compatible options. -s and -t are noticeable
exceptions due to history. I think the cost of keeping the inconsistency
overweighs the little history-compatible benefit and hinders transition from
cl::opt to OptTable, so let's change it.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D105055
2021-06-29 11:56:26 -07:00
Leonard Chan c4a00ed851 [NFC][compiler-rt][hwasan] Move GetCurrentThread to hwasan.cpp
We can reuse the same implementation for getting the current thread on fuchsia.

Differential Revision: https://reviews.llvm.org/D104824
2021-06-29 11:55:30 -07:00
Fangrui Song a9854045f6 [test] Change -t to --syms and -s to -S for llvm-readobj RUN lines
-s and -t will be changed to improve consistency with llvm-readelf.
The inconsistency issue regularly contributes to confusion using the two tools.
2021-06-29 11:50:31 -07:00
Nikita Popov c4de78e91c [SanitizerCoverage] Fix global type check with opaque pointers
The code was previously relying on the fact that an incorrectly
typed global would result in the insertion of a BitCast constant
expression. With opaque pointers, this is no longer the case, so
we should check the type explicitly.
2021-06-29 20:32:14 +02:00
Fangrui Song 69937a8080 [llvm-objcopy][MachO] Support ARM64_RELOC_ADDEND
An ARM64_RELOC_ADDEND relocation reuses the symbol field for the addend value.
We should pass through such relocations.

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D104967
2021-06-29 11:23:30 -07:00
Jacob Hegna 7b639f5095 [NFC] clang-format on InlineCost.cpp and InlineAdvisor.h. 2021-06-29 18:15:27 +00:00
Nikita Popov f8aaec19e6 [OpaquePtr] Support forward references in textual IR
Currently, LLParser will create a Function/GlobalVariable forward
reference based on the desired pointer type and then modify it when
it is declared. With opaque pointers, we generally do not know the
correct type to use until we see the declaration.

Solve this by creating the forward reference with a dummy type, and
then performing a RAUW with the correct Function/GlobalVariable when
it is declared. The approach is adopted from
b5b55963f6.

This results in a change to the use list order, which is why we see
test changes on some module passes that are not stable under use list
reordering.

Differential Revision: https://reviews.llvm.org/D104950
2021-06-29 20:10:31 +02:00
Craig Topper 9132299836 [LegalizeTypes][VE] Don't Expand BITREVERSE/BSWAP during type legalization promotion if they will be promoted for NVT in op legalization.
We were trying to expand these if they were going to be expanded
in op legalization so that we generated the minimum number of
operations. We failed to take into account that NVT could be
promoted to another legal type in op legalization.

Hoping this fixes the issue on the VE target reported as a follow
up to D96681. The check line changes were taken from before
1e46b6f401 so this patch does
appear to improve some cases that had previously regressed.
2021-06-29 11:00:11 -07:00
Jonas Devlieghere 71be4db05b [lldb] Check for the mangled symbol name for objc_copyRealizedClassList_nolock
When we check whether the Objective-C SPI is available, we need to check
for the mangled symbol name. Unlike `objc_copyRealizedClassList`, which
is C exported, the `nolock` variant is not.

Differential revision: https://reviews.llvm.org/D105136
2021-06-29 10:58:35 -07:00
Louis Dionne a562853a51 [libc++] NFC: Fix return-by-const-value and pass-by-const-value typos
While we can debate on the value of passing by const value, there is no
arguing that it's confusing to do so in some circumstances, such as when
marking a pointer parameter as being const (did you mean a pointer-to-const?).
This commit fixes a few issues along those lines.
2021-06-29 13:57:04 -04:00
Nick Desaulniers 3999dcae5e [Inline] prevent inlining on noprofile mismatch
Similar to
commit bc044a88ee ("[Inline] prevent inlining on stack protector mismatch")

The noprofile function attribute is meant to prevent compiler
instrumentation from being inserted into a function. Inlining may defeat
the developer's intent. If the caller and callee don't either BOTH have
the attribute or BOTH lack the attribute, suppress inline substitution.

This matches behavior being proposed in GCC:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573511.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80223

Add LangRef entry for noprofile fn attr, similar to text added in D93422
and D104944.

Reviewed By: MaskRay, melver, phosek

Differential Revision: https://reviews.llvm.org/D104810
2021-06-29 10:32:03 -07:00
Melanie Blower aaba37187f [clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options
Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D104729
2021-06-29 13:26:23 -04:00
Akira Hatanaka 952944c12c [ObjC][ARC] Don't add operand bundle clang.arc.attachedcall to a call if
the call already has the operand bundle

This bug was causing the call to `replaceAllUsesWith` to crash because
the old call instruction and the new call instruction were the same.

rdar://74957948

Differential Revision: https://reviews.llvm.org/D97824
2021-06-29 10:23:01 -07:00
Alexey Bataev 129ae515fb [INSTCOMBINE] Transform reduction(shuffle V, poison, unique_mask) to reduction(V).
After SLP + LTO we may have have reduction(shuffle V, poison,
mask). This can be simplified to just reduction(V) if the mask is only
for single vector and just all elements from this vector are permuted,
  without reusing, replacing with undefs and/or other values, etc.

Differential Revision: https://reviews.llvm.org/D105053
2021-06-29 10:02:38 -07:00
Michael Kruse 5d933c0b0c [Flang][test] Fix Windows buildbot after D104930.
Add

    REQUIRES: shell

to the unpack.f90 test that executes a UNIX shell script.
2021-06-29 17:01:45 +00:00
Raphael Isemann c00032321a [lldb] Skip TestPairFromStdModule for now
I didn't get around to fix this change and the original commit itself seems
fine, so this looks like an existing LLDB/Clang bug that was just uncovered
by this change. Skipping while I'm investigating.
2021-06-29 19:01:11 +02:00