[CMake] Don't explicitly set folder for InstrumentationTests (#170041)
Use the default of `LLVM/Tests/Unit` to group these tests with other
LLVM unit test targets in the IDE.
[RISCV] Mark More Relocs as Relaxable (#151422)
Since this code was last reviewed, more relaxations have been added to
the psABI for existing standard relocations that LLVM didn't have marked
as relaxable.
This change ensures that LLVM marks the following relocations (and their
respective fixups) as relaxable:
- `R_RISCV_JAL`
- `R_RISCV_GOT_HI20`
- `R_RISCV_TPREL_HI20`
- `R_RISCV_TLSDESC_HI20`
This also updates the linker relaxation test to use `-NEXT` to check all
the output lines.
There are lots more emitted relocations, not only due to JAL being
relaxable, but branches are now also marked linker relaxable because
they can be turned into `b<cc>; jal` during assembly relaxation, which
may also be marked relaxable.
[NVPTX] Use correct `mul.wide` operand type when matching on `shl` in `combineMulWide` (#168986)
The operand types of a `mul.wide` are half the size of the output type.
`combineMulWide` incorrectly uses the output type of the `mul.wide` for
the operand type instead of the operand type.
Add time trace scopes to addToCallGraph & getCFG (#174717)
This PR adds performance instrumentation to `clang::CallGraph` and
`clang::CFG` to aid in benchmarking the overhead of call
graph construction and CFG rebuilding.
This aims to facilitate benchmarking on large codebases like LLVM to
ensure that the performance impact of new analysis-based warnings
remains within acceptable regressions.
[-Wunsafe-buffer-usage] Fix crashes in "Add check for custom printf/scanf functions #173096" (#174683)
The previous PR #173096 assumes that format attribute parameters always
refer to valid indices of arguments. It is a wrong assumption in itself
because the second attribute parameter could specify the index after the
last named parameter for variadic functions and no actual arguments
passed beyond named parameters. In addition, clang (possibly
incorrectly) allows the following uses of the attribute:
```
void f(const char *) __attribute__((__format__ (__printf__, 1, 2))); // The second attribute argument 2 will not refer to any valid argument at any call of 'f'
void g(const char *) __attribute__((__format__ (__printf__, 1, 99))); // Clang is even quiet on this, if assertions are disabled :(
```
[lldb-dap][NFC] Shorten the event thread name (#174837)
On linux thread names are limited to 15 characters, shorten the name of
the event thread if necessary
ValueTracking: Handle fdiv by known 0 case in computeKnownFPClass
This will help subsume some transforms instsimplify performs
in the middle of SimplifyDemandedFPClass
[BOLT][AArch64] Avoid UB due to shift of negative value. (#174994)
A build with LLVM_USE_SANITIZER=Undefined showed:
bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp:2277:60:
runtime error: left shift of negative value -32768
This showed up in bolt/test/AArch64/veneer-lite-mode.s.
It is valid for ADRP's operand to be negative, and not valid to shift it
like that. To perform this shift reliably, cast the value to unsigned.
[PowerPC] Add AMO load signed builtins (#168747)
This commit adds two Clang builtins for AMO load signed operations:
__builtin_amo_lwat_s for 32-bit signed operations
__builtin_amo_ldat_s for 64-bit signed operations
[flang] Fix bad attributes on type parameter symbols (#174870)
When creating new symbols for a derived type's type parameters, the
attributes that accumulated for the type itself were also being applied
to the parameters' symbols. This led to those attributes being emitted
to the module file, rendering it unparseable.
Fixes https://github.com/llvm/llvm-project/issues/174859.
[flang] Make a non-digit in fixed-form label field an error unless -E (#174836)
A character in a fixed-form source line (as opposed to a comment or
compiler directive) can't have a non-digit in its label field, columns 1
through 5. The prescanner presently emits only a warning for this case.
Retain the warning for -E output, but otherwise diagnose an error.
(This change affected a number of tests that relied on this situation
being a warning just so that they could test prescanner warnings, and
those tests were adjusted to use another warning.)
Fixes https://github.com/llvm/llvm-project/issues/50563.
[flang] Silence "used but undefined" warning for LOC(x) (#174807)
When a variable appears as the argument of the extension intrinsic
function LOC(x), assume that it's defined for the purposes of the
warning about variables that are used but never defined, since the
result of the LOC() can be used to define a based Cray pointer.
[lldb-dap][windows] fix lldb-dap executable name in test (#175014)
This patch fixes an incorrect name of the `lldb-dap` process on Windows
by appending `.exe` to the name.
This is a prelude to https://github.com/llvm/llvm-project/pull/174635.
[lldb-dap] Add ovsx as a dev dependency for publish to Open VSX (#175015)
This adds `ovsx` as a developer dependency and adds a new script
"publish-ovsx" for publishing to the Open VSX registry.
[RISCV] Bail out of combineNarrowableShiftedLoad for types other than scalar int (#175011)
Introduced in #170483 this was only ever meant to trigger for scalar
types. We get an error on rv32gcv for some inputs "Cannot implicitly
convert a scalable size to a fixed-width size in `TypeSize::operator
ScalarTy()`".
While we're editing this function, delete an accidentally repeated
comment.
Minimal reproducer:
```
define <vscale x 4 x ptr> @ham() {
bb:
%load = load <vscale x 4 x i32>, ptr null, align 4
%ashr = ashr <vscale x 4 x i32> %load, splat (i32 1)
%getelementptr = getelementptr i32, ptr null, <vscale x 4 x i32> %ashr
ret <vscale x 4 x ptr> %getelementptr
}
[2 lines not shown]
[llvm-c] Add LLVMParseIRInContext2 (#174085)
This new function is the same as LLVMParseIRInContext except it doesn't
take ownership of the memory buffer. This fixes a wart that has been in
place since 5ebb7b311223bcd21d2b3d25413d1edacefcc63d changed the
underlying internal API to avoid taking ownership.
Reduce nesting in the implementation of LLVMParseIRInContext (now
LLVMParseIRInContext2) as well.
Update examples, OCaml bindings, and tests including plugging some
pre-existing memory leaks. OCaml bindings have renamed `parse_ir` to
`parse_ir_bitcode_or_assembly` to provoke compilation failures in
downstream code; this is intentional as this function now requires the
memory buffer to be disposed by the caller.
[SLP] Use ConstantInt::getSigned for stride argument to strided load/store intrinsics (#175007)
strided-stores-vectorized.ll crashes for RV32 without fixing the
relevant logic in vectorizeTree, because the argument can't be
represented as a 32-bit unsigned value:
```
llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' failed.
```
It is intended to be signed, so we simply use ConstantInt::getSigned
instead. This fixes other stride-related instances in the file as well.
For further context, this change is part of unblocking rv32gcv
llvm-test-suite in CI.
[AMDGPU] Fix a potential use-after-erase in `AMDGPUPromoteAlloca` pass (#174529)
In some cases, the placeholder itself can be used as the value for its
corresponding block in `SSAUpdater`, and later used as an incoming value
in another block in `GetValueInMiddleOfBlock`. If we erase it too early,
this can lead to a use-after-erase.
ValueTracking: Check if fdiv operand could be undef (#174453)
In the special case for fdiv/frem with the same operands, make
sure the input isn't undef.