[llvm] 0a341a1 - [TableGen] Use raw_svector_ostream and ListSeparator to simplify some code. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 26 19:36:57 PST 2023
Author: Craig Topper
Date: 2023-02-26T19:36:34-08:00
New Revision: 0a341a1edad9c9a19d0bd885e78fa4731a2f94cf
URL: https://github.com/llvm/llvm-project/commit/0a341a1edad9c9a19d0bd885e78fa4731a2f94cf
DIFF: https://github.com/llvm/llvm-project/commit/0a341a1edad9c9a19d0bd885e78fa4731a2f94cf.diff
LOG: [TableGen] Use raw_svector_ostream and ListSeparator to simplify some code. NFC
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index fe5766f1ddfc..56cf9c797c7a 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1523,22 +1523,17 @@ std::string PatternToMatch::getPredicateCheck() const {
getPredicateRecords(PredicateRecs);
SmallString<128> PredicateCheck;
+ raw_svector_ostream OS(PredicateCheck);
+ ListSeparator LS(" && ");
for (Record *Pred : PredicateRecs) {
StringRef CondString = Pred->getValueAsString("CondString");
if (CondString.empty())
continue;
- if (!PredicateCheck.empty())
- PredicateCheck += " && ";
- PredicateCheck += "(";
- PredicateCheck += CondString;
- PredicateCheck += ")";
+ OS << LS << '(' << CondString << ')';
}
- if (!HwModeFeatures.empty()) {
- if (!PredicateCheck.empty())
- PredicateCheck += " && ";
- PredicateCheck += HwModeFeatures;
- }
+ if (!HwModeFeatures.empty())
+ OS << LS << HwModeFeatures;
return std::string(PredicateCheck);
}
More information about the llvm-commits
mailing list