LowerTypeTests: Only invalidate analyses of modified functions in SimplifyTypeTests
SimplifyTypeTests tried to preserve the CFG analyses, but did not
preserve the function analysis manager proxy, so all function analyses
were invalidated.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SelectionDAG] Use the widened type to select the shift amount type (#244781)
This fixes https://github.com/llvm/llvm-project/issues/244518.
CombineZExtLogicopShiftLoad reuses the original shift amount when
widening a shift. On X86, widening an i16 shift to i512 leaves the count
as i8, which cannot represent all valid shift amounts for i512. Use
getShiftAmountOperand to convert the count to the type required by the
widened shift.
Assisted-by: OpenAI Codex
WholeProgramDevirt: Invalidate function analyses individually
Avoid discarding analyses that never need to be invalidated, such as
TargetLibraryInfo.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[X86]: `sub(0, and(X, 1))` -> `ashr(shl(X, SizeInBits - 1), SizeInBits - 1)` (#243478)
In `InstCombine`, expressions of the form `ashr(shl(X, SizeInBits - 1),
SizeInBits - 1)` are canonicalized into the form `sub(0, and(X, 1))`.
The issue with this representation is that the generated code is
suboptimal and requires an additional register. To address this, an
inverse operation has been added for `x86`.
Fixes https://github.com/llvm/llvm-project/issues/208410
[DAG] Use the alignment of actual stored type (#244632)
Fixes #244552.
`INSERT_VECTOR_ELT` may implicitly truncate the inserted operand. When
expanding it through the stack, we should compute the alignment from the
actual memory type rather than the untruncated operand type.
[LICM] Refresh cache for load update
A load update for function pointer makes ICFLoopSafetyInfo invalidate
the old one. Refresh both MW and ICF so that it won't failed
validate().
Assisted-by: Claude # Test
LowerTypeTests: Only invalidate analyses of modified functions in DropTypeTests
Previously everything was invalidated on any changes, so even
invariant function analyses were discarded.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Do not use s_delay_alu instskip to skip inline asm (#244627)
We cannot reliably count the number of instructions in an inline asm, so
do not include one in an instskip region. Emit a separate s_delay_alu
after it instead.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Coroutines: Only invalidate analyses of lowered functions in CoroEarly
CoroEarly invalidated every function analysis whenever the module declared
coroutine intrinsics. Only invalidate the functions it modified, and the
callers of functions which had noalias removed.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[IPSCC] Mark byval capture as Overdefined
ptr byval reuse the original pointer identity. Any capture on ptr
byval can easily cause miscompilation as taking reference on pointer
is always considered as the same. Therefore, we put this in
OverDefined by default.
Take the added test as an example. `icmp eq ptr %p, @g` in
`cmp_byval(@g)` is always considered as the same identity in IPSCCP,
which is a miscompiliation.
EarlyCSE and InstCombine should be able to handle byval and ptr
elimination easily. So we don't add more thing to LatticeValue here.
Assisted-by: Claude # Test
OpenMPOpt: Invalidate function analyses individually
Avoid discarding analyses that never need to be invalidated, such as
TargetLibraryInfo.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[llvm] Remove write-only private member variables (NFC) (#244811)
This patch removes private member variables across llvm/ that are
assigned to but never read, along with their assignments.
Assisted-by: Antigravity
OpenMPOpt: Invalidate function analyses individually
Avoid discarding analyses that never need to be invalidated, such as
TargetLibraryInfo.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
ConstantMerge: Preserve CFG analyses (#244817)
ConstantMerge only changes global variables, so it does not need to
invalidate every function analysis.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[RISCV] Remove RVE specific array from getArgGPRs by slicing the front of the full array. (#244770)
The RVE array is a prefix of the full array so we can take the front. This
requires hardcoding the sizes, but these arrays aren't expected to
change so I don't think that's a maintenance issue.
[Target] Move function definitions out of anonymous namespaces (#244814)
The coding standards say the following:
> Make anonymous namespaces as small as possible, and only use them for
> class declarations.
This also makes these files compliant with the
llvm-prefer-static-over-anonymous-namespaces clang-tidy check.