Commit Graph

406412 Commits

Author SHA1 Message Date
Djordje Todorovic 2cdc6f2ca6 Reland "[LICM] Hoist LOAD without sinking the STORE"
When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.

Please consider this small example:

loop {
  var = *ptr;
  if (var) break;
  *ptr= var + 1;
}
After this patch, it will be:

var0 = *ptr;
loop {
  var1 = phi (var0, var2);
  if (var1) break;
  var2 = var1 + 1;
  *ptr = var2;
}
This addresses some problems from [0].

[0] https://bugs.llvm.org/show_bug.cgi?id=51193

Differential revision: https://reviews.llvm.org/D113289
2021-12-02 03:53:50 -08:00
Florian Hahn 47616c8855
[BasicAA] Add tests for memset_pattern{4,8,16}.
This also removes the existing memset_pattern.ll test, which was relying
on GVN. It is also covered by the new test directly.
2021-12-02 11:50:32 +00:00
Simon Pilgrim 6803d08c38 [DAG][PowerPC] Enable initial ISD::BITCAST SimplifyDemandedBits/SimplifyMultipleUseDemandedBits big-endian handling
This patch begins extending handling for peeking through bitcast nodes to big-endian targets as well as the existing little-endian case.

Differential Revision: https://reviews.llvm.org/D114676
2021-12-02 11:47:53 +00:00
Djordje Todorovic 8e757b2383 [LICM] Adding the test as a precommit for the D113289 2021-12-02 03:38:14 -08:00
David Green e629302558 [ARM] Correct range in isLegalAddressImm
The ranges in isLegalAddressImm were off by one, not allowing the
maximum values for unscaled offsets.

Differential Revision: https://reviews.llvm.org/D114636
2021-12-02 11:33:40 +00:00
Frederic Cambus 878ff1f9f8 [llvm-readobj] Add support for machine-independent NetBSD ELF core notes.
Notes generated in NetBSD core files provide additional information about
processes. These notes are described in core.5, which can be viewed here:
https://man.netbsd.org/core.5

Differential Revision: https://reviews.llvm.org/D114635
2021-12-02 12:10:17 +01:00
Florian Hahn 2de5f39e54
[BuildLibCalls] Add support for memset_pattern{4,8}.
Add support for memset_pattern{4,8} similar to the existing
memset_pattern16 handling.

Reviewed By: ab

Differential Revision: https://reviews.llvm.org/D114883
2021-12-02 11:04:25 +00:00
Nikita Popov a0ff26e08c [GlobalOpt] Fix assertion failure during instruction deletion
This fixes the assertion failure reported in https://reviews.llvm.org/D114889#3166417,
by making RecursivelyDeleteTriviallyDeadInstructionsPermissive()
more permissive. As the function accepts a WeakTrackingVH, even if
originally only Instructions were inserted, we may end up with
different Value types after a RAUW operation. As such, we should
not assume that the vector only contains instructions.

Notably this matches the behavior of the
RecursivelyDeleteTriviallyDeadInstructions() function variant which
accepts a single value rather than vector.
2021-12-02 11:58:39 +01:00
Frederic Cambus 69deb1371f Use cc/c++ instead of gcc/g++ on FreeBSD.
All supported FreeBSD platforms do not have GCC in base anymore.

Differential Revision: https://reviews.llvm.org/D114530
2021-12-02 11:52:40 +01:00
David Green 73c50ccf7a [ARM] Add additional postinc distribute tests and regenerate tests. NFC 2021-12-02 10:40:10 +00:00
Kiran Chandramohan 7ce8c6fcf1 [Flang] Replace notifyMatchFailure with TODO hard failures
For unimplemented patterns we revert to using TODO hard failures instead of
notifyMatchFailure.

For fir.select_type revert to using mlir::emiterror.
For the fir.embox TODO on a type with len params we cannot add a test since the type cannot be converted to llvm.

Adding negative tests using not and checking for the error message.
TODO exits with an error in a build without assertion but aborts in a
build with assertions. Abort requires using not with the --crash
option. The two different usages of not is handled by using a custom
command %not_todo_cmd which is converted to not or not --crash
depending on the presence or absence of assertions. Using llvm-config
to check the presence of assertions.

Reviewed By: clementval, awarzynski

