summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-04-29 07:09:48 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-04-29 07:09:48 +0000
commit50ddc0e1b6bf83668bed3fe706611f3f3b4b101e (patch)
tree7b8ce530656af1ec3df4401c07d539d4b79bb3f0 /llvm/lib/Transforms
parent7d1b6c81af232c1a18a3465c0a9524c0d1ac29ef (diff)
downloadbcm5719-llvm-50ddc0e1b6bf83668bed3fe706611f3f3b4b101e.tar.gz
bcm5719-llvm-50ddc0e1b6bf83668bed3fe706611f3f3b4b101e.zip
[LoopVectorize] Add operand bundles to vectorized functions
Also, do not crash when calculating a cost model for loop-invariant token values. llvm-svn: 268003
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index cd781cdc2eb..d1afed0fb58 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1563,8 +1563,7 @@ public:
/// \return Returns information about the register usages of the loop for the
/// given vectorization factors.
- SmallVector<RegisterUsage, 8>
- calculateRegisterUsage(const SmallVector<unsigned, 8> &VFs);
+ SmallVector<RegisterUsage, 8> calculateRegisterUsage(ArrayRef<unsigned> VFs);
private:
/// The vectorization cost is a combination of the cost itself and a boolean
@@ -4341,7 +4340,9 @@ void InnerLoopVectorizer::vectorizeBlockInLoop(BasicBlock *BB, PhiVector *PV) {
}
assert(VectorF && "Can't create vector function.");
- CallInst *V = Builder.CreateCall(VectorF, Args);
+ SmallVector<OperandBundleDef, 1> OpBundles;
+ CI->getOperandBundlesAsDefs(OpBundles);
+ CallInst *V = Builder.CreateCall(VectorF, Args, OpBundles);
if (isa<FPMathOperator>(V))
V->copyFastMathFlags(CI);
@@ -5509,8 +5510,7 @@ unsigned LoopVectorizationCostModel::selectInterleaveCount(bool OptForSize,
}
SmallVector<LoopVectorizationCostModel::RegisterUsage, 8>
-LoopVectorizationCostModel::calculateRegisterUsage(
- const SmallVector<unsigned, 8> &VFs) {
+LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef<unsigned> VFs) {
// This function calculates the register usage by measuring the highest number
// of values that are alive at a single location. Obviously, this is a very
// rough estimation. We scan the loop in a topological order in order and
@@ -5602,6 +5602,8 @@ LoopVectorizationCostModel::calculateRegisterUsage(
// A lambda that gets the register usage for the given type and VF.
auto GetRegUsage = [&DL, WidestRegister](Type *Ty, unsigned VF) {
+ if (Ty->isTokenTy())
+ return 0U;
unsigned TypeSize = DL.getTypeSizeInBits(Ty->getScalarType());
return std::max<unsigned>(1, VF * TypeSize / WidestRegister);
};
OpenPOWER on IntegriCloud