[llc] Change TargetMachine allocation assert to error (#189541)
As we shouldn't assert an allocation (which can fail). --------- Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
This commit is contained in:
parent
68a91f3d36
commit
914fca4720
@ -617,7 +617,11 @@ static int compileModule(char **argv, SmallVectorImpl<PassPlugin> &PluginList,
|
||||
// to avoid a memory leak.
|
||||
Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
|
||||
TheTriple, SkipModuleCPU, 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";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// If we don't have a module then just exit now. We do this down
|
||||
// here since the CPU/Feature help is underneath the target machine
|
||||
@ -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";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set PGO options based on command line flags
|
||||
setPGOOptions(*Target);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user