diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-09-15 13:03:24 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-09-15 13:03:24 +0000 |
commit | b6a0faaa0c793aede7911be241b1895a9ebea41c (patch) | |
tree | 21064ece4fbec3859baa8ba07b9842a7f59cc0e8 /llvm/lib/Transforms/Vectorize | |
parent | 06b309d5274951a9c3c37598afece51b3948e2a4 (diff) | |
download | bcm5719-llvm-b6a0faaa0c793aede7911be241b1895a9ebea41c.tar.gz bcm5719-llvm-b6a0faaa0c793aede7911be241b1895a9ebea41c.zip |
[SLP] limit vectorization of Constant subclasses (PR33958)
This is a fix for:
https://bugs.llvm.org/show_bug.cgi?id=33958
It seems universally true that we would not want to transform this kind of
sequence on any target, but if that's not correct, then we could view this
as a target-specific cost model problem. We could also white-list ConstantInt,
ConstantFP, etc. rather than blacklist Global and ConstantExpr.
Differential Revision: https://reviews.llvm.org/D67362
llvm-svn: 371931
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 7fbcb23a349..c18972c5201 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -194,10 +194,13 @@ static bool allSameBlock(ArrayRef<Value *> VL) { return true; } -/// \returns True if all of the values in \p VL are constants. +/// \returns True if all of the values in \p VL are constants (but not +/// globals/constant expressions). static bool allConstant(ArrayRef<Value *> VL) { + // Constant expressions and globals can't be vectorized like normal integer/FP + // constants. for (Value *i : VL) - if (!isa<Constant>(i)) + if (!isa<Constant>(i) || isa<ConstantExpr>(i) || isa<GlobalValue>(i)) return false; return true; } |