[GSYM] Update gSym unit test with stable / portable path (#131204)
This patch adds `-fdebug-compilation-dir=.` to the clang invocation in
`llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml`
and updates the rest of the test accordingly.
Previously, without the newly added argument, the test would
significantly change every time it was regenerated due to the generation
script using a temporary directory as the compilation directory. See
discussion in https://github.com/llvm/llvm-project/pull/129562 for
additional context.
This patch ensures determinism across test update runs - if the test
hasn't been updated and we try to regenerate the contents, nothing will
change.
[libc++][numeric][NFC] Cleanup *Saturation arithmetic* tests (#101826)
This simplifies the tests a little bit:
Fixed -> TODO(LLVM20): remove [[maybe_unused]] and `{}` scope since all
supported compilers support "Placeholder variables with no name"
*IMPORTANT: Requires Apple Clang with [P2169R4: A nice placeholder with
no name](https://wg21.link/P2169R4)*
---------
Co-authored-by: Hristo Hristov <zingam at outlook.com>
[libc++][NFC] Simplify string a bit (#127135)
This PR refactors `basic_string` a bit to simplify its implementation in
the following ways:
- Instead of manually checking whether a string is short or long,
followed by calling the specific functions (e.g., `__get_short_size()`,
`__get_long_size()`), we call the general functions (`size()`) to hide
the conditional checks and make the code more concise.
- Once a string is determined to be short or long, we directly call the
specific functions instead of the general versions to get rid of
unnecessary internal conditional checks. For example, for a long string,
we would directly call `{__set, __get}_long_pointer` instead of `{__set,
__get}_pointer()`.
- Variables that are defined in both the `if` and `else` branches are
now declared in a common scope to reduce redundancy.
- When the string size is calculated multiple times using
`traits_type::length(__s)`, a variable is introduced to store its
length. While modern compilers can optimize this with constant folding,
explicitly storing the length improves code readability and makes the
logic clearer.
- Fixed synopsis with missing default arguments.
[AArch64][GCS][LLD] Introduce -zgcs-report-dynamic Command Line Option (#127787)
When GCS was introduced to LLD, the gcs-report option allowed for a user
to gain information relating to if their relocatable objects supported
the feature. For an executable or shared-library to support GCS, all
relocatable objects must declare that they support GCS.
The gcs-report checks were only done on relocatable object files,
however for a program to enable GCS, the executable and all shared
libraries that it loads must enable GCS. gcs-report-dynamic enables
checks to be performed on all shared objects loaded by LLD, and in cases
where GCS is not supported, a warning or error will be emitted.
It should be noted that only shared files directly passed to LLD are
checked for GCS support. Files that are noted in the `DT_NEEDED` tags
are assumed to have had their GCS support checked when they were
created.
The behaviour of the -zgcs-dynamic-report option matches that of GNU ld.
[25 lines not shown]
[MC] evaluateAsRelocatableImpl: remove the Fixup argument
Follow-up to d6fbffa23c84e622735b3e880fd800985c1c0072 . This commit
updates all call sites and removes the argument from the function.
[MC] evaluateAsAbsolute requires MCValue::RefKind==0
In `.equ a, 3; .if a at plt`, a at plt does not evaluate to an absolute value
(MCExpr::evaluateAsRelocatableImpl disables evaluation when the Kind !=
0 at parse time). Similarly, when using MCTargetValue,
evaluateAsAbsolute should return false when MCValue::RefKind==0.
This allows us to remove `if (!Asm)` check from MipsMCExpr.cpp
(%hi(0xdeadbeef) is not evaluated to a constant without RefKind) and
make targets less error-prone.
[clang-tidy] detect explicit casting within modernize-use-default-member-init (#129408)
This aims to fix a portion of #122480. Added some matchers to detect
explicit casting which utilize builtin types as its source expression.
these are the various forms of casting supported I thought would useful
for this check:
- C Style explicit casting
- Static explicit casting
- Functional explicit casting
[VPlan] Don't access canonical IV in VPWidenPointerInduction::execute.
This updates VPWidenPointerInductionRecipe::execute to not use the
canonical IV to determine the insert point. Instead, it relies on the
current recipe position. In cases where this is not sufficient, set the
insert point to the first non-phi instruction, to ensure phis are
created together.
MipsMCExpr: remove unneeded folding and fix a crash for %hi(und-$L3)
After folding the inner expression, we might get something like
%hi(0x30124), MipsAsmBackend::applyFixup will apply the relocation
operator, so we don't need to duplicate code in MipsMCExpr
(introduced by https://reviews.llvm.org/D19716).
While we don't know the encoding at parse time (see hilo-addressing.s),
it is not an issue.
This change also removes an inappropriate use of `Fixup`
(introduced in 2014 by 752b91bd821ad8a23e004b6cd631ae4f6984ae8b ; which
will go away with my next change).
In addition, fix a crash by porting the fix from RISCV.
```
lui $4, %hi(und-$L3)
```
[Clang] Do not emit nodiscard warnings for the base expr of static member access (#131450)
For an expression `nodiscard_function().static_member(), the nodiscard
warnings added by #120223, are not useful or actionable, and are
disruptive to some library implementations; we just remove them.
Fixes #131410
[Github] Change to step-security fork of changed actions
The tj-actions/changed-files repo has been taken down to the security
incident
(https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised).
This patch moves these jobs over step-security's fork, which has been
loosely audited and has had the malicious commits removed. This is
mainly intended as a stop-gap to get these actions running again while
we figure out the best path forward.
[LLD][COFF] Clarify EC vs. native symbols in diagnostics on ARM64X (#130857)
On ARM64X, symbol names alone are ambiguous as they may refer to either
a native or an EC symbol. Append '(EC symbol)' or '(native symbol)' in
diagnostic messages to distinguish them.
[PowerPC] Simplify PPCMCExpr::evaluateAsRelocatableImpl
The signedness of the @l result is dependent on the instruction operand
(gas behavior).
E.g. in `addis 3,3,65535 at l`, 65535 at l is signed. Unfortunately
we don't have the information.
bfef1dd694d4c646f79521fa3258bbb2398a990c (2014) checked `Fixup`,
which was unnecessary and mislead https://reviews.llvm.org/D115419
to make the code more complex.
In PPCMCExpr::evaluateAsRelocatableImpl we don't need to validate the
result. Just continue and rely on the validation in ELFObjectWriter.
[NFC][Cloning] Clean up comments in CloneFunctionInto (#129153)
Summary:
Some comments no longer make sense nor refer to an existing code path.
Test Plan:
ninja check-llvm-unit
[AddressSanitizer] Remove memory effects from functions (#130495)
If left as-is, subsequent optimizations might utilize the possible
memory effects and optimize-out the instrumentation. Think of the
following case:
```
store i8 4, ptr %shadow
call void @llvm.lifetime.start.p0(i64 4, ptr %local)
%28 = call void @foo(ptr %local)
store i8 -8, ptr %shadow
call void @llvm.lifetime.end.p0(i64 4, ptr %local)
```
where `foo` is an external function with `memory(argmem: write)`. A pass
such as DeadStoreElimination is allowed to remove the initial store,
which might fail sanitizer checks within `foo`.
My first attempt was to add a `memory(readwrite)` at the call-site
level, but unfortunately the current implementation of
[2 lines not shown]
[FMF] Set all bits if needed when setting individual flags. (#131321)
Currently fast() won't return true if all flags are set via setXXX,
which is surprising. Update setters to set all bits if needed to make
sure isFast() consistently returns the expected result.
PR: https://github.com/llvm/llvm-project/pull/131321
[RISCV] Allow RISCVMCExpr folding in the absence of linker relaxaxation
In the AArch64 target, `bar: add x0, x0, :lo12:foo-bar; foo:`
can be folded.
Remove the restriction (https://reviews.llvm.org/D104473), which became
unnecessary after https://reviews.llvm.org/D155357
[RISCV] Move fixELFSymbolsInTLSFixups to getRelocType
fixELFSymbolsInTLSFixups walks the expression tree, which is complex and
unnecessary. As the expression must be relocatable, we can move the code
to getRelocType and just set SymA. The behavior is similar to GNU
assembler.
[Mips] Move fixELFSymbolsInTLSFixups to getRelocType
fixELFSymbolsInTLSFixups walks the expression tree, which is complex and
unnecessary. As the expression must be relocatable, we can move the code
to getRelocType and just set SymA. The behavior is similar to GNU
assembler.
[mlir][Transforms] Dialect Conversion: Add 1:N support to `remapInput` (#131454)
This commit adds 1:N support to `SignatureConversion::remapInputs`. This
API allows users to replace a block argument with multiple replacement
values. (And the block argument is dropped.) The API already supported
"bbarg --> multiple bbargs" mappings, but "bbarg --> multiple SSA
values" was missing.
---------
Co-authored-by: Markus Böck <markus.boeck02 at gmail.com>