Differential Revision: https://reviews.llvm.org/D114371
2021-12-02 10:25:02 +00:00
Simon Moll 6f25e754a0 Revert "Revert "[VE] Make VE official""
This reverts commit 27c9e8b45b.

Bugs exposed by AddressSanitizer have been reproduced and fixed locally:
* commit e37000f3bf
* commit 435d44bf8a
2021-12-02 11:19:37 +01:00
Florian Hahn d9bb9bd4bf
[InferAttrs] Add memset_pattern{4,8} declarations to test. 2021-12-02 10:11:55 +00:00
Fangrui Song c5bfffed48 [ELF] Discard input .note.gnu.build-id even with default --build-id=none
binutils 2.38 will adopt this behavior
https://sourceware.org/bugzilla/show_bug.cgi?id=28639

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D114910
2021-12-02 09:50:59 +00:00
Florian Hahn 0496edad49
[BuildLibCalls] Add additional attrs to memcpy_chk.
`memcpy_chk` can be treated like `memcpy`, with the exception that it
may not return (if it aborts the program).

See D114793 for a similar patch for `memset_chk`.

Reviewed By: xbolva00

Differential Revision: https://reviews.llvm.org/D114863
2021-12-02 09:50:14 +00:00
Simon Moll e37000f3bf [VE][NFC] Fix use-after-free in PVFMK expansion
There is custom expansion code for packed VFMK Pseudos in the VE
backend.  This code erased the Pseudo without telling
ExpandPostRAPseudos about it, causing the generic expansion function to
access the erased Pseudo.  This bug triggered in the
test/CodeGen/VE/VELIntrinsics/vfmk.ll test with asan-enabled builds.

