Commit Graph

406433 Commits

Author SHA1 Message Date
Philip Reames 740057d185 [funcattrs] Infer writeonly argument attribute
This change extends the current logic for inferring readonly and readnone argument attributes to also infer writeonly.

This change is deliberately minimal; there's a couple of areas for follow up.
* I left out all call handling and thus any benefit from the SCC walk. When examining the test changes, I realized the existing code is imprecise, and am going to fix that in it's own revision before adding in the writeonly handling. (Mostly because updating the tests is hard when I, the human, can't figure out whether the result is correct.)
* I left out handling for storing a value (as opposed to storing to a pointer). This should benefit readonly/readnone as well, and applies to a bunch of other instructions. Seemed worth having as a separate review.

Differential Revision: https://reviews.llvm.org/D114963
2021-12-02 13:04:09 -08:00
Alexey Bataev a9036f2eb4 [OPENMP]Fix error emission for dependent expressions in iterators for depend clauses.
Need to postpone analysis for addressable lvalue in a depend clause with
iterators, otherwise the incorrect error message is emitted.

Differential Revision: https://reviews.llvm.org/D114653
2021-12-02 12:59:03 -08:00
Ron Lieberman 8f4013ad46 Restric xfail on openmp/libomptarget/test/mapping/reduction_implicit_map.cpp to amdgcn-amd-amdhsa 2021-12-02 20:58:26 +00:00
Vitaly Buka d48d8670b5 [NFC][sanitizer] Rename RssLimitExceeded -> IsRssLimitExceeded 2021-12-02 12:52:00 -08:00
Nico Weber 78de182425 [gn build] (manually) port e0b259f22c 2021-12-02 15:50:56 -05:00
Ron Lieberman f87c2c637e xfail: libomptarget reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes 2021-12-02 20:38:25 +00:00
Noah Shutty e0b259f22c [llvm] [Support] Add CURL HTTP Client.
Provides an implementation of `HTTPClient` that wraps libcurl.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D112753
2021-12-02 20:30:59 +00:00
Ron Lieberman ef8e9bee1a Revert "xfail: reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes"
This reverts commit 8b646f212e.
2021-12-02 20:30:03 +00:00
Kirill Stoimenov 351ef92cd9 [ASan] Fixed asan_mapping.h format.
Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D114987
2021-12-02 20:24:44 +00:00
Ron Lieberman 8b646f212e xfail: reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes 2021-12-02 20:22:11 +00:00
Nikolas Klauser d2b0df35af [libc++][NFC] Update namespace comments in include/
update the namspace comments in include/

Reviewed By: ldionne, #libc

Spies: smeenai, libcxx-commits

Differential Revision: https://reviews.llvm.org/D114947
2021-12-02 21:06:59 +01:00
spupyrev 93a2c2919f profi - a flow-based profile inference algorithm: Part III (out of 3)
This is a continuation of D109860 and D109903.

An important challenge for profile inference is caused by the fact that the
sample profile is collected on a fully optimized binary, while the block and
edge frequencies are consumed on an early stage of the compilation that operates
with a non-optimized IR. As a result, some of the basic blocks may not have
associated sample counts, and it is up to the algorithm to deduce missing
frequencies. The problem is illustrated in the figure where three basic
blocks are not present in the optimized binary and hence, receive no samples
during profiling.

We found that it is beneficial to treat all such blocks equally. Otherwise the
compiler may decide that some blocks are “cold” and apply undesirable
optimizations (e.g., hot-cold splitting) regressing the performance. Therefore,
we want to distribute the counts evenly along the blocks with missing samples.
This is achieved by a post-processing step that identifies "dangling" subgraphs
consisting of basic blocks with no sampled counts; once the subgraphs are
found, we rebalance the flow so as every branch probability is 50:50 within the
subgraphs.

Our experiments indicate up to 1% performance win using the optimization on
some binaries and a significant improvement in the quality of profile counts
(when compared to ground-truth instrumentation-based counts)

{F19093045}

Reviewed By: hoy

Differential Revision: https://reviews.llvm.org/D109980
2021-12-02 12:01:30 -08:00
Nico Weber b87fe58dce [gn build] (manually) port 9e3552523e (no more old mach-o lld) 2021-12-02 15:01:07 -05:00
Fangrui Song 353fe72ca3 [ELF] Hint -z nostart-stop-gc for __start_ undefined references
Make users aware what to do with ld.lld 13.0.0 / GNU ld<2015-10 --gc-sections
behavior.

