[GVN] Enable enable-split-backedge-in-load-pre option by default
authorNikita Popov <npopov@redhat.com>
Wed, 25 May 2022 14:37:38 +0000 (16:37 +0200)
committerNikita Popov <npopov@redhat.com>
Mon, 30 May 2022 07:55:58 +0000 (09:55 +0200)
commit1721ff1dfd4592f1a391d9161627e2a68198a44e
treed8e114dd55b142085515423f27c9f0b2bb174702
parentf5fa633b0955a8cee878b384801038fccef11fdc
[GVN] Enable enable-split-backedge-in-load-pre option by default

This option was added in D89854. It prevents GVN from performing
load PRE in a loop, if doing so would require critical edge
splitting on the backedge. From the review:

> I know that GVN Load PRE negatively impacts peeling,
> loop predication, so the passes expecting that latch has
> a conditional branch.

In the PhaseOrdering test in this patch, splitting the backedge
negatively affects vectorization: After critical edge splitting,
the loop gets rotated, effectively peeling off the first loop
iteration. The effect is that the first element is handled
separately, then the bulk of the elements use a vectorized
reduction (but using unaligned, off-by-one memory accesses) and
then a tail of 15 elements is handled separately again.

It's probably worth noting that the loop load PRE from D99926 is
not affected by this change (as it does not need backedge
splitting). This is about normal load PRE that happens to occur
inside a loop.

Differential Revision: https://reviews.llvm.org/D126382
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/PRE/load-pre-metadata-accsess-group.ll
llvm/test/Transforms/GVN/PRE/pre-loop-load-through-select.ll
llvm/test/Transforms/GVN/PRE/rle.ll
llvm/test/Transforms/GVN/PRE/volatile.ll
llvm/test/Transforms/GVN/condprop-memdep-invalidation.ll
llvm/test/Transforms/PhaseOrdering/X86/vector-reduction-known-first-value.ll