Commit Graph

425937 Commits

Author SHA1 Message Date
Joe Loser b2aec7e6ed
Revert "[libc++][test] Mark ranges.transform.pass.cpp UNSUPPORTED for AIX"
This reverts commit 3583826bb5.

Instead of marking the test unsupported for AIX, the choice is to bump the
timeout for CI as done in 76c7e1f2a8 and
222bd83d50

Differential Revision: https://reviews.llvm.org/D127242
2022-06-07 19:00:56 -06:00
Wael Yehia 0952cf5bbb [InstCombine] decomposeSimpleLinearExpr should bail out on negative operands.
InstCombine tries to rewrite

  %prod = mul nsw i64 %X,   Scale
  %acc = add nsw i64 %prod,   Offset
  %0 = alloca i8, i64 %acc, align 4
  %1 = bitcast i8* %0 to i32*
  Use ( %1 )

into

  %prod = mul nsw i64 %X,   Scale/4
  %acc = add nsw i64 %prod,   Offset/4
  %0 = alloca i32, i64 %acc, align 4
  Use (%0)

But it assumes Scale is unsigned, and performs an unsigned division.
So we should bail out if Scale cannot be interpreted as an unsigned safely.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126546
2022-06-08 00:57:25 +00:00
Lang Hames 1deaa9b8bd [JITLink][ELF][AArch64] Implement R_AARCH64_ABS64 relocation type.
Implement R_AARCH64_ABS64 relocation entry. This relocation type is generated
when creating a static function pointer to symbol.

Reviewed By: lhames, sgraenitz

Differential Revision: https://reviews.llvm.org/D126658
2022-06-07 17:56:10 -07:00
Kevin Athey 67069e1980 [MSAN] exclude android from pthread_getaffinity_np interceptor
Depends on https://reviews.llvm.org/D127185.

Differential Revision: https://reviews.llvm.org/D127264
2022-06-07 17:53:32 -07:00
Leonard Chan 13eb4fc3ce Revert "[NFC][compiler-rt][asan] Unify asan and lsan allocator settings"
This reverts commit dd045ddffc.

This broke the sanitizer-windows builder at https://lab.llvm.org/buildbot/#/builders/127/builds/30751.
2022-06-07 17:34:29 -07:00
Sunho Kim ab472c9615 [JITLink][ELF][AArch64] Implement R_AARCH64_LDST*_ABS_LO12_NC relocation types.
Implement R_AARCH64_LDST*_ABS_LO12_NC relocaiton entries by reusing PageOffset21
generic relocation edge. The difference between MachO backend is that in ELF,
the shift value is explicitly given by relocation type. lld generates the
relocation type that matches with instruction bitwidth, so getting the shift
value implicitly from instruction bytes should be fine in typical use cases.
2022-06-07 17:32:09 -07:00
Leonard Chan d1fb0a5a63 Fix for e1d84c421d
One of the checks in realloc_too_big.c actually printed a regular warning
and not an OOM error, so the check shouldn't be updated.
2022-06-07 17:28:24 -07:00
Leonard Chan 4b15e665f8 [compiler-rt][lsan] Choose lsan allocator via SANITIZER_CAN_USE_ALLOCATOR64
Rather than checking a bunch of individual platforms.

Differential Revision: https://reviews.llvm.org/D126825
2022-06-07 17:23:38 -07:00
Leonard Chan dd045ddffc [NFC][compiler-rt][asan] Unify asan and lsan allocator settings
This updates existing asan allocator settings to use the same allocator settings as what lsan uses for platforms where they already match.

Differential Revision: https://reviews.llvm.org/D126927
2022-06-07 17:21:19 -07:00
Derek Schuff 1e29c3a12f [WebAssembly][Objcopy] Check that --only-keep-debug removes known sections
NFC; Just update the test to ensure that both known and custom sections
are removed.
Review left over from https://reviews.llvm.org/D126509
2022-06-07 16:47:50 -07:00
Leonard Chan e1d84c421d [compiler-rt][sanitizer] Have all OOM-related error messages start with the same format
This way downstream tools that read sanitizer output can differentiate between OOM errors
reported by sanitizers from other sanitizer errors.