Differential Revision: https://reviews.llvm.org/D114830
2021-12-02 11:58:25 -08:00
Matt Arsenault 2f0a571418 Reapply "OpenMP: Start calling setTargetAttributes for generated kernels"
This reverts commit 25eb7fa01d.

Previous buildbot failures appear to have been a fluke from a dirty
build.
2021-12-02 14:55:56 -05:00
Vitaly Buka 655c0bfe2c [NFC][sanitizer] Use more bytes of sanitizer_stack_store_test pointers 2021-12-02 11:49:29 -08:00
Leonard Chan 534d105e03 [compiler-rt] Fix incorrect variable names used 2021-12-02 11:46:50 -08:00
Vitaly Buka 25feff4b2e [sanitizer] Start background thread once
Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D114933
2021-12-02 11:45:37 -08:00
Keith Smiley be4e789d21 [Bazel] Remove old macho lld port
This code and cmake was removed in https://reviews.llvm.org/D114842

Differential Revision: https://reviews.llvm.org/D114976
2021-12-02 11:44:48 -08:00
Vitaly Buka 67207797e9 [asan] Remove confusing workaround
The goal is to identify the bot and try to fix it.

SetSoftRssLimitExceededCallback is AsanInitInternal as I assume
that only MaybeStartBackgroudThread needs to be delayed to constructors.
Later I want to move MaybeStartBackgroudThread call into sanitizer_common.

If it needs to be reverted please provide to more info, like bot, or details about setup.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D114934
2021-12-02 11:44:40 -08:00
David Blaikie ff618a963a Simplify the libcxx std::string_view gdb pretty printer
Seems better to rely on the existing formatting, makes the output
smaller/simpler - this is consistent with libstdc++'s std::string_view
pretty printing too.

Differential Revision: https://reviews.llvm.org/D113244
2021-12-02 11:36:38 -08:00
Reid Kleckner 482b6f2a3d [Bazel] Remove old MachO LLD from the Bazel build
Updates Bazel files for 9e3552523e
2021-12-02 11:30:26 -08:00
Keith Smiley 9e3552523e [lld-macho] Remove old macho darwin lld
During the llvm round table it was generally agreed that the newer macho
lld implementation is feature complete enough to replace the old
implementation entirely. This will reduce confusion for new users who
aren't aware of the history.

Differential Revision: https://reviews.llvm.org/D114842
2021-12-02 11:04:49 -08:00
spupyrev 98dd2f9ed3 profi - a flow-based profile inference algorithm: Part II (out of 3)
This is a continuation of D109860.

Traditional flow-based algorithms cannot guarantee that the resulting edge
frequencies correspond to a *connected* flow in the control-flow graph. For
example, for an instance in the attached figure, a flow-based (or any other)
inference algorithm may produce an output in which the hot loop is disconnected
from the entry block (refer to the rightmost graph in the figure). Furthermore,
creating a connected minimum-cost maximum flow is a computationally NP-hard
problem. Hence, we apply a post-processing adjustments to the computed flow
by connecting all isolated flow components ("islands").

This feature helps to keep all blocks with sample counts connected and results
in significant performance wins for some binaries.
{F19077343}

Reviewed By: hoy

Differential Revision: https://reviews.llvm.org/D109903
2021-12-02 11:04:21 -08:00
Aart Bik 543924284f [mlir][bufferization] fixed typo in to_memref doc
Reviewed By: pifon2a

Differential Revision: https://reviews.llvm.org/D114824
2021-12-02 10:55:57 -08:00
Alexey Bataev ba74bb3a22 [SLP]Fix reused extracts cost.
If the extractelement instruction is used multiple times in the
different tree entries (either vectorized, or gathered), need to
compensate the scalar cost of such instructions. They are completely
removed if all users are part of the tree but we need to compensate the
cost only once for each instruction.

Differential Revision: https://reviews.llvm.org/D114958
2021-12-02 10:52:00 -08:00
Vitaly Buka 78cc133c63 [sanitizer] Add delta compression stack depot
Compress by factor 4x, takes about 10ms per 8 MiB block.

