diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp index d2c1cc2f95fb8..6bf9c48609552 100644 --- a/llvm/tools/llvm-mc/llvm-mc.cpp +++ b/llvm/tools/llvm-mc/llvm-mc.cpp @@ -549,6 +549,12 @@ int main(int argc, char **argv) { assert(MCII && "Unable to create instruction info!"); MCInstPrinter *IP = nullptr; + + if (UseMCCASBackend && FileType != OFT_ObjectFile) { + WithColor::error() << "-cas-backend is only compatible with -filetype=obj"; + return 1; + } + if (FileType == OFT_AssemblyFile) { IP = TheTarget->createMCInstPrinter(Triple(TripleName), OutputAsmVariant, *MAI, *MCII, *MRI);