[VPlan] Use llvm.mask.beforefirst for computing early exit mask
This makes the cost more accurate and improves codegen for RISC-V. The codegen for an early exit loop with side effects then goes from:
.LBB0_3: # %vector.body
# =>This Inner Loop Header: Depth=1
vl1r.v v16, (a3)
vsetvli zero, zero, e8, m1, ta, ma
vmseq.vi v16, v16, 0
vfirst.m a7, v16
srli t0, a7, 63
czero.nez a7, a7, t0
czero.eqz t0, a1, t0
or a7, t0, a7
vsetvli zero, zero, e64, m8, ta, ma
vmsltu.vx v0, v8, a7
vle8.v v17, (a5), v0.t
vcpop.m t1, v16
vsetvli zero, zero, e8, m1, ta, ma
[22 lines not shown]
[SelectionDAG] Fix get_active_lane_mask expansion on 32-bit targets
On e.g. wasm32, OpVT can be 32 bits whilst the StepVector type can be v2i64. When this happens DAG.getConstant asserts because maxUIntN doesn't fit into the 32 bits. Fix this by clamping it to OpVT's max size.
[SelectionDAG] Handle splitting in get_active_lane_mask expansion
Split when the type is legal, e.g. v64i1, but the step vector needed for expansion needs split, e.g. v64i8.
This can happen on avx512 when the 512 bit registers are disabled.
[ConstantFolding] Add constant folding for mask.beforefirst (#234472)
Poison lanes poison the entire result, and undef elements are ignored
Assisted-by: Opus 5.5
[TableGen] Remove unused AllowSelfAssignment parameter of SetValue. NFC. (#234917)
This was added in 1e23ed9eaa7c to allow setting NAME to a reference to
itself when instantiating multiclass defs. That caller was removed in
420e28c78c9f, and since then every caller has passed false.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply at anthropic.com>