diff options
author | Eli Bendersky <eliben@google.com> | 2014-06-25 15:41:00 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2014-06-25 15:41:00 +0000 |
commit | 5d5e18da3ef9f379b0c6c9bf2708739dc411a264 (patch) | |
tree | 97365c3d6ec3ecc29348b82341c8fff68ea81c69 /llvm/lib | |
parent | d4134ecb7293b5c7b638d29829c573d2998bda4f (diff) | |
download | bcm5719-llvm-5d5e18da3ef9f379b0c6c9bf2708739dc411a264.tar.gz bcm5719-llvm-5d5e18da3ef9f379b0c6c9bf2708739dc411a264.zip |
Rename loop unrolling and loop vectorizer metadata to have a common prefix.
[LLVM part]
These patches rename the loop unrolling and loop vectorizer metadata
such that they have a common 'llvm.loop.' prefix. Metadata name
changes:
llvm.vectorizer.* => llvm.loop.vectorizer.*
llvm.loopunroll.* => llvm.loop.unroll.*
This was a suggestion from an earlier review
(http://reviews.llvm.org/D4090) which added the loop unrolling
metadata.
Patch by Mark Heffernan.
llvm-svn: 211710
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 |
5 files changed, 15 insertions, 9 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 0c188f983ff..f4442068520 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -518,6 +518,7 @@ bool LLParser::ParseNamedGlobal() { bool LLParser::ParseMDString(MDString *&Result) { std::string Str; if (ParseStringConstant(Str)) return true; + llvm::UpgradeMDStringConstant(Str); Result = MDString::get(Context, Str); return false; } diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 696e714ff6f..4bbecfdb177 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1062,7 +1062,8 @@ std::error_code BitcodeReader::ParseMetadata() { break; } case bitc::METADATA_STRING: { - SmallString<8> String(Record.begin(), Record.end()); + std::string String(Record.begin(), Record.end()); + llvm::UpgradeMDStringConstant(String); Value *V = MDString::get(Context, String); MDValueList.AssignValue(V, NextMDValueNo++); break; diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 05b3745ab0f..6554b3c5da9 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -577,3 +577,10 @@ bool llvm::UpgradeDebugInfo(Module &M) { } return RetCode; } + +void llvm::UpgradeMDStringConstant(std::string &String) { + const std::string OldPrefix = "llvm.vectorizer."; + if (String.find(OldPrefix) == 0) { + String.replace(0, OldPrefix.size(), "llvm.loop.vectorize."); + } +} diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 0af5a71c126..00c0f88a643 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -220,7 +220,7 @@ static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls, } // Returns the value associated with the given metadata node name (for -// example, "llvm.loopunroll.count"). If no such named metadata node +// example, "llvm.loop.unroll.count"). If no such named metadata node // exists, then nullptr is returned. static const ConstantInt *GetUnrollMetadataValue(const Loop *L, StringRef Name) { @@ -250,24 +250,22 @@ static const ConstantInt *GetUnrollMetadataValue(const Loop *L, // Returns true if the loop has an unroll(enable) pragma. static bool HasUnrollEnablePragma(const Loop *L) { const ConstantInt *EnableValue = - GetUnrollMetadataValue(L, "llvm.loopunroll.enable"); + GetUnrollMetadataValue(L, "llvm.loop.unroll.enable"); return (EnableValue && EnableValue->getZExtValue()); - return false; } // Returns true if the loop has an unroll(disable) pragma. static bool HasUnrollDisablePragma(const Loop *L) { const ConstantInt *EnableValue = - GetUnrollMetadataValue(L, "llvm.loopunroll.enable"); + GetUnrollMetadataValue(L, "llvm.loop.unroll.enable"); return (EnableValue && !EnableValue->getZExtValue()); - return false; } // If loop has an unroll_count pragma return the (necessarily // positive) value from the pragma. Otherwise return 0. static unsigned UnrollCountPragmaValue(const Loop *L) { const ConstantInt *CountValue = - GetUnrollMetadataValue(L, "llvm.loopunroll.count"); + GetUnrollMetadataValue(L, "llvm.loop.unroll.count"); if (CountValue) { unsigned Count = CountValue->getZExtValue(); assert(Count >= 1 && "Unroll count must be positive."); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 79a6ecd15b7..27452825c73 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -906,7 +906,7 @@ public: } /// Return the loop vectorizer metadata prefix. - static StringRef Prefix() { return "llvm.vectorizer."; } + static StringRef Prefix() { return "llvm.loop.vectorize."; } MDNode *createHint(LLVMContext &Context, StringRef Name, unsigned V) const { SmallVector<Value*, 2> Vals; @@ -5859,4 +5859,3 @@ Value *InnerLoopUnroller::getConsecutiveVector(Value* Val, int StartIdx, Constant *C = ConstantInt::get(ITy, StartIdx, Negate); return Builder.CreateAdd(Val, C, "induction"); } - |