summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorTyler Nowicki <tnowicki@apple.com>2014-07-30 20:54:33 +0000
committerTyler Nowicki <tnowicki@apple.com>2014-07-30 20:54:33 +0000
commitcab7ca3e2a64869f6acaf730e0fb032bf1299bd7 (patch)
treeea3db3d8f014eeb585201ce62896e00006e65c2f /clang/lib/CodeGen/CGStmt.cpp
parentfee94b47ed5558a823702840075daffbda8d4f04 (diff)
downloadbcm5719-llvm-cab7ca3e2a64869f6acaf730e0fb032bf1299bd7.tar.gz
bcm5719-llvm-cab7ca3e2a64869f6acaf730e0fb032bf1299bd7.zip
Add a state variable to the loop hint attribute.
This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Reviewed by Aaron Ballman llvm-svn: 214333
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index d75b97ddf6a..df30892e869 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -588,6 +588,7 @@ void CodeGenFunction::EmitCondBrHints(llvm::LLVMContext &Context,
continue;
LoopHintAttr::OptionType Option = LH->getOption();
+ LoopHintAttr::LoopHintState State = LH->getState();
int ValueInt = LH->getValue();
const char *MetadataName;
@@ -602,8 +603,8 @@ void CodeGenFunction::EmitCondBrHints(llvm::LLVMContext &Context,
break;
case LoopHintAttr::Unroll:
// With the unroll loop hint, a non-zero value indicates full unrolling.
- MetadataName =
- ValueInt == 0 ? "llvm.loop.unroll.disable" : "llvm.loop.unroll.full";
+ MetadataName = State == LoopHintAttr::Disable ? "llvm.loop.unroll.disable"
+ : "llvm.loop.unroll.full";
break;
case LoopHintAttr::UnrollCount:
MetadataName = "llvm.loop.unroll.count";
@@ -614,7 +615,7 @@ void CodeGenFunction::EmitCondBrHints(llvm::LLVMContext &Context,
switch (Option) {
case LoopHintAttr::Vectorize:
case LoopHintAttr::Interleave:
- if (ValueInt == 1) {
+ if (State != LoopHintAttr::Disable) {
// FIXME: In the future I will modifiy the behavior of the metadata
// so we can enable/disable vectorization and interleaving separately.
Name = llvm::MDString::get(Context, "llvm.loop.vectorize.enable");
OpenPOWER on IntegriCloud