diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 74c14ede24755..01e53123ea7e1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/Analysis/AliasAnalysis.h" @@ -845,16 +846,13 @@ static void getCopyToPartsVector(SelectionDAG &DAG, const SDLoc &DL, static void failForInvalidBundles(const CallBase &I, StringRef Name, ArrayRef AllowedBundles) { if (I.hasOperandBundlesOtherThan(AllowedBundles)) { + ListSeparator LS; std::string Error; + raw_string_ostream OS(Error); for (unsigned i = 0, e = I.getNumOperandBundles(); i != e; ++i) { OperandBundleUse U = I.getOperandBundleAt(i); - bool First = true; - if (is_contained(AllowedBundles, U.getTagID())) - continue; - if (!First) - Error += ", "; - First = false; - Error += U.getTagName(); + if (!is_contained(AllowedBundles, U.getTagID())) + OS << LS << U.getTagName(); } reportFatalUsageError( Twine("cannot lower ", Name) diff --git a/llvm/test/CodeGen/X86/invalid-operand-bundle-call.ll b/llvm/test/CodeGen/X86/invalid-operand-bundle-call.ll index ac4963f1f79cc..17065a4a61c2c 100644 --- a/llvm/test/CodeGen/X86/invalid-operand-bundle-call.ll +++ b/llvm/test/CodeGen/X86/invalid-operand-bundle-call.ll @@ -1,10 +1,10 @@ ; RUN: not llc -mtriple=x86_64-unknown-linux-gnu < %s 2>&1 | FileCheck %s -; CHECK: LLVM ERROR: cannot lower calls with arbitrary operand bundles: foo +; CHECK: LLVM ERROR: cannot lower calls with arbitrary operand bundles: foo, bar, baz declare void @g() define void @f(i32 %arg) { - call void @g() [ "foo"(i32 %arg) ] + call void @g() [ "foo"(i32 %arg), "bar"(i32 %arg), "baz"(i32 %arg) ] ret void }