Detected by:
sanitizer-x86_64-linux-fast
(https://lab.llvm.org/buildbot/#/builders/5/builds/15393)
2021-12-02 10:41:11 +01:00
Lang Hames 905381dc10 [ORC] Fix ambiguous call to overloaded function.
This should fix the build failure at
https://lab.llvm.org/buildbot#builders/110/builds/8359
2021-12-02 20:41:09 +11:00
Kirill Bobyrev d3a4ef3568 [clangd] IncludeClenaer: Don't mark forward declarations of a class if it's declared in the main file
This will mark more headers that are unrelated to used symbol but contain its
forawrd declaration. E.g. the following are examples of headers forward
declaring `llvm::StringRef`:

- clang/include/clang/Basic/Cuda.h
- llvm/include/llvm/Support/SHA256.h
- llvm/include/llvm/Support/TrigramIndex.h
- llvm/include/llvm/Support/RandomNumberGenerator.
- ... and more (~50 in total)

This patch is a reduced version of D112707 which was controversial.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D114864
2021-12-02 10:26:08 +01:00
Valentin Clement 529d0942da
[fir] Add fir numeric intrinsic runtime call builder
This patch adds the FIR builder to generate the numeric intrinsic
runtime call.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: rovka

Differential Revision: https://reviews.llvm.org/D114477

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2021-12-02 10:22:26 +01:00
Nikita Popov 55d392cc30 [llvm-c] Make LLVMAddAlias opaque pointer compatible
Deprecate LLVMAddAlias in favor of LLVMAddAlias2, which accepts a
value type and an address space. Previously these were extracted
from the pointer type.

Differential Revision: https://reviews.llvm.org/D114860
2021-12-02 09:21:16 +01:00
Nikita Popov bc61e5e90b [GlobalOpt] Add test for PR39751 (NFC)
This has been fixed by D114889, as noted in the comments.
2021-12-02 09:17:33 +01:00
mydeveloperday 57b95aed2a [clang-format] Add better support for co-routinues
Responding to a Discord call to help {D113977} and heavily inspired by the unlanded {D34225} add some support to help coroutinues from not being formatted from

```for co_await(auto elt : seq)```

to

```
for
co_await(auto elt : seq)
```

Because of the dominance of clang-format in the C++ community, I don't think we should make it the blocker that prevents users from embracing the newer parts of the standard because we butcher the layout of some of the new constucts.

Reviewed By: HazardyKnusperkeks, Quuxplusone, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D114859
2021-12-02 08:06:43 +00:00
Vitaly Buka 8aabde5a4b [NFC][sanitizer] Check &real_pthread_join
It's a weak function which may be undefined.
2021-12-01 23:59:33 -08:00
Jon Chesterfield fb9fc3c951 [openmp][amdgpu] Disable three tests in preparation for new runtime 2021-12-02 07:57:14 +00:00
David Green 646c872f9d [ARM] Teach getIntImmCostInst about the cost of saturating fp converts
Given a min(max(fptosi, INT_MIN), INT_MAX) with the correct constants,
we can now generate a fptosi.sat. But in the arm backend, the constant
can be treated as high cost, pulling it out of the basic block in a way
that the DAG combine can no longer see it. This teaches it again that it
is a low cost constant, not worth hoisting out.

Recommitted from 0e98659ea1 with a fix for APInt comparison.

Differential Revision: https://reviews.llvm.org/D114380
2021-12-02 07:56:27 +00:00
Lang Hames 758d54b462 [ORC] Add support for removing JITDylibs.
This allows JITDylibs to be removed from the ExecutionSession. Calling
ExecutionSession::removeJITDylib will disconnect the JITDylib from the
ExecutionSession and clear it (removing all trackers associated with it). The
JITDylib object will then be destroyed as soon as the last JITDylibSP pointing
at it is destroyed.
2021-12-02 17:36:32 +11:00
Lang Hames 9eb591f0ac [ORC] Only use JITDylib::GeneratorsMutex while running generators.
GeneratorsMutex should prevent lookups from proceeding through the
generators of a single JITDylib concurrently (since this could
result in redundant attempts to generate definitions). Mutation of
the generators list itself should be done under the session lock.
2021-12-02 17:36:32 +11:00
Lang Hames 9355d11597 [ORC] Hold ResourceTracker in MaterializationResponsibility.
This keeps the tracker alive for the lifetime of the MR. This is needed so that
we can check whether the tracker has become defunct before posting results (or
failure) for the MR.
2021-12-02 17:36:31 +11:00
Austin Kerbow da067ed569 [AMDGPU] Set most sched model resource's BufferSize to one
Using a BufferSize of one for memory ProcResources will result in better
ILP since it more accurately models the dependencies between memory ops
and their consumers on an in-order processor. After this change, the
scheduler will treat the data edges from loads as blocking so that
stalls are guaranteed when waiting for data to be retreaved from memory.
Since we don't actually track waitcnt here, this should do a better job
at modeling their behavior.

Practically, this means that the scheduler will trigger the 'STALL'
heuristic more often.

This type of change needs to be evaluated experimentally. Preliminary
results are positive.

Fixes: SWDEV-282962

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D114777
2021-12-01 22:31:28 -08:00
skc7 16b781e6d1 [AMDGPU][clang] Fix __builtin_nontemporal_store() failure on AMDGPU
Reviewed By: yaxunl, sameerds

Differential Revision: https://reviews.llvm.org/D114849
2021-12-02 05:53:25 +00:00
Phoebe Wang f13b43d570 [X86][FP16] Only generate approximate rsqrt when Reciprocal is true for half type
We have reasonable fast sqrt and accurate rsqrt for half type due to the
limited fractions. So neither do we need multi steps refinement for
rsqrt nor replace sqrt by rsqrt.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D114844
2021-12-02 13:52:45 +08:00
Phoebe Wang 4756a2f157 [X86] Insert FMUL for estimated non reciprocal SQRT when `RefinementSteps` = 0
Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D114843
2021-12-02 13:52:45 +08:00
Jonas Devlieghere fcd2d85cc9 [lldb] Skip test_launch_scripted_process_stack_frames with ASan
This test is failing on the sanitized bot because of a
heap-use-after-free. Disabling the test to turn the bot
green again.

rdar://85954489.
2021-12-01 21:35:00 -08:00
Igor Kudrin b0ac68ccb7 [ELF] Prevent internalizing used comdat symbol
When a comdat symbol is defined in both bitcode and regular object
files, which are contained in the same archive, the linker could lose
the flag that the symbol is used in the regular object file and allow
LTO to internalize it, which led to "error: undefined symbol".

The issue was introduced in D79300.

Differential Revision: https://reviews.llvm.org/D114801
2021-12-02 12:10:06 +07:00
Jacques Pienaar 86eb57b728 [mlir][drr] Simple heuristic to reduce chance of accidental nullptr dereference
When an attribute is optional & is given an additional constraint in
rewrite pattern that could lead to dereferencing null Attribute. Avoid
cases where the constraints checks attribute but has no check if null.

This should be improved to be more uniformly guarded.
2021-12-01 20:45:08 -08:00
Christudasan Devadasan 399b7de0ea [AMDGPU] Add a regclass flag for scalar registers
Along with vector RC flags, this scalar flag will
make various regclass queries like `isVGPR` more
accurate.

Regclasses other than vectors are currently set
with the new flag even though certain unallocatable
classes aren't truly scalars. It would be ok as long
as they remain unallocatable.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D110053
2021-12-01 23:31:07 -05:00
Joe Loser c16b13ebf9
[libc++] Implement P1989R2: range constructor for string_view
Implement P1989R2 which adds a range constructor for `string_view`.

Adjust `operator/=` in `path` to avoid atomic constraints caching issue
getting provoked from this PR.

Add defaulted template argument to `string_view`'s "sufficient
overloads" to avoid mangling issues in `clang-cl` builds. It is a
MSVC mangling bug that this works around.

Differential Revision: https://reviews.llvm.org/D113161
2021-12-01 23:16:36 -05:00
Vitaly Buka ae234a7545 [NFC][sanitizer] Fix "not used" warning in test 2021-12-01 20:16:25 -08:00
Jonas Devlieghere 8176768b46 [lldb] Fix DYLD_INSERT_LIBRARIES on AS
Don't make DYLD_INSERT_LIBRARIES conditional on the host triple
containing x86.
2021-12-01 20:03:05 -08:00
Philip Reames 3dfa76b695 [tests] Precommit tests for writeonly argument attribute inference 2021-12-01 19:48:29 -08:00
Matthias Springer 4479138de8 [mlir][linalg][bufferize] Bufferization of tensor.insert
This is a lightweight operation, useful for writing unit tests. It will be utilized for testing in subsequent commits.

Differential Revision: https://reviews.llvm.org/D114693
2021-12-02 11:58:01 +09:00
Kevin Athey 27c9e8b45b Revert "[VE] Make VE official"
Breaks fast buildbot.

This reverts commit a9d1d00b86.
2021-12-01 17:32:21 -08:00
Daniel Sanders 54e21df973 [unroll] Fix a functional change in an NFC patch
5c77aa2b91 [unroll] Use early return in shouldFullUnroll [nfc]
wasn't quite NFC since !(x <= y) is x > y rather than x >= y

Credit to Justin Bogner for spotting the bug

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D114894
2021-12-01 17:28:12 -08:00
Steven Wan f9d585d0dd Revert "[sanitizer] Add compress_stack_depot flag"
This is failing on clang-s390x-linux,
https://lab.llvm.org/buildbot/#/builders/94/builds/6748.
This reverts commit bf18253b0e.
2021-12-01 20:21:52 -05:00
Julian Lettner 863b117411 [TSan][Darwin] Prevent inlining of functions in tests
Prevent inlining of functions so we can FileCheck the generated stack
traces.
2021-12-01 17:00:52 -08:00
Jonas Devlieghere 8f329cee42 [lldb] Split TestCxxChar8_t
Split TestCxxChar8_t into two parts: one that check reading variables
without a process and another part with. This allows us to skip the
former on Apple Silicon, where lack of support for chained fix-ups
causes the test to fail.

Differential revision: https://reviews.llvm.org/D114819
2021-12-01 16:58:43 -08:00
Fabian Wolff 987a21522f [clang-tidy] Use `hasCanonicalType()` matcher in `bugprone-unused-raii` check
Fixes PR#52217.

Reviewed By: simon.giesecke

Differential Revision: https://reviews.llvm.org/D113429
2021-12-02 01:53:12 +01:00
LLVM GN Syncbot ab112c2964 [gn build] Port 170783f991 2021-12-02 00:48:10 +00:00
Noah Shutty 170783f991 [llvm] [Support] Add HTTP Client Support library.
This patch implements a small HTTP client library consisting primarily of the `HTTPRequest`, `HTTPResponseHandler`, and `BufferedHTTPResponseHandler` classes. Unit tests of the `HTTPResponseHandler` and `BufferedHTTPResponseHandler` are included.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D112751
2021-12-01 23:54:38 +00:00
Julian Lettner 6703fe25b7 [TSan][Darwin] Mark test unsupported 2021-12-01 15:50:10 -08:00