Changes:

- Introduce ErrorIsOOM for checking if a platform-specific error code from an "mmap" is an OOM err.
- Add ReportOOMError which just prepends this error message to the start of a Report call.
- Replace some Reports for OOMs with calls to ReportOOMError.
- Update necessary tests.

Differential Revision: https://reviews.llvm.org/D127161
2022-06-07 16:46:01 -07:00
Lang Hames 5368c685d9 [ORC-RT] Remove a stale comment. 2022-06-07 16:42:37 -07:00
Sunho Kim 25a9fb12e0 [JITLink][ELF][AArch64] Implement ADR_PREL_PG_HI21, ADD_ABS_LO12_NC.
Implements R_AARCH64_ADR_PREL_PG_HI21 and R_AARCH64_ADD_ABS_LO12_NC fixup edges
using the generic aarch64 patch edges.

Reviewed By: lhames, sgraenitz

Differential Revision: https://reviews.llvm.org/D126287
2022-06-07 16:42:37 -07:00
Kevin Athey 828c94c0f6 [MSAN] Add interceptor for pthread_getaffinity_np.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D127185
2022-06-07 16:27:44 -07:00
Kevin Athey 69cd7417f0 Add checks for -lresolv to sanitizer-ld test.
These were missed in https://reviews.llvm.org/D127145.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D127177
2022-06-07 16:07:02 -07:00
Wolfgang Pieb 213eb424e8 Revert "[Metadata] Add a resize capability to MDNodes and add a push_back interface to MDNodes"
This reverts commit e3f6eda8c6.

Failure in unittest on https://lab.llvm.org/buildbot*builders/171/builds/15666
2022-06-07 15:48:31 -07:00
Sanjay Patel cae993d4c8 [InstCombine] [InstCombine] reduce left-shift-of-right-shifted constant via demanded bits
If we don't demand low bits and it is valid to pre-shift a constant:
(C2 >> X) << C1 --> (C2 << C1) >> X

https://alive2.llvm.org/ce/z/_UzTMP

This is the reverse-order shift sibling to 82040d414b ( D127122 ).
It seems likely that we would want to add this to the SDAG version of
the code too to keep it on par with IR.
2022-06-07 18:43:27 -04:00
Sanjay Patel 0856a6cb7a [InstCombine] add tests for left-shift-of-right-shifted constant; NFC
The tests are adapted from the sibling folds' tests (see D127122).
2022-06-07 18:43:27 -04:00
Sanjay Patel a4d2c5ecaa [InstCombine] reduce code duplication for accessing type; NFC 2022-06-07 18:43:27 -04:00
owenca b5b33fbffb [clang-format] Skip parsing a block if it's nested too deep
Fixes #55912.

Differential Revision: https://reviews.llvm.org/D127183
2022-06-07 15:28:03 -07:00
Pengxuan Zheng 1b2c8b945b [NFC][test] Improve ecsymbols.test
* The yaml input is inlined into the test file.
* Unnecessary members and fields are removed.

Reviewed By: thieta

Differential Revision: https://reviews.llvm.org/D127235
2022-06-07 15:26:05 -07:00
Nico Weber 28c078e2c7 [gn build] (manually) port f3966eaf86 (_LIBCPP_ENABLE_DEBUG_MODE) 2022-06-07 18:13:13 -04:00
Douglas Yung 7805ae257f Revert "[clang-diff] Fix assertion error when dealing with wide strings"
This reverts commit e80748ff88.

This was causing a test failure on a buildbot: https://lab.llvm.org/buildbot/#/builders/139/builds/22964
2022-06-07 14:58:10 -07:00
Paul Kirth acfeb1a6c2 [compiler-rt] Avoid truncating Symbolizer output
Repalce the fixed buffer in SymbolizerProcess with InternalScopedString,
and simply append to it when reading data.

Fixes #55460

Reviewed By: vitalybuka, leonardchan

