Commit Graph

429226 Commits

Author SHA1 Message Date
Wei Yi Tee 81e6400d8c [clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`.
Differential Revision: https://reviews.llvm.org/D129180
2022-07-07 20:21:19 +00:00
David Blaikie 856ebe9e82 Retrieve as StringRef since that's how it'll be used 2022-07-07 20:13:36 +00:00
Dominic Chen 5f3818c7df [scudo] Add [[no_unique_address]] attribute to new MapPlatformData variables
Differential Revision: https://reviews.llvm.org/D129237
2022-07-07 13:12:55 -07:00
Augusto Noronha 5ade38c285 [lldb] Add comments to describe m_memory_addr and IsInMemory
Differential Revision: https://reviews.llvm.org/D129319
2022-07-07 13:11:50 -07:00
Dmitri Gribenko 63fac424e6 Revert "[clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`."
This reverts commit 19e21887eb. I
accidentally landed the non-final version of the patch that used
decomposition declarations (not yet usable in LLVM/Clang source).
2022-07-07 21:50:52 +02:00
David Blaikie 65cac0ed92 Use StringRef to avoid unnecessary copies into std::strings 2022-07-07 19:50:12 +00:00
Krzysztof Parzyszek 534a2bf99e [TableGen] Rewrite type set intersection in type inference
The previous code had a bug when dealing with matching iPTR against a
set of integer types. It was trying to handle it all in a compact way,
but that implementation couldn't be modified to correct the problem in
a simple way. The code wasn't long, and it was easier to rewrite it.

The actual issue was that non-scalar-integer types were considered when
matching against iPTR. For example {iPTR} intersected with {i32 f32}
was {iPTR} (due to multiple types in the other set), but should be just
{i32}, because i32 is the only integer scalar in the other set.
2022-07-07 12:49:28 -07:00
Peter Steinfeld 9f9e9d9cfc [flang] SET_EXPONENT(-0.0) should return -0.0
Section 16.9.171 says:

If X has the value zero, the result has the same value as X

So if X is -0.0, SET_EXPONENT should return -0.0.

Differential Revision: https://reviews.llvm.org/D129309
2022-07-07 12:43:30 -07:00
Robert Suderman b9e642afd1 [mlir][spirv] Add path for math.round to spirv for OCL and GLSL
OpenCL's round function matches `math.round` so we can directly lower to
the op, this includes adding the op definition to the SPIRV OCL ops.
GLSL does not guarantee rounding direction so we include custom rounding
code to guarantee correct rounding direction.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D129236
2022-07-07 19:20:20 +00:00
Fangrui Song d3712b0852 [llvm-objdump] Change some nonnull pointers to references. NFC 2022-07-07 12:14:59 -07:00
Zaara Syeda 58b9666dc1 [LSR] Fix bug - check if loop has preheader before calling isInductionPHI
Fix bug exposed by https://reviews.llvm.org/D125990
rewriteLoopExitValues calls InductionDescriptor::isInductionPHI which requires
the PHI node to have an incoming edge from the loop preheader. This adds checks
before calling InductionDescriptor::isInductionPHI to see that the loop has a
preheader. Also did some refactoring.

Differential Revision: https://reviews.llvm.org/D129297
2022-07-07 15:11:33 -04:00
Vitaly Buka f67fc3acad [sanitizer] Extract check_mem_is_good into header
Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D129245
2022-07-07 12:06:49 -07:00
Wei Yi Tee 19e21887eb [clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`.
A truth assignment to atomic boolean values which satisfy `Constraints` will be returned if found by the solver.
This gives us more information which can be helpful for debugging or constructing warning messages.

Reviewed By: hlopko, gribozavr2, sgatev

Differential Revision: https://reviews.llvm.org/D129180
2022-07-07 20:53:47 +02:00
Noah Shutty 209bebc2b6 Try to fix shared lib buildbot failures after 36f01909a0 (D114846) 2022-07-07 18:48:45 +00:00
Noah Shutty 36f01909a0 [llvm] [Debuginfod] LLVM debuginfod server.
This implements a debuginfod server in llvm using the `DebuginfodCollection` and `DebuginfodServer` classes. This is tested with lit tests against the debuginfod-find client.

The server scans 0 or more local directories for artifacts. It serves the debuginfod protocol over HTTP. Only the `executable` and `debuginfo` endpoints are supported (no `/source` endpoint).
The server also uses the debuginfod client as a fallback, so it can hit the local debuginfod cache or federate to other known debuginfod servers.
The client behavior is controllable through the standard environment variables (`DEBUGINFOD_URLS`, `DEBUGINFOD_CACHE_PATH`, `DEBUGINFOD_TIMEOUT`)

The server implements on-demand collection updates as follows:
If the build-id is not found by a local lookup, rescan immediately and look up the build-id again before returning 404. To protect against DoS attacks, do not rescan more frequently than once per N seconds (specified by `-m`).

Lit tests are provided which test the `llvm-debuginfod-find` client against the `llvm-debuginfod` server.

Reviewed By: mysterymath

Differential Revision: https://reviews.llvm.org/D114846
2022-07-07 18:33:27 +00:00
Fangrui Song 472aa7e6bb [docs] Move code contribution from GettingStarted.rst to Contributing.rst
For code contribution, GettingStarted.rst duplicates information in Contributing.rst.
The dedicated Contributing.rst is a better place for code contribution, so move
the content there.

Notes:

* D41665 added `Contributing.rst`
* D110976 mentioned `git cherry-pick e3659d43d8911e91739f3b0c5935598bceb859aa` workaround

Reviewed By: cjdb, fhahn, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D129255
2022-07-07 10:51:20 -07:00
Dominic Chen ff8c0e6eb5 [scudo] Pass MapPlatformData in more calls
Allow platforms to avoid looking up private data by providing private context

Differential Revision: https://reviews.llvm.org/D129237
2022-07-07 10:43:07 -07:00
theidexisted 85236e6f3b [NFC][sanitizer] Minor change: eliminate loop
Reviewed By: #sanitizers, fmayer, vitalybuka

Differential Revision: https://reviews.llvm.org/D128873
2022-07-07 10:33:08 -07:00
Zequan Wu 227dffd0b6 [LLDB][NFC] Decouple dwarf location table from DWARFExpression.
Differential Revision: https://reviews.llvm.org/D125509
2022-07-07 10:26:58 -07:00
Ben Langmuir 67a84ec810 [clang] Cleanup ASTContext before output files in crash recovery for modules
When we recover from a crash in a module compilation thread, we need to
ensure any output streams owned by the ASTConsumer (e.g. in
RawPCHContainerGenerator) are deleted before we call clearOutputFiles().
This has the same theoretical issues with proxy streams that Duncan
discusses in the commit 2d13386783. In practice, this was observed
as a use-after-free crash on a downstream branch that uses such a proxy
stream in this code path. Add an assertion so it won't regress.

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

rdar://96525032
2022-07-07 10:23:57 -07:00
Jonas Devlieghere ec48a0df91
[lldb] Improve the error message in run_to_breakpoint_do_run
Improve the error message when we fail to hit the initial breakpoint in
run_to_breakpoint_do_run. In addition to the process state, we now also
report the exit code and reason (if the process exited) as well as the
inferior's output.

Differential revision: https://reviews.llvm.org/D111978
2022-07-07 10:22:45 -07:00
Fangrui Song 75e551e5d8 [ELF] Relax R_RISCV_CALL and R_RISCV_CALL_PLT
A pair of auipc+jalr relocated by R_RISCV_CALL or R_RISCV_CALL_PLT can be
converted to c.j, c.jal, or jal.

* c.j: RVC and displacement is representable as an int12
* c.jal: RV32C and displacement is representable as an int12
* jal: displacement is representable as an int21

Use the D127581 relaxation framework to implement the relaxation. If a shorter
sequence is satisfied, we record the new relocation type in `relocTypes` and
saves the new instruction into `writes`. Finally let `riscvFinalizeRelax` rewrite the
instruction by setting `skip`.

Differential Revision: https://reviews.llvm.org/D127611
2022-07-07 10:18:45 -07:00
Sam McCall b15127d056 [clangd] Disable flaky test 2022-07-07 19:17:09 +02:00
Mogball 9432fbfe13 [mlir] An implementation of sparse data-flow analysis
This patch introduces a (forward) sparse data-flow analysis implemented with the data-flow analysis framework. The analysis interacts with liveness information that can be provided by dead-code analysis to be conditional. This patch re-implements SCCP using dead-code analysis and (conditional) constant propagation analyses.

Depends on D127064

Reviewed By: rriddle, phisiart

Differential Revision: https://reviews.llvm.org/D127139
2022-07-07 10:17:04 -07:00
Fangrui Song 6611d58f5b [ELF] Relax R_RISCV_ALIGN
Alternative to D125036. Implement R_RISCV_ALIGN relaxation so that we can handle
-mrelax object files (i.e. -mno-relax is no longer needed) and creates a
framework for future relaxation.

`relaxAux` is placed in a union with InputSectionBase::jumpInstrMod, storing
auxiliary information for relaxation. In the first pass, `relaxAux` is allocated.
The main data structure is `relocDeltas`: when referencing `relocations[i]`, the
actual offset is `r_offset - (i ? relocDeltas[i-1] : 0)`.

`relaxOnce` performs one relaxation pass. It computes `relocDeltas` for all text
section. Then, adjust st_value/st_size for symbols relative to this section
based on `SymbolAnchor`. `bytesDropped` is set so that `assignAddresses` knows
that the size has changed.

Run `relaxOnce` in the `finalizeAddressDependentContent` loop to wait for
convergence of text sections and other address dependent sections (e.g.
SHT_RELR). Note: extrating `relaxOnce` into a separate loop works for many cases
but has issues in some linker script edge cases.

After convergence, compute section contents: shrink the NOP sequence of each
R_RISCV_ALIGN as appropriate. Instead of deleting bytes, we run a sequence of
memcpy on the content delimitered by relocation locations. For R_RISCV_ALIGN let
the next memcpy skip the desired number of bytes. Section content computation is
parallelizable, but let's ensure the implementation is mature before
optimizations. Technically we can save a copy if we interleave some code with
`OutputSection::writeTo`, but let's not pollute the generic code (we don't have
templated relocation resolving, so using conditions can impose overhead to
non-RISCV.)

Tested:
`make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- LLVM=1 defconfig all` built Linux kernel using -mrelax is bootable.
FreeBSD RISCV64 system using -mrelax is bootable.
bash/curl/firefox/libevent/vim/tmux using -mrelax works.

Differential Revision: https://reviews.llvm.org/D127581
2022-07-07 10:16:09 -07:00
Daniel Bertalan ef7aed3e11 [InstCombine] Do not fold 'and (sext (ashr X, Shift)), C' if Shift < 0
The 'and (sext (ashr X, ShiftC)), C' --> 'lshr (sext X), ShiftC'
transformation would access out of bounds bits in APInt::getLowBitsSet
if the shift count was larger than X's bit width or if it was negative.

Fixes #56424
2022-07-07 19:13:55 +02:00
Michael Jones 6656029a49 [libc][nfc] update get_explicit_mantissa
The get_explicit_mantissa function returns the mantissa of an FPBits
floating point value with the implicit leading 1, if appropriate. This
function existed previously, but did not handle non-normal numbers
properly.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D129241
2022-07-07 10:13:24 -07:00
Mark de Wever 8aa596584a [libc++][doc] Removes a colon in a title. 2022-07-07 19:07:03 +02:00
Mingming Liu b242e8502c [AArch64][NFC] Prepare test cases (for D128302) to show more accurate cost estimation of extract-element could generate better assembly code.
Pre-commit the test cases (for D128302) to show that more accurate cost
estimation of extract-element could generate better code.

Differential Revision: https://reviews.llvm.org/D128945
2022-07-07 09:39:29 -07:00
Joseph Huber 42e10354d4 [LinkerWrapper] Identify offloading sections using ELF type
Summary:
A previous patch added a new ELF section type for LLVM offloading. We
should use this when extracting the offloading sections rather than
checking the string. This pach also removes the implicit support for
COFF and MACH-O because we don't support those currently and should not
be included.
2022-07-07 12:38:00 -04:00
Krzysztof Parzyszek 8cadfdf8e7 [TableGen] Fix CodeGenRegisterClass::hasType for simple-type arguments
The `hasType` function may be given a type that has been modified from
its original form (in particular made "simple", due to a predicate).
Make sure that such a type is still recognized as associated with a
register class, if the class contains it under any hw-mode.
This is somewhat optimistic though, since there is no information as
to where that simple type originated from.
2022-07-07 09:37:15 -07:00
Austin Kerbow 6817031d0b [AMDGPU] Disable FillMFMAShadowMutation by default
Disable amdgpu mfma power sched.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D129172
2022-07-07 09:34:45 -07:00
Krzysztof Parzyszek bfa2c42001 [VE] Change displacement type in MEM..i from i32 to i64
In selection patterns, addresses (like tblockaddr) are passed as the
displacement (the i in MEM..i) to instructions taking MEM operands.
Since addresses are 64-bit, having this part of the MEM..i operand as
i32 causes a type inference error. The instructions actually only encode
32 bits of the displacement, but there is no way to manually extract
these bits (either the high or the low half) in selection patterns.

This didn't happen before, because of a bug in type inference when
dealing with iPTR.
2022-07-07 09:33:49 -07:00
Chi Chun Chen 6c3990acfb [OpenMP][NFC] Claim order clause modifiers (reproducible and unconstrained) 2022-07-07 11:30:03 -05:00
Valentin Clement 53804e426d
[flang][NFC] Make LEN parameters homogenous
This patch is part of the upstreaming effort from fir-dev branch.
This is the last patch for the upstreaming effort.

Reviewed By: jeanPerier

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-07-07 18:29:28 +02:00
Krzysztof Parzyszek 91fe9e6ed3 [TableGen] Move printing to stream directly to MachineValueTypeSet 2022-07-07 09:28:28 -07:00
Vitaly Buka ba4435eb62 [msan] Fix dn_comp interceptor after D126851
Unpoison by strlen(dest), as dn_expand
returns the size if the compressed name (src).

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D129244
2022-07-07 09:27:44 -07:00
Joseph Huber 41fba3c107 [Metadata] Add 'exclude' metadata to add the exclude flags on globals
This patchs adds a new metadata kind `exclude` which implies that the
global variable should be given the necessary flags during code
generation to not be included in the final executable. This is done
using the ``SHF_EXCLUDE`` flag on ELF for example. This should make it
easier to specify this flag on a variable without needing to explicitly
check the section name in the target backend.

Depends on D129053 D129052

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D129151
2022-07-07 12:20:40 -04:00
Joseph Huber 82a0adf0f7 [llvm-objdump] Update offload dumping to use SHT_LLVM_OFFLOADING
In order to be more in-line with ELF semantics, a previous patch added
support for a new ELF section type to indicate if a section contains
offloading data. This allows us to now check using this rather than
checking the section name directly. This patch updates the logic to
check the type now instead.

I chose to make this emit a warning if the input is not an ELF-object
file. I could have made the logic fall-back to the section name, but
this offloading in LLVM is currently not supported on any other targets
so it's probably best to emit a warning until we improve support.

Depends on D129052

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D129053
2022-07-07 12:20:35 -04:00
Joseph Huber 1d2ce4da84 [Object] Add ELF section type for offloading objects
Currently we use the `.llvm.offloading` section to store device-side
objects inside the host, creating a fat binary. The contents of these
sections is currently determined by the name of the section while it
should ideally be determined by its type. This patch adds the new
`SHT_LLVM_OFFLOADING` section type to the ELF section types. Which
should make it easier to identify this specific data format.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D129052
2022-07-07 12:20:30 -04:00
Joseph Huber ed801ad5e5 [Clang] Use metadata to make identifying embedded objects easier
Currently we use the `embedBufferInModule` function to store binary
strings containing device offloading data inside the host object to
create a fatbinary. In the case of LTO, we need to extract this object
from the LLVM-IR. This patch adds a metadata node for the embedded
objects containing the embedded pointers and the sections they were
stored at. This should create a cleaner interface for identifying these
values.

In the future it may be worthwhile to also encode an `ID` in the
metadata corresponding to the object's special section type if relevant.
This would allow us to extract the data from an object file and LLVM-IR
using the same ID.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D129033
2022-07-07 12:20:25 -04:00
Florian Hahn 23f56132da
[IndVars] Add tests for more different float->int conversions.
Extra tests for D129140.
2022-07-07 09:17:15 -07:00
Philip Reames fa3783c907 [RISCV] Test coverage for missing commute of vsadd(u)
For some reason, this appears to only happen with fixed length vectors.  Scalable ones commute just fine in all the cases I've seen.
2022-07-07 09:11:44 -07:00
Nico Weber 636bc544cc Revert "[gn build] (manually) port 9ee97ce3b8305c5"
This reverts commit 6148c79a64.
9ee97ce3b8 was reverted in 61d417ceff.
2022-07-07 18:11:15 +02:00
Sam McCall eb64dbd6e0 [clangd] Fix flaky throttler test
The production code doesn't depend on the relative destruction order of
the throttle request and the main request, but the test does.
2022-07-07 18:09:54 +02:00
Jonas Devlieghere 61d417ceff
Revert "[libc++] Use ABI tags instead of internal linkage to provide per-TU insulation"
This reverts commit 9ee97ce3b8.
2022-07-07 08:58:55 -07:00
Florian Hahn 12f9c7b270
[LV] Update RISCV test missed by bc19b7c3cc. 2022-07-07 08:51:15 -07:00
Florian Hahn bc19b7c3cc
[LV] Remove collectTriviallyDeadInstructions, already handled by VP DCE.
Now that removeDeadRecipes can remove most dead recipes across a whole
VPlan, there is no need to first collect some dead instructions.
Instead removeDeadRecipes can simply clean them up.

Depends D127580.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D128408
2022-07-07 08:40:27 -07:00
David Spickett f3d43eca34 [lldb][Windows] Fixup overlapping memory regions tests
As suggested in post-commit review on https://reviews.llvm.org/D129272.

* Rename the test case.
* Simplify the overlap check.
* Correct assertion.
2022-07-07 15:36:14 +00:00
Mark de Wever 0857a02ef0 [libc++][format] Implements 128-bit support.
With to_chars supporting 128-bit it's possible to support the full
128-bit range in format. This only removes the previous restrictions
and updates the tests to validate proper support.

Depends on D128929.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D129007
2022-07-07 17:36:03 +02:00