[VPlan] Append recipes created via builder to worklist
The previous PR appended the top most created recipe to the worklist, and this PR extends it to any other nested recipes that were created, similar to InstCombine.
This removes the header mask in a good few more places on RISC-V as measured on SPEC CPU 2017, e.g. for the following loop:
```c
long f(const int *p, const int *q, long n) {
long a = 0, b = 0;
for (long i = 0;; i++) {
if (p[i] && q[i]) { a += i; b += i; }
if (i + 1 == n) break;
}
return a + b;
}
```
Before:
[49 lines not shown]
Switch to SmallVector with space on stack
SmallVector allows for much larger small sizes than SetVector, so use 256 to match InstructionWorklist.
We don't need to worry about duplicate worklist entries until we add users to the worklist.
[VPlan] Process simplifyRecipes in a worklist
This brings simplifyRecipes further in line with InstCombine, and asides from unlocking more simplifications it also helps avoid spurious test churn whenever passes are moved around simplifyRecipes.
For now just push the new recipe onto the worklist, not its users.
This uses a post order traversal so we maintain the same simplification order as before.
I've gone through and checked every simplification we do is a canonicalisation that converges, and I checked on llvm-test-suite + SPEC CPU 2017 in various configurations that we don't hit any cycles.
[VPlan] Split simplifyRecipes into simplifyRecipes and combineRecipes
Bringing it in line with InstSimplify and InstCombine, split up simplifyRecipe into a function that modifies and creates recipes (combineRecipe), and one that is analysis-only (simplifyRecipe).
This allows us to avoid adding simplficiation only folds to the worklist in #213899.
The funclet.ll test no longer erases the constant-folded intrinsic call because vputils::isDeadRecipe returns false.
[MemProf] Use NodeId to break ties deterministically in identifyClones (#222126)
In identifyClones(), ties between caller edges with identical allocation
types and matching clone candidates were previously broken by comparing
the first element of ContextIds (*A->ContextIds.begin() <
*B->ContextIds.begin()).
Because ContextIds is a DenseSet, its iteration order depends on hash
table
layout and bucket distribution, introducing non-determinism across
different
runs or architectures.
Replace this tie-breaker with caller NodeId (A->Caller->NodeId <
B->Caller->NodeId),
which provides a deterministic and stable ordering. Also apply
Callee->NodeId
in CalleeCallerEdgeLessThan for consistency.
Update tests whose remark or dump order depended on the previous
[7 lines not shown]
[AMDGPU] Update REV Opcode DPP Combine test to not use True16
DPP is not implemented for VGPR16 operands, so it should be disabled to allow verifying opcodes that would use the still work
[AMDGPU] Fix invalid 64-bit DPP formed from folding a 32-bit DPP mov
GCNDPPCombine already rejects 64-bit DPP when the DPP move itself is
64-bit, but a 32-bit move folded into a source of a 64-bit instruction
was not checked. On targets without FeatureDPALU_DPP this formed
V_LSHLREV_B64_e64_dpp, whose tied old operand got the move's 32-bit
register class instead of the 64-bit destination class.
[IR][DirectX] Drop IsTokenLike from `dx.*` target types (#222130)
We made the DirectX resource types "token-like" a while ago in order to
prevent transforms from moving them into PHIs and the like in ways that
made determining their provenance more difficult. However, there are
patterns in HLSL that can generate the problematic IR directly and we've
since implemented logic in `DXILResourceAccess` to handle such cases
anyway. Because of this, we aren't really getting any benefit from the
types being `IsTokenLike`, and in some cases we're working with
intermediate IR that doesn't actually pass the verifier.
Drop `IsTokenLike` from the `dx.*` types since it's no longer correct or
useful. I've updated the tests to use `amdgpu.stridemark` instead, and
slightly abused `llvm.ssa.copy` in order to manufacture SSA values of
that type. I had to drop the test that actually needed a load from a
value depending on the token-like type, as there just isn't really a way
for that to come up without the resource types.
[clang][Driver][test] Specify output path in modules-driver-depscan-log.cpp (#222209)
In `clang/test/Driver/modules-driver-depscan-log.cpp`, `%clang -c` is
invoked on `%t/A.cppm` without an explicit output file (`-o`). By
default, Clang writes the resulting object file (`A.o`) to the current
working directory.
In sandboxed or hermetic test environments where the test runner
executes with a read-only working directory (e.g., Bazel, Nix, or remote
build executors), the test fails with:
```text
error: unable to open output file 'A.o': 'Permission denied'
1 error generated.
[BOLT][AArch64] Fix relocation type for `LDRSW` (#221939)
Fix the incorrect relocation type for `LDRSW`. It should be
`ELF::R_AARCH64_LDST32_ABS_LO12_NC`, but it was mistakenly set to
`ELF::R_AARCH64_LDST64_ABS_LO12_NC` in PR #196051.
[clang][flang][docs] Re-land Markdown CLI ref generator (#222147)
Reverts llvm/llvm-project#221937
Relands llvm/llvm-project#220385
This time, the migration includes flang command line reference
documentation, so the change passes `ninja docs-flang-html/man`.
Tracking issue: #201242
Assisted-By: Codex