Differential Revision: https://reviews.llvm.org/D126580
2022-06-07 21:50:39 +00:00
Wolfgang Pieb e3f6eda8c6 [Metadata] Add a resize capability to MDNodes and add a push_back interface to MDNodes
A change to the allocation characteristics of MDNodes, introducing the ability
to add operands one at a time. This functionality is restricted to MDTuples.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D125998
2022-06-07 14:34:38 -07:00
Jason Molenda d572fc3b49 Skip TestConcurrentWatchBreak.py on Darwin arm64
This test depends on multiple threads with one of them
hitting a watchpoint at the same time as a breakpoint, and
can fail because of the way arm64 watchpoints are handled.
I added skips to most of these via

```
commit bef4da4a6a
Author: Jason Molenda <jason@molenda.com>
Date:   Wed May 25 16:05:16 2022 -0700

    Skip testing of watchpoint hit-count/ignore-count on multithreaded
```

but missed that this test is susceptable to the same issue.
2022-06-07 14:33:40 -07:00
Aart Bik 7482cd6869 [mlir][sparse] updated our sparse dialect doc with some recent changes
The `init` and `tensor` ops are renamed (and one moved to another dialect).

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D127169
2022-06-07 14:27:57 -07:00
Vitaly Buka d7df3f0a4b [NFC] Exctract getNoSanitizeMask lambda 2022-06-07 14:08:43 -07:00
Vitaly Buka f32ad5703e [NFC] Move part of SanitizerMetadata into private method 2022-06-07 14:08:43 -07:00
Mitch Phillips 5d9de5f446 [NFC] Clang-format parts of D126929 and D126100 2022-06-07 14:08:43 -07:00
Mitch Phillips f49a5844b6 [NFC][CodeGen] Rename method
Extracted from D84652.
2022-06-07 14:08:42 -07:00
Christopher Bate 53fe155b3f Revert "[mlir][vector] Allow unroll of contraction in arbitrary order"
Reverts commit 1469ebf838 (original commit)
Reverts commit a392a39f75 (build fix for above commit)

The commit broke tests in out-of-tree projects, indicating that some logical
error was made in the previous change but not covered by current tests.
2022-06-07 14:54:01 -06:00
Jason Molenda 8d5a6007f9 Track transition from launch dyld to shared-cache dyld
On macOS, a process will be launched with /usr/lib/dyld (the
dynamic linker) and the main binary by the kernel.  The
first thing the standalone dyld will do is call into the dyld
in the shared cache image.  This patch tracks the transition
between the dyld's at the very beginning of process startup.

In DynamicLoaderMacOS::NotifyBreakpointHit() there are two new
cases handled:

`dyld_image_dyld_moved` which is the launch /usr/lib/dyld indicating
that it is about call into the shared cache dyld ane evict itself.
lldb will remove the notification breakpoint it set, clear the binary
image list entirely, get the notification function pointer value out
of the dyld_all_image_infos struct (which is the notification fptr
in the to-be-run shared-cache dyld) and put an address breakpoint
there.

`dyld_notify_adding` is then called by shared-cache dyld, and we
detect this case by noticing that we have an empty binary image list,
normally impossibe, and treating this as if we'd just started a
process attach/launch.

Differential Revision: https://reviews.llvm.org/D127247
rdar://84222158
2022-06-07 13:34:30 -07:00
Louis Dionne f3966eaf86 [libc++] Make the Debug mode a configuration-time only option
The debug mode has been broken pretty much ever since it was shipped
because it was possible to enable the debug mode in user code without
actually enabling it in the dylib, leading to ODR violations that
caused various kinds of failures.

This commit makes the debug mode a knob that is configured when
building the library and which can't be changed afterwards. This is
less flexible for users, however it will actually work as intended
and it will allow us, in the future, to add various kinds of checks
that do not assume the same ABI as the normal library. Furthermore,
this will make the debug mode more robust, which means that vendors
might be more tempted to support it properly, which hasn't been the
case with the current debug mode.

This patch shouldn't break any user code, except folks who are building
against a library that doesn't have the debug mode enabled and who try
to enable the debug mode in their code. Such users will get a compile-time
error explaining that this configuration isn't supported anymore.

In the future, we should further increase the granularity of the debug
mode checks so that we can cherry-pick which checks to enable, like we
do for unspecified behavior randomization.

