r242241 - Make the variable names match the name of the metadata they control.
Tyler Nowicki
tyler.nowicki at gmail.com
Tue Jul 14 16:03:10 PDT 2015
Author: tnowicki
Date: Tue Jul 14 18:03:09 2015
New Revision: 242241
URL: http://llvm.org/viewvc/llvm-project?rev=242241&view=rev
Log:
Make the variable names match the name of the metadata they control.
Rename Vectorizer to Vectorize and VectorizeUnroll to InterleaveCount.
Modified:
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/lib/CodeGen/CGLoopInfo.h
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=242241&r1=242240&r2=242241&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Tue Jul 14 18:03:09 2015
@@ -20,9 +20,9 @@ using namespace llvm;
static MDNode *createMetadata(LLVMContext &Ctx, const LoopAttributes &Attrs) {
- if (!Attrs.IsParallel && Attrs.VectorizerWidth == 0 &&
- Attrs.VectorizerUnroll == 0 &&
- Attrs.VectorizerEnable == LoopAttributes::VecUnspecified)
+ if (!Attrs.IsParallel && Attrs.VectorizeWidth == 0 &&
+ Attrs.InterleaveCount == 0 &&
+ Attrs.VectorizeEnable == LoopAttributes::Unspecified)
return nullptr;
SmallVector<Metadata *, 4> Args;
@@ -30,29 +30,28 @@ static MDNode *createMetadata(LLVMContex
auto TempNode = MDNode::getTemporary(Ctx, None);
Args.push_back(TempNode.get());
- // Setting vectorizer.width
- if (Attrs.VectorizerWidth > 0) {
+ // Setting vectorize.width
+ if (Attrs.VectorizeWidth > 0) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.vectorize.width"),
ConstantAsMetadata::get(ConstantInt::get(
- Type::getInt32Ty(Ctx), Attrs.VectorizerWidth))};
+ Type::getInt32Ty(Ctx), Attrs.VectorizeWidth))};
Args.push_back(MDNode::get(Ctx, Vals));
}
- // Setting vectorizer.unroll
- if (Attrs.VectorizerUnroll > 0) {
+ // Setting interleave.count
+ if (Attrs.InterleaveCount > 0) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.interleave.count"),
ConstantAsMetadata::get(ConstantInt::get(
- Type::getInt32Ty(Ctx), Attrs.VectorizerUnroll))};
+ Type::getInt32Ty(Ctx), Attrs.InterleaveCount))};
Args.push_back(MDNode::get(Ctx, Vals));
}
- // Setting vectorizer.enable
- if (Attrs.VectorizerEnable != LoopAttributes::VecUnspecified) {
- Metadata *Vals[] = {
- MDString::get(Ctx, "llvm.loop.vectorize.enable"),
- ConstantAsMetadata::get(ConstantInt::get(
- Type::getInt1Ty(Ctx),
- (Attrs.VectorizerEnable == LoopAttributes::VecEnable)))};
+ // Setting vectorize.enable
+ if (Attrs.VectorizeEnable != LoopAttributes::Unspecified) {
+ Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+ ConstantAsMetadata::get(ConstantInt::get(
+ Type::getInt1Ty(Ctx), (Attrs.VectorizeEnable ==
+ LoopAttributes::Enable)))};
Args.push_back(MDNode::get(Ctx, Vals));
}
@@ -63,14 +62,14 @@ static MDNode *createMetadata(LLVMContex
}
LoopAttributes::LoopAttributes(bool IsParallel)
- : IsParallel(IsParallel), VectorizerEnable(LoopAttributes::VecUnspecified),
- VectorizerWidth(0), VectorizerUnroll(0) {}
+ : IsParallel(IsParallel), VectorizeEnable(LoopAttributes::Unspecified),
+ VectorizeWidth(0), InterleaveCount(0) {}
void LoopAttributes::clear() {
IsParallel = false;
- VectorizerWidth = 0;
- VectorizerUnroll = 0;
- VectorizerEnable = LoopAttributes::VecUnspecified;
+ VectorizeWidth = 0;
+ InterleaveCount = 0;
+ VectorizeEnable = LoopAttributes::Unspecified;
}
LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs)
Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.h?rev=242241&r1=242240&r2=242241&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGLoopInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.h Tue Jul 14 18:03:09 2015
@@ -39,17 +39,17 @@ struct LoopAttributes {
/// \brief Generate llvm.loop.parallel metadata for loads and stores.
bool IsParallel;
- /// \brief Values of llvm.loop.vectorize.enable metadata.
- enum LVEnableState { VecUnspecified, VecEnable, VecDisable };
+ /// \brief State of loop vectorization or unrolling.
+ enum LVEnableState { Unspecified, Enable, Disable };
- /// \brief llvm.loop.vectorize.enable
- LVEnableState VectorizerEnable;
+ /// \brief Value for llvm.loop.vectorize.enable metadata.
+ LVEnableState VectorizeEnable;
- /// \brief llvm.loop.vectorize.width
- unsigned VectorizerWidth;
+ /// \brief Value for llvm.loop.vectorize.width metadata.
+ unsigned VectorizeWidth;
- /// \brief llvm.loop.interleave.count
- unsigned VectorizerUnroll;
+ /// \brief Value for llvm.loop.interleave.count metadata.
+ unsigned InterleaveCount;
};
/// \brief Information used when generating a structured loop.
@@ -109,17 +109,17 @@ public:
/// \brief Set the next pushed loop as parallel.
void setParallel(bool Enable = true) { StagedAttrs.IsParallel = Enable; }
- /// \brief Set the next pushed loop 'vectorizer.enable'
- void setVectorizerEnable(bool Enable = true) {
- StagedAttrs.VectorizerEnable =
- Enable ? LoopAttributes::VecEnable : LoopAttributes::VecDisable;
+ /// \brief Set the next pushed loop 'vectorize.enable'
+ void setVectorizeEnable(bool Enable = true) {
+ StagedAttrs.VectorizeEnable =
+ Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
}
- /// \brief Set the vectorizer width for the next loop pushed.
- void setVectorizerWidth(unsigned W) { StagedAttrs.VectorizerWidth = W; }
+ /// \brief Set the vectorize width for the next loop pushed.
+ void setVectorizeWidth(unsigned W) { StagedAttrs.VectorizeWidth = W; }
- /// \brief Set the vectorizer unroll for the next loop pushed.
- void setVectorizerUnroll(unsigned U) { StagedAttrs.VectorizerUnroll = U; }
+ /// \brief Set the interleave count for the next loop pushed.
+ void setInterleaveCount(unsigned C) { StagedAttrs.InterleaveCount = C; }
private:
/// \brief Returns true if there is LoopInfo on the stack.
Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=242241&r1=242240&r2=242241&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Jul 14 18:03:09 2015
@@ -741,7 +741,7 @@ static void emitSafelenClause(CodeGenFun
RValue Len = CGF.EmitAnyExpr(C->getSafelen(), AggValueSlot::ignored(),
/*ignoreResult=*/true);
llvm::ConstantInt *Val = cast<llvm::ConstantInt>(Len.getScalarVal());
- CGF.LoopStack.setVectorizerWidth(Val->getZExtValue());
+ CGF.LoopStack.setVectorizeWidth(Val->getZExtValue());
// In presence of finite 'safelen', it may be unsafe to mark all
// the memory instructions parallel, because loop-carried
// dependences of 'safelen' iterations are possible.
@@ -752,7 +752,7 @@ static void emitSafelenClause(CodeGenFun
void CodeGenFunction::EmitOMPSimdInit(const OMPLoopDirective &D) {
// Walk clauses and process safelen/lastprivate.
LoopStack.setParallel();
- LoopStack.setVectorizerEnable(true);
+ LoopStack.setVectorizeEnable(true);
emitSafelenClause(*this, D);
}
More information about the cfe-commits
mailing list