Depends on D114498.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D114503
2021-12-02 10:46:41 -08:00
Vitaly Buka 7185b1f406 [sanitizer] Add compress_stack_depot flag
Depends on D114494.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D114495
2021-12-02 10:42:53 -08:00
Reid Kleckner 8270ff86a1 [ELF] Fix driver.test after 8c3641d0 when cwd is readonly 2021-12-02 10:25:04 -08:00
Vitaly Buka 323bfad72d [sanitizer] DEFINE_REAL_PTHREAD_FUNCTIONS for hwasan, lsan, msan
It should be NFC, as they already intercept pthread_create.

This will let us to fix BackgroundThread for these sanitizerts.
In in followup patches I will fix MaybeStartBackgroudThread for them
and corresponding tests.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D114935
2021-12-02 10:24:04 -08:00
Stella Stamenova c24860118a [lldb] Skip two lldb tests on Windows because they are flaky
These tests work fine with VS2017, but become more flaky with VS2019 and the buildbot is about to get upgraded.

Differential Revision: https://reviews.llvm.org/D114907
2021-12-02 09:53:28 -08:00
Mircea Trofin ced5fd8dbf [bazel][mlgo] Remove the mlgo-related build excludes
They aren't needed anymore, we handle conditional compilation in those
files.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D114970
2021-12-02 09:51:03 -08:00
Florian Hahn 222442ec2d
[BasicAA] Add tests for strcat/strncat/strcpy. 2021-12-02 17:38:07 +00:00
Florian Hahn 68782a860d
[DSE] Read after strcpy test. 2021-12-02 17:37:59 +00:00
Joseph Huber 96ff74a0d5 [OpenMP] Remove the new runtime default for AMDGPU
The new runtime is currently broken for AMD offloading. This patch makes
the default the old runtime only for the AMD target.

Reviewed By: ronlieb

Differential Revision: https://reviews.llvm.org/D114965
2021-12-02 12:35:58 -05:00
Kazu Hirata 262dd1e42d [llvm] Use range-based for loops (NFC) 2021-12-02 09:27:47 -08:00
Kazu Hirata 22d82949b0 [llvm] Fix "unused variable" warnings 2021-12-02 09:20:17 -08:00
Alexey Bataev 8ceccbd321 [SLP]Outline and fix code for finding common insertelement vectors.
Need to outline the code for finding common vectors in insertelement
instructions into a separate function for future patches. It also
improves the process by adding some extra checks for early exit and
fixes a bug where it always finds the match because of erroneous compare
of the same values.

Differential Revision: https://reviews.llvm.org/D114909
2021-12-02 09:18:25 -08:00
David Green b8f1ccb0ac [ARM] Introduce i8neg and i8pos addressing modes
Some instructions with i8 immediate ranges can only hold negative values
(like t2LDRHi8), only hold positive values (like t2STRT) or hold +/-
depending on the U bit (like the pre/post inc instructions. e.g
t2LDRH_POST). This patch splits the AddrModeT2_i8 into AddrModeT2_i8,
AddrModeT2_i8pos and AddrModeT2_i8neg to make this clear.

This allows us to get the offset ranges of t2LDRHi8 correct in the
load/store optimizer, fixing issues where we could end up creating
instructions with positive offsets (which may then be encoded as ldrht).

Differential Revision: https://reviews.llvm.org/D114638
2021-12-02 17:10:26 +00:00
Nico Weber 2a2b3a3e3d [clang-cl] Define _MSVC_LANG for -std=c++2b
This matches the value that msvc v19.29 VS16.11 uses for
_MSVC_LANG with /std:c++latest.

Differential Revision: https://reviews.llvm.org/D114952
2021-12-02 12:09:20 -05:00
Paul Robinson d3fe1c1583 Reapply "[TLI checker] Add more tests"
This reverts commit 8cd61aac00.
I had missed one place in a test that needed updating; it passed on my
dirty build tree but not on a clean one.

Original commit message:

D114478 identified testing gaps; this patch fills them.

Differential Revision: https://reviews.llvm.org/D114913
2021-12-02 08:56:21 -08:00
Dmitry Vyukov 1b576585eb tsan: tolerate munmap with invalid arguments
We call UnmapShadow before the actual munmap, at that point we don't yet
know if the provided address/size are sane. We can't call UnmapShadow
after the actual munmap becuase at that point the memory range can
already be reused for something else, so we can't rely on the munmap
return value to understand is the values are sane.
While calling munmap with insane values (non-canonical address, negative
size, etc) is an error, the kernel won't crash. We must also try to not
crash as the failure mode is very confusing (paging fault inside of the
runtime on some derived shadow address).

