Avoid vectorization when the function has the "noimplicitflot" attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171429 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nadav Rotem
2013-01-02 23:54:43 +00:00
parent 82de10a34c
commit 00a6bcaeb4
2 changed files with 40 additions and 3 deletions

View File

@ -94,9 +94,17 @@ struct LoopVectorize : public LoopPass {
// Check the function attribues to find out if this function should be
// optimized for size.
Function *F = L->getHeader()->getParent();
Attribute::AttrKind SzAttr= Attribute::OptimizeForSize;
bool OptForSize =
F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, SzAttr);
Attribute::AttrKind SzAttr = Attribute::OptimizeForSize;
Attribute::AttrKind FlAttr = Attribute::NoImplicitFloat;
unsigned FnIndex = AttributeSet::FunctionIndex;
bool OptForSize = F->getAttributes().hasAttribute(FnIndex, SzAttr);
bool NoFloat = F->getAttributes().hasAttribute(FnIndex, FlAttr);
if (NoFloat) {
DEBUG(dbgs() << "LV: Can't vectorize when the NoImplicitFloat"
"attribute is used.\n");
return false;
}
unsigned VF = CM.selectVectorizationFactor(OptForSize, VectorizationFactor);