Revert "Reland "[LTO][LLD] Prevent invalid LTO libfunc transforms (#164916)"" (#192741)
Reverts llvm/llvm-project#190642
A bisect shows this as the change leading to the link failure at
https://g-issues.fuchsia.dev/issues/503377901
[clang-tidy] Prevent false-positive in presence of derived-to-base cast in bugprone.use-after-move (#189638)
The following scenario is quite common, but was reported as a
use-after-move:
```cpp
struct Base {
Base(Base&&);
};
struct C : Base {
int field;
C(C&& c) :
Base(std::move(c)), // << only moves through the base type
field(c.field) // << this is a valid use-after-move
{}
};
```
Fix this by checking field origin when the moved value is immediately
cast to base.
[AArch64][GlobalISel] Fix nonterminating legalization for <8 x s4> vectors. (#192747)
G_CONCAT_VECTORS with <16 x s4> sources hits the bitcast legalization
path, which round-trips through scalar types (e.g. s32) and regenerates
<8 x s4> vectors via G_UNMERGE_VALUES and G_BUILD_VECTOR. The
G_BUILD_VECTOR is then widened to <8 x s8> (via .minScalarOrElt(0, s8)),
producing G_ANYEXT/G_TRUNC artifact pairs. The artifact combiner folds
these pairs away, restoring the original <8 x s4> types, which feeds
back into G_CONCAT_VECTORS again.
This change:
* Adds .minScalarOrElt(1, s8) to the G_ICMP rules to ensure operand
vector elements are at least s8. This causes <16 x s4> operands to be
widened
to <16 x s8>, and the result type follows via minScalarEltSameAs.
* Add custom legalization for G_CONCAT_VECTORS when element size < 8.
The custom handler widens source operands via G_ANYEXT (e.g.
<8 x s4> -> <8 x s8>), concats the widened vectors (producing a
[6 lines not shown]
[flang] NameUniquer helper for detecting module-scope data (#192733)
Add NameUniquer::isModuleScopeDataUniquedName to detect uniqued names
for module-scope data (variables, named constants, and common blocks),
excluding procedures and other prefixed symbols.
[InstCombine] Fold bitcast into vp.load (#192173)
Similar to normal loads, we should be able to fold bitcast into
`vp.load` if (1) mask is all-ones (2) either the new vector type has a
larger known minimum length than that of the original vector, or you
need to make sure the original EVL can be exact divided by the
decreasing factor (of the known minimum length).
This patch adds such folding pattern, though it only support cases where
the new vector type has a larger known minimum length.
[CIR] Fix typeinfo linkage and comdat (#192721)
We weren't properly setting the linkage on typeinfo objects, leading to
multiple definition linking error when typeinfo for a class was
referenced in multiple source files. We had the correct linkage
available in the buildTypeInfo function, but we weren't doing anything
with it. This also prevented us from hitting the diagnostic saying that
we should have set the comdat attribute for the typeinfo. This change
fixes both of those problems.
[lldb] Fix TestThreadExit.py flakiness (#190976)
When `pthread_join` returns, the target thread signals its internal
semaphore, but the underlying Mach thread hasn't been removed from the
task yet with `thread_terminate`.
The flakiness is the result of the debugger stopping the process halts
the dying thread mid-termination. There is no Mach API to distinguish a
dying thread from a live one: it appears as `TH_STATE_STOPPED`, like any
other suspended thread.
This PR adds a helper (`wait_for_thread_cleanup`) that polls
`task_threads` to ensure the Mach thread is actually gone before the
breakpoint. Since there might be other tests that are affected by this
race, I put it in a common location so it can be reused.
[NewPM] Adds a port for AArch64PostSelectOptimize (#192599)
Standard porting with updated tests.
Note: Removed unused dep on TargetPassConfig for legacy pass.
[LFI][Doc] Update documentation for planned features (#192128)
This PR updates the LFI documentation to be a little less
AArch64-specific in anticipation of x86-64 support. I've also updated
the planned names for the `no-lfi-stores`/`no-lfi-loads` features, and
updated the planned rewrite sequence for `x30` modifications to make it
more PAC-compatible for when we include support for that.
[RISCV] Support emitting plui.h for i32 constants on RV64. (#192534)
If the constant was originally i32, it will be sign or zero
extended to i64 during type legalization. If we can prove the
upper bits aren't used we can duplicate the lower bits to allow
RISCVMatInt to select plui.h.
[lit] Fix tests when run via symlinks (#192530)
If the path to Inputs/filter-failed was a symlink, it would copy the
symlinks, and then edit the same files, leading to flaky failures if the
tests ran in parallel.
[ThinLTO] Drop !inline_history metadata when importing functions (#192564)
In #190876 we now have functions in ValueAsMetadata (!inline_history
metadata). This has caused undefined symbol linker errors in some
ThinLTO builds. The following is what's going on:
@f in module A is getting imported from module A to module B, and it has
a call with !inline_history pointing to @g in module A, so a declaration
for @g is also imported into module B. But @g gets internalized in
module A, causing the undefined symbol error at link time due to
memprof's ICP in module B creating a call to @g since we can ICP a call
to any declaration.
To avoid pulling in a function declaration that may be wrong, simply
drop !inline_history metadata when importing functions. They aren't
necessary for correctness, they only prevent inlining explosion in some
recursive edge cases. Worst case is we do another round of inlining
through mutually recursive functions and then stop again due to newly
added !inline_history metadata, which should be fine; the inlining
explosion typically happens because we keep inlining through mutually
recursive functions.
[SSAF][WPA] Add no-op PointerFlow and UnsafeBufferUsage analysis
We need no-op PointerFlow and UnsafeBufferUsage analyses for the
analysis that depends on their summary data.
Refactored PointerFlow and UnsafeBufferUsage serialization for code
sharing.
rdar://174874942
[lldb] Assert lack of trailing period or newlines in diagnostics (#191447)
This PR adds an assert to `CommandReturnObject::{AppendNote,
AppendWarning}` to ensure the diagnostics don't end with a newline,
which is added by the function, or a period, which goes against the
coding standards.
I added a little helper that asserts in assert-enabled builds and trim
the diagnostic otherwise. I know that goes against the notion that
"asserts are preconditions" and therefore you shouldn't handle the case
where they don't hold (something I generally advocate for) but I think
we should prioritize a consistent user experience over purity.
We should do the same thing for `AppendError`, but currently there are
still too many violations that need to be cleaned up and if the compiler
emits non-compliant diagnostics, we may not be able to do this at all.
[NewPM] Adds a port for AArch64PostLegalizerLowering (#190718)
Standard porting (extraction into a helper function shared across legacy
and new PM passes).
Dropped unused include `TargetPassConfig.h`