Such invalid arguments are observed on Chromium tests:
https://bugs.chromium.org/p/chromium/issues/detail?id=1275581

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D114944
2021-12-02 17:50:51 +01:00
Alexey Bataev 92fbd76af5 [SLP]Improve registering and merging of compatible shuffles.
If several shuffle instructions are emitted, some of them might
same/compatible (less defined) with the previously emitted ones. Such
shuffles can be removed safely, improving the total cost of the
vectorized code.

Differential Revision: https://reviews.llvm.org/D114087
2021-12-02 08:48:29 -08:00
Dmitry Vyukov 97b4e63117 tsan: fix false positives in dynamic libs with static tls
The added test demonstrates  loading a dynamic library with static TLS.
Such static TLS is a hack that allows a dynamic library to have faster TLS,
but it can be loaded only iff all threads happened to allocate some excess
of static TLS space for whatever reason. If it's not the case loading fails with:

dlopen: cannot load any more object with static TLS

We used to produce a false positive because dlopen will write into TLS
of all existing threads to initialize/zero TLS region for the loaded library.
And this appears to be racing with initialization of TLS in the thread
since we model a write into the whole static TLS region (we don't what part
of it is currently unused):

WARNING: ThreadSanitizer: data race (pid=2317365)
  Write of size 1 at 0x7f1fa9bfcdd7 by main thread:
    0 memset
    1 init_one_static_tls
    2 __pthread_init_static_tls
    [[ this is where main calls dlopen ]]
    3 main
  Previous write of size 8 at 0x7f1fa9bfcdd0 by thread T1:
    0 __tsan_tls_initialization

Fix this by ignoring accesses during dlopen.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D114953
2021-12-02 17:47:05 +01:00
Sam Clegg 6f5c5cbe5f [lld][WebAssembly] Fix for debug relocations against undefined function symbols
This is very similar to https://reviews.llvm.org/D103557 but applies to
symbols which are undefined at link time rather than compile time.

We already have code that handles symbols which were defined at link
time but dead stripped by `--gc-sections` (See
`test/wasm/debug-removed-fn.ll`). In that case the symbols are not live
(!isLive()).  However, we can also have live symbols (which are
references by the program) but which are undefined at link time and are
imported by the linker.

In the test case here the symbol `undef` is used but is not defined
in the program but is imported by the linker due to the
`--import-undefined` flag.

Fixes: https://github.com/emscripten-core/emscripten/issues/15528

Differential Revision: https://reviews.llvm.org/D114921
2021-12-02 08:36:28 -08:00
Paul Robinson 8cd61aac00 Revert "[TLI checker] Add more tests"
This reverts commit 2778554971.

Some bots are failing on the updated tests.
2021-12-02 08:31:27 -08:00
David Greene 53adfa8750 [clang] Do not duplicate "EnableSplitLTOUnit" module flag
If clang's output is set to bitcode and LTO is enabled, clang would
unconditionally add the flag to the module.  Unfortunately, if the input were a
bitcode or IR file and had the flag set, this would result in two copies of the
flag, which is illegal IR.  Guard the setting of the flag by checking whether it
already exists.  This follows existing practice for the related "ThinLTO" module
flag.

Differential Revision: https://reviews.llvm.org/D112177
2021-12-02 08:24:56 -08:00
Paul Robinson 2778554971 [TLI checker] Add more tests
D114478 identified testing gaps; this patch fills them.

Differential Revision: https://reviews.llvm.org/D114913
2021-12-02 08:17:16 -08:00
Joseph Huber c99407e31c [OpenMP] Make the new device runtime the default
This patch changes the `-fopenmp-target-new-runtime` option which controls if
the new or old device runtime is used to be true by default.  Disabling this to
use the old runtime now requires using `-fno-openmp-target-new-runtime`.

Reviewed By: JonChesterfield, tianshilei1992, gregrodgers, ronlieb

Differential Revision: https://reviews.llvm.org/D114890
2021-12-02 11:11:45 -05:00
Sanjay Patel 3f8edce447 [InstCombine] add tests for icmp with mul op; NFC 2021-12-02 11:01:10 -05:00