[llvm-commits] [llvm] r171000 - /llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sun Dec 23 05:19:18 PST 2012
Author: d0k
Date: Sun Dec 23 07:19:18 2012
New Revision: 171000
URL: http://llvm.org/viewvc/llvm-project?rev=171000&view=rev
Log:
LoopVectorize: For scalars and void types there is no need to compute vector insert/extract costs.
Fixes an assert during the build of oggenc in the test suite.
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=171000&r1=170999&r2=171000&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Dec 23 07:19:18 2012
@@ -2181,18 +2181,16 @@
// elements, times the vector width.
unsigned Cost = 0;
- bool IsVoid = RetTy->isVoidTy();
-
- unsigned InsCost = (IsVoid ? 0 :
- VTTI->getVectorInstrCost(Instruction::InsertElement,
- VectorTy));
-
- unsigned ExtCost = VTTI->getVectorInstrCost(Instruction::ExtractElement,
- VectorTy);
-
- // The cost of inserting the results plus extracting each one of the
- // operands.
- Cost += VF * (InsCost + ExtCost * I->getNumOperands());
+ if (RetTy->isVoidTy() || VF != 1) {
+ unsigned InsCost = VTTI->getVectorInstrCost(Instruction::InsertElement,
+ VectorTy);
+ unsigned ExtCost = VTTI->getVectorInstrCost(Instruction::ExtractElement,
+ VectorTy);
+
+ // The cost of inserting the results plus extracting each one of the
+ // operands.
+ Cost += VF * (InsCost + ExtCost * I->getNumOperands());
+ }
// The cost of executing VF copies of the scalar instruction. This opcode
// is unknown. Assume that it is the same as 'mul'.
More information about the llvm-commits
mailing list