From fd0bf5d6e5c258367811befde2d13111dc4ccf40 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 9 Apr 2014 14:20:47 +0000 Subject: SLPVectorizer: Only vectorize intrinsics whose operands are widened equally The vectorizer only knows how to vectorize intrinics by widening all operands by the same factor. Patch by Tyler Nowicki! llvm-svn: 205855 --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp') diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index ca55b4d6c90..6a78d756ccc 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -41,6 +41,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Transforms/Utils/VectorUtils.h" #include #include @@ -949,7 +950,9 @@ void BoUpSLP::buildTree_rec(ArrayRef VL, unsigned Depth) { case Instruction::Call: { // Check if the calls are all to the same vectorizable intrinsic. IntrinsicInst *II = dyn_cast(VL[0]); - if (II==NULL) { + Intrinsic::ID ID = II ? II->getIntrinsicID() : Intrinsic::not_intrinsic; + + if (!isTriviallyVectorizable(ID)) { newTreeEntry(VL, false); DEBUG(dbgs() << "SLP: Non-vectorizable call.\n"); return; -- cgit v1.2.3