diff options
author | Florian Hahn <flo@fhahn.com> | 2019-02-07 20:49:10 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-02-07 20:49:10 +0000 |
commit | ba5acbc4feb668c05cba87281cd8f6c4db824987 (patch) | |
tree | 7bcd8abbfa7be44714011e1952bf6365b84a1bb9 /llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | |
parent | e98cab11d7d7441d526b6b0a16049f2e8c196a75 (diff) | |
download | bcm5719-llvm-ba5acbc4feb668c05cba87281cd8f6c4db824987.tar.gz bcm5719-llvm-ba5acbc4feb668c05cba87281cd8f6c4db824987.zip |
[LV] Prevent interleaving if computeMaxVF returned None.
As discussed in D57382, interleaving should be avoided if computeMaxVF
returns None, same as we currently do for vectorization.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6477
Reviewers: Ayal, dcaballe, hsaito, mkuper, rengolin
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D57837
llvm-svn: 353461
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h index 7e9fee85fc8..7264eb97e1b 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h @@ -171,6 +171,9 @@ struct VectorizationFactor { unsigned Width; // Cost of the loop with that width unsigned Cost; + + // Width 1 means no vectorization, cost 0 means uncomputed cost. + static VectorizationFactor Disabled() { return {1, 0}; } }; /// Planner drives the vectorization process after having passed @@ -221,8 +224,9 @@ public: LoopVectorizationCostModel &CM) : OrigLoop(L), LI(LI), TLI(TLI), TTI(TTI), Legal(Legal), CM(CM) {} - /// Plan how to best vectorize, return the best VF and its cost. - VectorizationFactor plan(bool OptForSize, unsigned UserVF); + /// Plan how to best vectorize, return the best VF and its cost, or None if + /// vectorization and interleaving should be avoided up front. + Optional<VectorizationFactor> plan(bool OptForSize, unsigned UserVF); /// Use the VPlan-native path to plan how to best vectorize, return the best /// VF and its cost. |