[VPlan] Move extract-lane(0, canWideIV) combine before unrolling
Some extract-lane combines can't be performed before unrolling, e.g. the one that combines it to Instruction::ExtractElement can end up extracting from a different part. But the extract-lane(0, canWideIV) can because at index 0 you're always extracting from the first part. Do this before unrolling, which improves codegen of unrolled code.
[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.
[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]
[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]
[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.
[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.
[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.
[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.
[VPlan] Move extract-lane(0, canWideIV) combine before unrolling
Some extract-lane combines can't be performed before unrolling, e.g. the one that combines it to Instruction::ExtractElement can end up extracting from a different part. But the extract-lane(0, canWideIV) can because at index 0 you're always extracting from the first part. Do this before unrolling, which improves codegen of unrolled code.
py-forbiddenfruit: updated to 0.1.5
0.1.5
feat: Add support for cursing __next__, __hash__, and __new__
build: use pytest to run tests and twine for publishing package
tests: use github ci instead of travis
libffi: updated to 3.8.2
3.8.2
x86-64: reject vector types under the Win64 ABIs on non-Windows
builds, as documented (GHSA-v9rw-6cxm-q6rf).
CRIS: reject vector types (GHSA-j9pv-w354-7fg2).
aarch64: reserve enough stack for large by-value structs mixed
with 16-byte-aligned arguments (GHSA-wc36-xxj4-cxh5).
Pass by-value aggregates aligned beyond the stack alignment
correctly on x86-64, i386, ARM, MIPS, m88k and AArch64
(GHSA-rwpw-56v4-44r3).
powerpc64 ELFv2: fix closures overwriting the caller's frame
with float structs and _Complex arguments
(GHSA-p8c7-j6j7-h7vg), and stop padding IBM long double
aggregates (GHSA-34hv-975q-7p7w).
RISC-V, LoongArch: fix one-float structs passed after the FP
argument registers run out (GHSA-2xrh-7r9c-rwmf).
Static trampolines: make the temporary code-table file
[16 lines not shown]
[flang] Fix value separators for CHARACTER array output (#205303)
Fixes #192936
Undelimited character values in namelist output might not be readable as
namelist input (F'2018 13.11.4.2 NOTE 1). Emit a warning for namelist
WRITE/PRINT when a group item has CHARACTER data and DELIM= is absent or
'NONE'. DELIM='NONE' runtime output is unchanged, and a runtime test is
added for DELIM='QUOTE' namelist output and read-back.
The warning is enabled by default since the affected users are the ones
who would not opt in; it can be disabled with
-Wno-undelimited-namelist-character.
imx_ccm: check that regidx is mapped; accept same-rate set_rate
- Reject table entries whose register region is not mapped.
- For clocks without set_rate, return 0 if the requested rate equals
the current rate, as clk_set_rate() does; otherwise ENXIO as before.
- Note that busy_reg must be in the same region as the divider.
Tested on QEMU mcimx7d-sabre: the clock list is unchanged, a same-rate
request on a PLL now succeeds (was ENXIO), and an unmapped regidx
stops attach. Built GENERIC and GENERIC64.
net: dpaa2-eth: fix objtool warning and logic bug
This commit came about because I locally had a build with COMPILE_TEST
and various runtime hardening features (that don't make sense for a pure
build test anyway) disabled - and objtool complained about some of the
code as a result:
drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.o: warning: objtool: dpaa2_eth_add_bufs+0x3f8: stack state mismatch: reg1[15]=-1+0 reg2[15]=-2-208
The reason seems to be that without the hardening features, objtool
notices that gcc is doing really odd things with the 'page' variable,
which is uninitialized in the path where 'ch->xsk_zc' is true.
Now, this seems to be just objtool becoming confused about some ugly
code, but that code is _also_ actively buggy in a different way, so
let's just fix this all.
What confuses objtool seems to be the stack slot for the uninitialized
'page' variable - for the case where that variable isn't actually used.
[54 lines not shown]
[llubi] Refactor library into llvm/lib (#223745)
This makes it easier for out-of-tree consumers to use the LLUBI library
for use cases where LLUBI is a good replacement for ExecutionEngine
(e.g., fuzzing workloads).
Part of
https://discourse.llvm.org/t/rfc-delete-executionengine-interpreter/91720.