diff options
| author | Ralf Jung <post@ralfj.de> | 2023-08-10 19:07:11 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-08-10 19:07:11 +0200 |
| commit | 2e14f25c9b7ede9519ebb99eb8424511aab48371 (patch) | |
| tree | 168e6eec8c0d01a0d5f8b9e5805ba0f98f9511f1 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | a549de1588f114a0400e21911806a124cd69fcc8 (diff) | |
| parent | 9fa6bdd764a1f7bdf69eccceeace6d13f38cb2e1 (diff) | |
| download | rust-2e14f25c9b7ede9519ebb99eb8424511aab48371.tar.gz rust-2e14f25c9b7ede9519ebb99eb8424511aab48371.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 8ef39a6c866..70cdf3d6d23 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1869,7 +1869,8 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler( LLVMContextRef C, LLVMDiagnosticHandlerTy DiagnosticHandlerCallback, void *DiagnosticHandlerContext, bool RemarkAllPasses, const char * const * RemarkPasses, size_t RemarkPassesLen, - const char * RemarkFilePath + const char * RemarkFilePath, + bool PGOAvailable ) { class RustDiagnosticHandler final : public DiagnosticHandler { @@ -1967,6 +1968,11 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler( std::unique_ptr<LLVMRemarkStreamer> LlvmRemarkStreamer; if (RemarkFilePath != nullptr) { + if (PGOAvailable) { + // Enable PGO hotness data for remarks, if available + unwrap(C)->setDiagnosticsHotnessRequested(true); + } + std::error_code EC; RemarkFile = std::make_unique<ToolOutputFile>( RemarkFilePath, @@ -2027,3 +2033,14 @@ extern "C" int32_t LLVMRustGetElementTypeArgIndex(LLVMValueRef CallSite) { extern "C" bool LLVMRustIsBitcode(char *ptr, size_t len) { return identify_magic(StringRef(ptr, len)) == file_magic::bitcode; } + +extern "C" bool LLVMRustIsNonGVFunctionPointerTy(LLVMValueRef V) { + if (unwrap<Value>(V)->getType()->isPointerTy()) { + if (auto *GV = dyn_cast<GlobalValue>(unwrap<Value>(V))) { + if (GV->getValueType()->isFunctionTy()) + return false; + } + return true; + } + return false; +} |
