forked from OSchip/llvm-project
33ffb62e23
Summary: Currently, the internal options -vectorize-loops, -vectorize-slp, and -interleave-loops do not have much practical effect. This is because they are used to initialize the corresponding flags in the pass managers, and those flags are then unconditionally overwritten when compiling via clang or via LTO from the linkers. The only exception was -vectorize-loops via opt because of some special hackery there. While vectorization could still be disabled when compiling via clang, using -fno-[slp-]vectorize, this meant that there was no way to disable it when compiling in LTO mode via the linkers. This only affected ThinLTO, since for regular LTO vectorization is done during the compile step for scalability reasons. For ThinLTO it is invoked in the LTO backends. See also the discussion on PR45434. This patch makes it so the internal options can actually be used to disable these optimizations. Ultimately, the best long term solution is to mark the loops with metadata (similar to the approach used to fix -fno-unroll-loops in D77058), but this enables a shorter term workaround, and actually makes these internal options useful. I constant propagated the initial values of these internal flags into the pass manager flags (for some reasons vectorize-loops and interleave-loops were initialized to true, while vectorize-slp was initialized to false). As mentioned above, they are overwritten unconditionally so this doesn't have any real impact, and these initial values aren't particularly meaningful. I then changed the passes to check the internl values and return without performing the associated optimization when false (I changed the default of -vectorize-slp to true so the options behave similarly). I was able to remove the hackery in opt used to get -vectorize-loops=false to work, as well as a special option there used to disable SLP vectorization. Finally, I changed thinlto-slp-vectorize-pm.c to: a) Only test SLP (moved the loop vectorization checking to a new test). b) Use code that is slp vectorized when it is enabled, and check that instead of whether the pass is enabled. c) Test the new behavior of -vectorize-slp. d) Test both pass managers. The loop vectorization (and associated interleaving) testing I moved to a new thinlto-loop-vectorize-pm.c test, with several changes: a) Changed the flags on the interleaving testing so that it will actually interleave, and check that. b) Test the new behavior of -vectorize-loops and -interleave-loops. c) Test both pass managers. Reviewers: fhahn, wmi Subscribers: hiraditya, steven_wu, dexonsmith, cfe-commits, davezarzycki, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77989 |
||
---|---|---|
.. | ||
bugpoint | ||
bugpoint-passes | ||
dsymutil | ||
gold | ||
llc | ||
lli | ||
llvm-ar | ||
llvm-as | ||
llvm-as-fuzzer | ||
llvm-bcanalyzer | ||
llvm-c-test | ||
llvm-cat | ||
llvm-cfi-verify | ||
llvm-config | ||
llvm-cov | ||
llvm-cvtres | ||
llvm-cxxdump | ||
llvm-cxxfilt | ||
llvm-cxxmap | ||
llvm-diff | ||
llvm-dis | ||
llvm-dwarfdump | ||
llvm-dwp | ||
llvm-elfabi | ||
llvm-exegesis | ||
llvm-extract | ||
llvm-go | ||
llvm-gsymutil | ||
llvm-ifs | ||
llvm-isel-fuzzer | ||
llvm-itanium-demangle-fuzzer | ||
llvm-jitlink | ||
llvm-jitlistener | ||
llvm-link | ||
llvm-lipo | ||
llvm-lto | ||
llvm-lto2 | ||
llvm-mc | ||
llvm-mc-assemble-fuzzer | ||
llvm-mc-disassemble-fuzzer | ||
llvm-mca | ||
llvm-microsoft-demangle-fuzzer | ||
llvm-ml | ||
llvm-modextract | ||
llvm-mt | ||
llvm-nm | ||
llvm-objcopy | ||
llvm-objdump | ||
llvm-opt-fuzzer | ||
llvm-opt-report | ||
llvm-pdbutil | ||
llvm-profdata | ||
llvm-rc | ||
llvm-readobj | ||
llvm-reduce | ||
llvm-rtdyld | ||
llvm-shlib | ||
llvm-size | ||
llvm-special-case-list-fuzzer | ||
llvm-split | ||
llvm-stress | ||
llvm-strings | ||
llvm-symbolizer | ||
llvm-undname | ||
llvm-xray | ||
llvm-yaml-numeric-parser-fuzzer | ||
lto | ||
msbuild | ||
obj2yaml | ||
opt | ||
opt-viewer | ||
remarks-shlib | ||
sancov | ||
sanstats | ||
verify-uselistorder | ||
vfabi-demangle-fuzzer | ||
xcode-toolchain | ||
yaml2obj | ||
CMakeLists.txt | ||
LLVMBuild.txt |