Differential Revision: https://reviews.llvm.org/D122941
2022-06-07 16:33:53 -04:00
Philip Reames 89c4b29e8d [GuardWidening] Fix a nasty cast bug in c2eccc6
c2eccc6 introduced a call to etHasNoUnsignedWrap which implicitly assumes that Inst is a OverflowingBinaryOperator.  This is frequently untrue, but was not caught because cast<Ty>(X) has been broken, see https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.

I considered reverting this, but since doing so re-introduces a nasty miscompile of its own, I decided to fix forward instead.

I'll note that this is a particularly nasty form of the cast<Ty>(X) issue.  Because the cast was succeeding unexpected, we were writing data to instructions which weren't OBOs.  This could result in near arbitrary data or memory corruption.  I'm a bit shocked that the sanitizers didn't find this TBH.
2022-06-07 13:27:13 -07:00
Philip Reames 8a0cd23326 Revert "[MemDep][NFCI] Remove redundant dyn_cast, replace with cast"
This reverts commit 180d3f251d.  This commit is simply wrong.  IsLoad is set within the same file based on modref state, not whether the instruction is a LoadInst.

This went uncaught because cast<Ty>(X) has been broken.  See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.
2022-06-07 13:21:31 -07:00
Sunho Kim 9f29916169 [JITLink][AArch64] Refactor isLoadStoreImm12 check out of getPageOffset12Shift.
The separate isLoadStoreImm12 predicate will be used for validating ELF/aarch64
ldst relocation types.

Reviewed By: lhames, sgraenitz

Differential Revision: https://reviews.llvm.org/D126628
2022-06-07 13:18:12 -07:00
Florian Hahn b0c9a71be0
[VPlan] Handle VPInst without underlying instr in VPInterleavedAccess.
This violation is hidden while `cast` is missing an isa assertion after
D123901.
2022-06-07 21:00:49 +01:00
Joseph Huber f06731e3c3 [Binary] Make the OffloadingImage type own the memory
Summary:
The OffloadingBinary uses a convenience struct to help manage the memory
that will be serialized using the binary format. This currently uses a
reference to an existing buffer, but this should own the memory instead
so it is easier to work with seeing as its only current use requires
saving the buffer anyway.
2022-06-07 15:56:09 -04:00
Joseph Huber 9db2f32336 [Binary] Align the image offset in OffloadBinary
Summary:
The OffloadBinary wraps around an embedded device image, commonly an ELF
or LLVM BC file. These file formats have alignment requirements for
parsing, so if the image is stored at an un-aligned offset from the
beginning of the file we will be unable to parse the embeded image
without copying the image buffer. This patch adds alignment padding
before the binary image is appended to ensure we can parse the symbolic
file it contains in-place without copying memory.
2022-06-07 15:56:08 -04:00
Aaron Ballman d46e7aecb4 Update the C2x status page from latest working draft
This adds the papers for the Jun, Sep, and Dec 2021 meetings. 2022
papers will be handled in a follow-up.
2022-06-07 15:53:47 -04:00
Philip Reames 781de11f42 Revert "[LLVM][Casting.h] Add trivial self-cast"
This reverts commit 0809f63826.  The patch appears not to have included corresponding isa<Ty> support.

This was revealed when reintroducing the required isa<Ty> asserts in cast<Ty>.  See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.

