[PATCH v2 0/5] No-wrap assumptions.
Robin Dapp <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
From: Robin Dapp <[email protected]> Hi, this is v2 of the scev-based nowrap-assumptions patch. This version mainly addresses Richi's comments and also tweaks minor things: - Patch 1 is unchanged as it was already ACKed. - According to Richi's suggestion, scev uses two separate caches now. I think this makes things somewhat clearer (but not clear :) ) - dr is unchanged apart from moving vect_reset_dr to dr_reset into this patch. Also, we reset a DR right away during creation and not only later in vect. - The vect patch uses ranged to try and simplify the assumption expression. We could do better here in the future but I hope we're ok for now. It also removes the now-redundant dataref computation in vect_analyze_loop_2 and passes BBs around that are computed once. I needed to copy the blocks in the loop_vec_info constructor because of lifetime issues. Maybe vec_info_shared would be a better spot? Didn't go there for now. - vect cost uses EXPR_P now and counts comparisons as well as MIN_EXPRs. The series was bootstrapped and regtested on x86 and power10. aarch64 and riscv are not fully clean. As I'm going to be away for two weeks, I don't have time to look into these in depth now but still wanted to get the current state out of the door. aarch64 without ada bootstraps and regtestests cleanly but with ada I see an error: In a loop that wasn't vectorized before, it looks like there is an inconsistency in vector bool handling somewhere. I haven't investigated further but it very much seems pre-existing. riscv64 was regtested and saw exactly one new modula2 FAIL: Strings.mod:79:1: error: PHI node with wrong VUSE on edge from BB 9 .MEM_138 = PHI <.MEM_46(9)> expected .MEM_121 during GIMPLE pass: vect At first sight, this also seems pre-existing (like forgetting to copy a VUSE somewhere, perhaps early break). As said, I'm going to handle both but don't want to block v2's review due to issues that seem only remotely related. Robin Dapp (5): niter: Add helper to compute type bound. scev: Add nowrap bound. dr: Add no-wrap bound. vect: Request no-wrap bounds from DR analysis. vect: Cost niter conditions. .../gcc.dg/tree-prof/update-loopch.c | 2 + gcc/testsuite/gcc.dg/tree-ssa/scev-12.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/scev-8.c | 2 +- .../gcc.dg/vect/vect-unsigned-assump-1.c | 22 ++ .../gcc.dg/vect/vect-unsigned-assump-2.c | 24 ++ .../gcc.dg/vect/vect-unsigned-assump-3.c | 20 + .../gcc.dg/vect/vect-unsigned-assump-4.c | 13 + .../gcc.dg/vect/vect-unsigned-assump-5.c | 14 + .../gcc.dg/vect/vect-unsigned-assump-6.c | 13 + .../gcc.dg/vect/vect-unsigned-assump-7.c | 17 + .../gcc.dg/vect/vect-unsigned-assump-8.c | 13 + .../aarch64/sve2/niter-convert-range.c | 2 +- gcc/tree-chrec.cc | 51 ++- gcc/tree-chrec.h | 7 +- gcc/tree-data-ref.cc | 96 ++++- gcc/tree-data-ref.h | 14 +- gcc/tree-scalar-evolution.cc | 360 +++++++++++------- gcc/tree-scalar-evolution.h | 9 +- gcc/tree-ssa-loop-niter.cc | 60 ++- gcc/tree-ssa-loop-niter.h | 3 +- gcc/tree-ssa-loop.h | 4 + gcc/tree-vect-data-refs.cc | 5 +- gcc/tree-vect-loop.cc | 240 ++++++++---- gcc/tree-vectorizer.h | 4 +- 24 files changed, 729 insertions(+), 268 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-2.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-3.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-4.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-5.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-6.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-7.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-unsigned-assump-8.c -- 2.54.0