LLVM/project c968e92 — llvm/lib/Transforms/Vectorize VPlanTransforms.cpp

Preserve debugloc
DeltaFile
+1-1llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+1-11 files

LLVM/project f7fe6f1 — llvm/test/Analysis/CostModel/RISCV vp-intrinsics.ll, llvm/test/Transforms/SLPVectorizer/RISCV select-profitability.ll gep-inttoptr-mixed.ll

[RISCV][TTI] Set the default MaxVectorCoalesceElts to 1 (#246590)

Alternative to #246576

Set the default MaxVectorCoalesceElts to 1 so strided vector memory
operations are costed per element rather than receiving a cache-line
coalescing discount. This matches scheduling models such as SiFive7,
which model ordinary strided accesses as one element per cycle.

This is motivated by reversed_unit_stride: a reverse shuffle followed by
a unit-stride store can replace a negative-stride store. The coalescing
discount can favor the negative-stride store over this alternative.

Add a standalone SLP regression test checking that reversed unit-stride
stores use a reverse shuffle followed by an ordinary vector store.
DeltaFile
+28-17llvm/test/Transforms/SLPVectorizer/RISCV/basic-strided-stores.ll
+11-23llvm/test/Analysis/CostModel/RISCV/vp-intrinsics.ll
+29-0llvm/test/Transforms/SLPVectorizer/RISCV/reversed-unit-stride.ll
+5-4llvm/test/Transforms/SLPVectorizer/RISCV/strided-loads-with-external-use-ptr.ll
+5-2llvm/test/Transforms/SLPVectorizer/RISCV/gep-inttoptr-mixed.ll
+2-1llvm/test/Transforms/SLPVectorizer/RISCV/select-profitability.ll
+80-471 files not shown
+81-487 files

LLVM/project 8bedc71 — .github/workflows zizmor.yml sycl-tests.yml

Update [Github] Update GHA Dependencies (#247027)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[github/codeql-action](https://redirect.github.com/github/codeql-action)
| action | patch | `v4.39.3` → `v4.39.5` |
|
[hendrikmuhs/ccache-action](https://redirect.github.com/hendrikmuhs/ccache-action)
| action | patch | `v1.2.25` → `v1.2.26` |
|
[zizmorcore/zizmor-action](https://redirect.github.com/zizmorcore/zizmor-action)
| action | minor | `v0.8.1` → `v0.9.2` |
DeltaFile
+2-2.github/workflows/libc-overlay-tests.yml
+2-2.github/workflows/gha-codeql.yml
+1-1.github/workflows/zizmor.yml
+1-1.github/workflows/sycl-tests.yml
+1-1.github/workflows/spirv-tests.yml
+1-1.github/workflows/scorecard.yml
+8-83 files not shown
+11-119 files

LLVM/project 8629e5f — llvm/lib/Target/AMDGPU AMDGPUAttributor.cpp, llvm/test/CodeGen/AMDGPU duplicate-attribute-indirect.ll simple-indirect-call.ll

[AMDGPU] Re-enable AAInstanceInfo in AMDGPUAttributor

This was enabled and then disabled because of its compile time impact. This
recent changes, the compile time issue should have been resolved.
DeltaFile
+13-5llvm/test/CodeGen/AMDGPU/amdgpu-attributor-accesslist-offsetbins-out-of-sync.ll
+3-6llvm/test/CodeGen/AMDGPU/simple-indirect-call-2.ll
+5-3llvm/test/CodeGen/AMDGPU/direct-indirect-call.ll
+4-2llvm/test/CodeGen/AMDGPU/simple-indirect-call.ll
+2-3llvm/test/CodeGen/AMDGPU/duplicate-attribute-indirect.ll
+1-1llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
+28-206 files

LLVM/project a51827c — llvm/lib/Transforms/IPO AttributorAttributes.cpp, llvm/test/Transforms/Attributor value-simplify-call-site-returned.ll

[Attributor] Use call site values when the callee returns an argument

AAPotentialValuesCallSiteReturned takes the interprocedural values of a call
from the interprocedural return values of the callee. If the callee returns one
of its arguments, these values contain the arguments of all call sites, so each
call result also gets the values passed at all other call sites. This is not
necessary. If the callee has many call sites and the call results are passed to
other calls, the value sets also become very large.

If the callee returns only its arguments and constants, we just need to
translate these values to the call site for the interprocedural scope.

This PR was assisted by AI but I reviewed all the changes.
DeltaFile
+40-12llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+47-0llvm/test/Transforms/Attributor/value-simplify-call-site-returned.ll
+87-122 files

LLVM/project bc62428 — llvm/lib/Transforms/IPO AttributorAttributes.cpp, llvm/test/Transforms/Attributor value-simplify-call-chain.ll

[Attributor] Do not copy large value sets in `AAPotentialValues`

`AAPotentialValuesImpl::recurseForValue` copies all values of another position
into the state. For example, if a callee returns one of its arguments, the call
result takes the values of the call site operand. In a chain of calls where each
call gets the result of the previous call, each call result then has one more
value than the previous one. A call result also sees the new values of the
previous call only in the next fixpoint iteration, so a chain of N calls needs N
iterations, and a long chain hits the iteration limit.

In this PR, we just limit the number of values to copy to 7, and use the value
of the position itself otherwise. 7 is a magic number here, but it is sufficient
for most cases (telling from the fact that no existing test is affected by this
change).

This PR was assisted by AI but I reviewed all the changes.
DeltaFile
+58-0llvm/test/Transforms/Attributor/value-simplify-call-chain.ll
+9-0llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+67-02 files

LLVM/project b021962 — llvm/docs/RISCV RISCVVectorExtension.md

[RISCV][Docs] Fix the return type in vector add call examples (#247025)

Both the masked and unmasked `llvm.riscv.vadd` examples omit the return
type after `call`. When either example is placed in a function,
`llvm-as` reports `expected type` at the intrinsic name. Add `<vscale x
4 x i32>` to both calls.

With LLVM 24, both examples assemble and pass the IR verifier. On RV64,
`llc` emits `vadd.vv` for both and uses `v0.t` for the masked form. The
existing RV32 and RV64 `rvv/vadd.ll` tests passed, and the LLVM HTML
documentation built with warnings treated as errors.

Assisted-by: OpenAI Codex
DeltaFile
+2-2llvm/docs/RISCV/RISCVVectorExtension.md
+2-21 files

LLVM/project de42460 — llvm/test/Transforms/LoopVectorize/X86 prefer-128-bit.ll intrinsiccost.ll, llvm/test/Transforms/SLPVectorizer/X86 fmuladd.ll uitofp.ll

[X86] Prefer 128-bit vectors for Bulldozer CPUs (#225838)

## Summary

Fixes missed vector-width optimization for AMD Bulldozer CPUs
(`bdver1`–`bdver4`) by preferring 128-bit vectors by default.

Fixes https://github.com/llvm/llvm-project/issues/223159

## Changes

- Enable `TuningPrefer128Bit` for Bulldozer CPUs.
- Update affected tests that intentionally require 256-bit vectors.
- Add a `bdver2` vectorization regression test.

## Testing

- `llvm/test/Transforms/LoopVectorize/X86/prefer-128-bit.ll`
- `llvm/test/CodeGen/X86/memset.ll`

    [8 lines not shown]
DeltaFile
+437-84llvm/test/Transforms/SLPVectorizer/X86/sitofp.ll
+437-84llvm/test/Transforms/SLPVectorizer/X86/sitofp-inseltpoison.ll
+327-122llvm/test/Transforms/LoopVectorize/X86/intrinsiccost.ll
+247-0llvm/test/Transforms/LoopVectorize/X86/prefer-128-bit.ll
+188-1llvm/test/Transforms/SLPVectorizer/X86/uitofp.ll
+105-15llvm/test/Transforms/SLPVectorizer/X86/fmuladd.ll
+1,741-30616 files not shown
+2,741-52522 files

LLVM/project 13a1957 — llvm/lib/Transforms/Scalar GVN.cpp, llvm/test/Transforms/GVN cond_br.ll

[GVN] Process Foldable Terminator beforehead

GVN generates phi node to replace a load call. However, addDeadBlock
modify such phi so that any deadblock sucessor in a phi becomes
poison.

This causes disagreement on SSAUpdater as [%a, %b1] [poison, %b2] is
considered as different with [%a, %b1] [0, %b2] even if poison is
replace with 0.

As a result, we make processFoldableTerminator (which is the only
caller of addDeadBlock now) runs before processInstruction. This is
before what we have on phi node generation so that non of the mismatch
happens.

Asissted-by: Claude # Test
DeltaFile
+51-0llvm/test/Transforms/GVN/cond_br.ll
+5-0llvm/lib/Transforms/Scalar/GVN.cpp
+56-02 files

LLVM/project c221ae7 — llvm/test/CodeGen/AMDGPU srem.ll load-global-i8.ll, llvm/test/CodeGen/RISCV clmul.ll

Rebase, address comments, improvements, fixes

Created using spr 2.0.0-beta.1
DeltaFile
+4,870-4,906llvm/test/CodeGen/AMDGPU/memintrinsic-unroll.ll
+11-7,563mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
+3,141-3,182llvm/test/CodeGen/RISCV/clmul.ll
+2,602-2,926llvm/test/CodeGen/X86/vector-compress.ll
+0-5,394llvm/test/CodeGen/AMDGPU/load-global-i8.ll
+0-5,274llvm/test/CodeGen/AMDGPU/srem.ll
+10,624-29,2457,733 files not shown
+345,292-274,2647,739 files

LLVM/project 18db76c — compiler-rt/lib/asan asan_rtl.cpp

[spr] update

Created using spr 2.0.0-beta.2
DeltaFile
+54-32compiler-rt/lib/asan/asan_rtl.cpp
+54-321 files

LLVM/project 061c7d2 — compiler-rt/lib/asan asan_interceptors_memintrinsics.cpp asan_interceptors_memintrinsics.h

[spr] update

Created using spr 2.0.0-beta.2
DeltaFile
+0-20compiler-rt/lib/asan/asan_interceptors_memintrinsics.h
+20-0compiler-rt/lib/asan/asan_poisoning.h
+1-0compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp
+21-203 files

LLVM/project 09f030f — compiler-rt/lib/asan asan_interceptors_memintrinsics.h

[spr] update

Created using spr 2.0.0-beta.2
DeltaFile
+2-2compiler-rt/lib/asan/asan_interceptors_memintrinsics.h
+2-21 files

LLVM/project 2768887 — lld/ELF InputFiles.cpp

[lld][AMDGPU] Remove r600 bitcode handling (#246822)

Remove the r600 case from `getBitcodeMachineKind`, since the r600 target
is being removed and lld never linked R600 objects.

RFC: https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840
DeltaFile
+0-1lld/ELF/InputFiles.cpp
+0-11 files

LLVM/project fa8cf7a — llvm/lib/Target/X86 X86InstrInfo.h X86InstrInfo.cpp, llvm/test/CodeGen/X86/apx cmov-conversion-ndd-load.mir cmov.ll

[X86][APX] Fold loads into NDD CMOVs that are converted to branches (#245602)

Without prefer-ndd-mem, ISel folds only RIP-relative loads into NDD
CMOVs, so select(c, load, x) becomes MOVrm + CMOVrr_ND instead of
CMOVrm. The force-mem-operand conversion in X86CmovConversion no longer
sees the load, and the CMOV is kept where non-APX code gets a branch.

Fold any load into an NDD CMOV when X86CmovConversion converts memory
operand CMOVs to branches, so the existing CMOVrm conversion applies.
Where it keeps such a CMOV (e.g. an unpredictable select), unfold the
non-RIP-relative load again.

X86::foldNDDCmovLoads() holds the condition, so ISel and
X86CmovConversion agree on when a load is folded and unfolded.
-x86-cmov-converter-ndd-load=false disables the fold.

Assisted-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+83-8llvm/test/CodeGen/X86/apx/cmov.ll
+63-0llvm/test/CodeGen/X86/apx/cmov-conversion-ndd-load.mir
+43-0llvm/lib/Target/X86/X86CmovConversion.cpp
+11-5llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+10-0llvm/lib/Target/X86/X86InstrInfo.cpp
+6-0llvm/lib/Target/X86/X86InstrInfo.h
+216-131 files not shown
+218-137 files

LLVM/project e5ac4d7 — lld/MachO InputSection.cpp Writer.cpp, lld/test/MachO function-starts.s

[lld][MachO] Stream FunctionStartsSection from laid-out code sections

Currently, `FunctionStartsSection::finalizeContents()` scans every
`ObjFile`'s full symbol table, resolves `defined->getVA()` for each live
code symbol, sorts all addresses with `llvm::sort`, and encodes ULEB128
deltas through `raw_svector_ostream`.

By the time `FunctionStartsSection::finalizeContents()` runs, output
segments, their sections, and each `ConcatOutputSection`'s inputs are
already laid out in ascending virtual address order, and each input
section's `symbols` list is kept sorted by offset. This PR walks those
laid-out code sections directly and streams ULEB128 deltas straight into
`contents` via `llvm::appendLEB128`. If a malformed input produces an
out-of-order symbol address, it reports an `error()` and skips the
symbol.

To avoid calling `isCodeSection()` on every subsection, we add a
`SectionView` wrapper so `isCodeSection()` can accept either a `Section`
or an `InputSection`, and cache its result across consecutive inputs

    [10 lines not shown]
DeltaFile
+129-0lld/test/MachO/function-starts.s
+40-21lld/MachO/SyntheticSections.cpp
+12-1lld/MachO/InputSection.h
+5-5lld/MachO/ICF.cpp
+3-3lld/MachO/Writer.cpp
+2-3lld/MachO/InputSection.cpp
+191-332 files not shown
+193-358 files

LLVM/project ece9836 — llvm/lib/Transforms/Vectorize VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize early-exit-tail-folding.ll

[VPlan] Remove header masks whose tail lanes aren't used

Replace a use of header-mask && x with x if the user, transitively
through freeze, logical-and, not and mask.beforefirst(freeze ...), only
reaches masks that are and'ed with the header mask again. The header
mask is a prefix and lane i of mask.beforefirst only depends on lanes
0..i, so the lanes outside of the header mask are never used.

This avoids the i1 vp.merge that EVL tail folding needs for the inner
header mask, e.g. in the early exit mask.beforefirst(freeze(header-mask
&& c)) and in switch default edges.
DeltaFile
+39-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+2-4llvm/test/Transforms/LoopVectorize/early-exit-tail-folding.ll
+2-4llvm/test/Transforms/LoopVectorize/RISCV/early_exit_with_stores.ll
+2-4llvm/test/Transforms/LoopVectorize/RISCV/early-exit.ll
+1-2llvm/test/Transforms/LoopVectorize/RISCV/zvl1024b-crash.ll
+46-145 files

LLVM/project fcd3bf2 — llvm/lib/Transforms/Vectorize LoopVectorizationLegality.cpp LoopVectorize.cpp, llvm/test/Transforms/LoopVectorize early_exit_store_legality.ll early-exit-tail-folding.ll

[VPlan] Allow tail folding early exits with side effects

Continues the work in #179595.

This allows us to tail fold e.g. the following loop:

```c
extern char a[1024], b[1024], c[1024], y[1024];
void two_guards(void) {
  for (int i = 0; i < 1000; i++) {
    if (a[i] == 0)
      break;
    if (b[i] > 3) {
      if (c[i] < 9)
        y[i] = 1;
    }
  }
}
```

    [30 lines not shown]
DeltaFile
+40-70llvm/test/Transforms/LoopVectorize/early-exit-tail-folding.ll
+24-41llvm/test/Transforms/LoopVectorize/RISCV/early_exit_with_stores.ll
+18-35llvm/test/Transforms/LoopVectorize/RISCV/early-exit.ll
+24-0llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+0-7llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+2-2llvm/test/Transforms/LoopVectorize/early_exit_store_legality.ll
+108-1552 files not shown
+111-1578 files

LLVM/project 0a3215b — llvm/test/Transforms/LoopVectorize early-exit-tail-folding.ll

Precommit tests
DeltaFile
+214-153llvm/test/Transforms/LoopVectorize/early-exit-tail-folding.ll
+214-1531 files

LLVM/project c192a44 — llvm/lib/Transforms/Vectorize VPlanConstruction.cpp, llvm/test/Transforms/LoopVectorize multiple-early-exits.ll early-exit-tail-folding.ll

[VPlan] Support tail folding uncountable early exits

Enables the first step towards #179595. After #237254, the MaskedHandleExitInVectorLoop early exit style uses the CFG to handle masking for early exit loops. This allows it to compose with tail folding which is also handled via the CFG in #176143.

This allows us to tail fold the following loop:

```c
extern char x[256];
int f(char * restrict y) {
  for (int i = 0; i < 256; i++) {
    if (x[i] == 0)
      return i;
  }
  return -1;
}
```

Into this on RISC-V:


    [18 lines not shown]
DeltaFile
+88-160llvm/test/Transforms/LoopVectorize/RISCV/early-exit-live-out.ll
+77-149llvm/test/Transforms/LoopVectorize/RISCV/early-exit.ll
+54-105llvm/test/Transforms/LoopVectorize/early-exit-tail-folding.ll
+108-16llvm/test/Transforms/LoopVectorize/multiple-early-exits.ll
+20-37llvm/test/Transforms/LoopVectorize/RISCV/sink-to-early-exit.ll
+32-18llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+379-4854 files not shown
+411-49310 files

LLVM/project e45650e — llvm/test/Transforms/LoopVectorize early-exit-tail-folding-active-lane-mask.ll early-exit-tail-folding.ll, llvm/test/Transforms/LoopVectorize/RISCV early-exit.ll

Precommit tests
DeltaFile
+552-0llvm/test/Transforms/LoopVectorize/RISCV/early-exit.ll
+524-0llvm/test/Transforms/LoopVectorize/early-exit-tail-folding.ll
+65-0llvm/test/Transforms/LoopVectorize/early-exit-tail-folding-active-lane-mask.ll
+1,141-03 files

LLVM/project 87f8806 — llvm/lib/Transforms/Vectorize VPlanConstruction.cpp LoopVectorize.cpp

[VPlan] Use vputils::findCanonicalIVIncrement in more places. NFC

In a future patch we want to enable more scenarios with early exits and tail folding. In these scenarios the terminator will no longer be a BranchOnCount/BranchOnCond but a BranchOnTwoConds, so a bunch of canonical IV matchers break. Use vputils::findCanonicalIVIncrement instead since it searches the users of the canonical IV instead of looking at the terminator.
DeltaFile
+7-13llvm/lib/Transforms/Vectorize/VPlanEVLTailFolding.cpp
+2-9llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+2-8llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+11-303 files

LLVM/project 87fb552 — llvm/lib/Transforms/Vectorize VPlan.h VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize early_exit_with_stores.ll

[VPlan] Allow early exit loops with side effects by masking in the vector loop.

When all blocks with side effects are dominated by every early exit, we can vectorize the loop if we mask off any lanes past the exit. We can do this with control flow:

```mermaid
flowchart TD
  header --> exiting
  exiting -->| exit mask | sideeffects --> latch --> latch.split
  exiting -->| !exit mask | latch.split
```

For every early exiting block we add a branch to the latch on `!mask.beforefirst(exitcond)`. This is implemented in UncountableExitStyle::ReadOnly which is now renamed to MaskedHandleExitInVectorLoop.

This is a complementary exit style to MaskedHandleExitInScalarLoop. If any of the side effects aren't dominated by the early exit it still falls back to the scalar loop style, which is why none of the existing early exit side effect tests changed. Masking in loop is profitable for RISC-V and I'm assuming it's also profitable for AArch64 too, but if not then we can add a TTI hook for a preferred exit style.
DeltaFile
+59-76llvm/test/Transforms/LoopVectorize/early_exit_with_stores.ll
+86-33llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+10-9llvm/test/Transforms/LoopVectorize/X86/early_exit_with_stores.ll
+8-7llvm/test/Transforms/LoopVectorize/RISCV/early_exit_with_stores.ll
+5-4llvm/lib/Transforms/Vectorize/VPlan.h
+3-2llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
+171-1312 files not shown
+176-1338 files

LLVM/project 2b231d2 — llvm/test/Transforms/LoopVectorize early_exit_with_stores.ll

Precommit tests
DeltaFile
+221-0llvm/test/Transforms/LoopVectorize/early_exit_with_stores.ll
+221-01 files

LLVM/project 55fb077 — llvm/unittests/Transforms/Vectorize VPlanVerifierTest.cpp

Remove old dominance unit test
DeltaFile
+0-18llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
+0-181 files

LLVM/project c2c0369 — llvm/lib/Transforms/Vectorize VPlanVerifier.cpp VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize predicated-single-exit.ll predicated-early-exits-interleave.ll

[VPlan] Preserve SSA in early exit loops

MaskedCond is used to logically-and the condition to early exit with the current block in-mask. However because we use it in the latch block where the condition isn't defined on all paths, we have to workaround it not being in SSA in the verifier.

This fixes this by using reconstructSSA added in #212209 to preserve SSA in both the exit conditions and live outs in the exit blocks. It also means we get the right exit condition without MaskedCond and allows us to remove the MaskedCond exceptions in the verifier. MaskedCond is still kept since a followup PR will still use it.

One subtle point is that we need to freeze any branch conditions. Any lanes after and including the early exiting lane might contain poison and we can have branches on those poison lanes that didn't we didn't previously branch on in the scalar loop.

There's no miscompile on main today because we coincidentally don't keep SSA so exit conditions are read directly without being polluted by poison stemming from a branch past the early exit. But in this PR the exit conditions are polluted and we can end up with poison in the condition operand of a select, which causes an undefined result for AnyOf even if it freezes its operand. The poison in the branch will also cause problems in future if we decide to preserve uniform control flow and emit branches instead of blends. The exit_cond_merged_after_poison_branch test illustrates this.
DeltaFile
+156-36llvm/test/Transforms/LoopVectorize/predicated-multiple-exits.ll
+24-16llvm/test/Transforms/LoopVectorize/predicated-early-exits-interleave.ll
+26-9llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+1-18llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
+12-6llvm/test/Transforms/LoopVectorize/predicated-single-exit.ll
+219-855 files

LLVM/project be91370 — llvm/lib/Transforms/Vectorize VPlanPredicator.cpp, llvm/test/Transforms/LoopVectorize uniform-blend.ll select-cmp-blend-chain.ll

[VPlan] Peek through nested phi incoming values in computeBlendMasks
DeltaFile
+495-0llvm/test/Transforms/LoopVectorize/predicator.ll
+389-6llvm/test/Transforms/LoopVectorize/VPlan/predicator.ll
+80-11llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp
+81-0llvm/test/Transforms/LoopVectorize/find-last.ll
+13-3llvm/test/Transforms/LoopVectorize/select-cmp-blend-chain.ll
+3-12llvm/test/Transforms/LoopVectorize/uniform-blend.ll
+1,061-326 files

LLVM/project 0008873 — llvm/lib/Transforms/Vectorize VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize blend-i1.ll

[VPlan] Simplify BLEND X/M, false, ..., false -> M && X

If an i1 blend has false for all but one incoming value, then we can simplify this to the one non-false value. Blends by construction never have any overlapping mask values, so we don't need to worry about the order as the masks can't "shortcut" each other.
DeltaFile
+13-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+3-8llvm/test/Transforms/LoopVectorize/blend-i1.ll
+16-82 files

LLVM/project bf42981 — llvm/test/Transforms/LoopVectorize blend-i1.ll

Precommit tests
DeltaFile
+69-0llvm/test/Transforms/LoopVectorize/blend-i1.ll
+69-01 files

LLVM/project b1dddaf — llvm/lib/Transforms/Vectorize VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize early-exit-tail-folding.ll

[VPlan] Remove header masks whose tail lanes aren't used

Replace a use of header-mask && x with x if the user, transitively
through freeze, logical-and, not and mask.beforefirst(freeze ...), only
reaches masks that are and'ed with the header mask again. The header
mask is a prefix and lane i of mask.beforefirst only depends on lanes
0..i, so the lanes outside of the header mask are never used.

This avoids the i1 vp.merge that EVL tail folding needs for the inner
header mask, e.g. in the early exit mask.beforefirst(freeze(header-mask
&& c)) and in switch default edges.
DeltaFile
+39-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+2-4llvm/test/Transforms/LoopVectorize/early-exit-tail-folding.ll
+2-4llvm/test/Transforms/LoopVectorize/RISCV/early_exit_with_stores.ll
+2-4llvm/test/Transforms/LoopVectorize/RISCV/early-exit.ll
+1-2llvm/test/Transforms/LoopVectorize/RISCV/zvl1024b-crash.ll
+46-145 files