Here's the template instantiation error:
In file included from /home/preames/llvm-repo/llvm-project/llvm/unittests/Support/Casting.cpp:9:
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h: In instantiation of ‘static bool llvm::isa_impl<To, From, Enabler>::doit(const From&) [with To = llvm::bar*; From = llvm::bar; Enabler = void]’:
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:110:36:   required from ‘static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::bar*; From = llvm::bar]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:137:41:   required from ‘static bool llvm::isa_impl_wrap<To, FromTy, FromTy>::doit(const FromTy&) [with To = llvm::bar*; FromTy = const llvm::bar*]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:129:13:   required from ‘static bool llvm::isa_impl_wrap<To, From, SimpleFrom>::doit(const From&) [with To = llvm::bar*; From = const llvm::bar* const; SimpleFrom = const llvm::bar*]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:263:62:   required from ‘static bool llvm::CastIsPossible<To, From, Enable>::isPossible(const From&) [with To = llvm::bar*; From = const llvm::bar*; Enable = void]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:517:38:   required from ‘static bool llvm::CastInfo<To, From, typename std::enable_if<(! llvm::is_simple_type<From>::value), void>::type>::isPossible(From&) [with To = llvm::bar*; From = llvm::bar* const]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:556:46:   required from ‘bool llvm::isa(const From&) [with To = llvm::bar*; From = llvm::bar*]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:585:3:   required from ‘decltype(auto) llvm::cast(From*) [with To = llvm::bar*; From = llvm::bar]’
/home/preames/llvm-repo/llvm-project/llvm/unittests/Support/Casting.cpp:181:27:   required from here
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:64:64: error: ‘classof’ is not a member of ‘llvm::bar*’
   64 |   static inline bool doit(const From &Val) { return To::classof(&Val); }
2022-06-07 12:50:40 -07:00
Martin Sebor dd2a6d78ee [InstCombine] Fold memchr of sequences of same characters
Enhance memchr libcall folder to handle constant arrays consisting
of one or two sequences of cosecutive equal characters.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126515
2022-06-07 13:45:10 -06:00
Martin Sebor fb6627fa0c [InstCombine] Add substr helper function (NFC).
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126515
2022-06-07 13:27:36 -06:00
Sam Estep dcb4950d5b [clang][dataflow][NFC] Fix filename typos in tests
Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D127008
2022-06-07 19:20:20 +00:00
Joe Nash e243ead6fc Reland [AMDGPU] gfx11 vop3dpp instructions
There was an issue with encoding wide (>64 bit) instructions on
BigEndian hosts, which is fixed in D127195. Therefore reland this.

gfx11 adds the ability to use dpp modifiers on vop3 instructions.
This patch adds machine code layer support for that. The MCCodeEmitter
is changed to use APInt instead of uint64_t to support these wider
instructions.

Patch 16/N for upstreaming of AMDGPU gfx11 architecture

Differential Revision: https://reviews.llvm.org/D126483
2022-06-07 14:49:13 -04:00
Derek Schuff 2ae385e560 [WebAssembly] Add WASM_SEC_LAST_KNOWN to BinaryFormat section types list [NFC]
There are 3 places where we were using WASM_SEC_TAG as the "last" known
section type, which requires updating (or leaves a bug) when a new known
section type is added. Instead add a "last type" to the enum for this
purpose.

Differential Revision: https://reviews.llvm.org/D127164
2022-06-07 12:05:23 -07:00
Sunho Kim b6553f592a [JITLink][ELF][AArch64] Lift MachO/arm64 edges into aarch64.h, reuse for ELF.
This patch moves the aarch64 fixup logic from the MachO/arm64 backend to
aarch64.h header so that it can be re-used in the ELF/aarch64 backend. This
significantly expands relocation support in the ELF/aarch64 backend.

Reviewed By: lhames, sgraenitz

Differential Revision: https://reviews.llvm.org/D126286
2022-06-07 12:01:43 -07:00
William Huang ba26e45ca9 [ValueTracking] Add support to deduce a PHI node being a power of 2 if each incoming value is a power of 2.
Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D124889
2022-06-07 18:52:31 +00:00
Reid Kleckner 570e76bb6c [config] Remove vestigial LLVM_VERSION_INFO
This has been superseded by the llvm/Support/VCSRevision.h header. So
far as I can tell, nothing in the CMake build sets LLVM_VERSION_INFO. It
was always undefined, and the ifdefs using it were dead. However, CMake
is very flexible, so it's possible that I missed some ways to set this
variable. One could, for example, probably pass -DLLVM_VERSION_INFO=x on
the command line and get that through to configure_file, or set the
variable in an obscure way (`set(${proj}_VERSION_INFO "x")`). I'm
reasonably confident that isn't happening, but I'd like a second
opinion.

Update the Bazel and gn builds accordingly.

Differential Revision: https://reviews.llvm.org/D126977
2022-06-07 11:36:26 -07:00