Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/target/llvm/llvm_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ llvm::TargetMachine* LLVMTargetInfo::GetOrCreateTargetMachine(bool allow_missing
llvm_instance->createTargetMachine(triple_, cpu_, GetTargetFeatureString(), target_options_,
reloc_model_, code_model_, opt_level_);
target_machine_ = std::unique_ptr<llvm::TargetMachine>(tm);
if (!allow_missing) {
Copy link
Contributor

@kparzysz-quic kparzysz-quic Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place where target_machine_ is assigned a value, so this check was actually sufficient.

Edit: the change doesn't break anything, so it can stay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emmmm but when llvm::TargetRegistry::lookupTarget(triple_, error) failed,the target_machine_ is also nullptr,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right.

ICHECK(target_machine_ != nullptr) << error;
}
}
if (!allow_missing) {
ICHECK(target_machine_ != nullptr) << error;
}
return target_machine_.get();
}
Expand Down