diff --git a/tools/llvm-slicer-crit.cpp b/tools/llvm-slicer-crit.cpp index 1a8582492..f2161f146 100644 --- a/tools/llvm-slicer-crit.cpp +++ b/tools/llvm-slicer-crit.cpp @@ -1168,28 +1168,24 @@ getSlicingCriteriaValues(llvm::Module &M, const std::string &slicingCriteria, bool criteria_are_next_instr) { std::string criteria = slicingCriteria; if (legacySlicingCriteria != "") { - if (slicingCriteria != "") - criteria += ";"; + auto legacyCriteriaParts = splitList(legacySlicingCriteria, ','); + for (auto &legacyCriterion : legacyCriteriaParts) { + if (criteria != "") + criteria += ";"; - auto parts = splitList(legacySlicingCriteria, ':'); - if (parts.size() == 2) { - if (legacySecondaryCriteria != "") { - criteria += ";" + parts[0] + "#" + parts[1] + "|" + - legacySecondaryCriteria + "()"; - } else { + auto parts = splitList(legacyCriterion, ':'); + if (parts.size() == 2) { criteria += parts[0] + "#" + parts[1]; + } else if (parts.size() == 1) { + criteria += legacyCriterion + "()"; + } else { + llvm::errs() + << "Unsupported criteria: " << legacyCriterion << "\n"; + return {}; } - } else if (parts.size() == 1) { if (legacySecondaryCriteria != "") { - criteria += ";" + legacySlicingCriteria + "()|" + - legacySecondaryCriteria + "()"; - } else { - criteria += legacySlicingCriteria + "()"; + criteria += "|" + legacySecondaryCriteria + "()"; } - } else { - llvm::errs() << "Unsupported criteria: " << legacySlicingCriteria - << "\n"; - return {}; } }