[llvm] [llc] Change `TargetMachine` allocation assert to error (PR #189541)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 01:11:36 PDT 2026


================
@@ -646,7 +650,11 @@ static int compileModule(char **argv, SmallVectorImpl<PassPlugin> &PluginList,
     InitializeOptions(TheTriple);
     Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
         TheTriple, CPUStr, FeaturesStr, Options, RM, CM, OLvl));
-    assert(Target && "Could not allocate target machine!");
+    if (!Target) {
+      WithColor::error(errs(), argv[0])
+          << "Could not allocate target machine!\n";
----------------
arsenm wrote:

```suggestion
          << "could not allocate target machine\n";
```

https://github.com/llvm/llvm-project/pull/189541


More information about the llvm-commits mailing list