[llvm-branch-commits] [llvm] [BOLT] Attach pseudo probes to blocks in YAML profile (PR #99554)

2024-07-18 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LGTM, though not an expert in pseudo probes https://github.com/llvm/llvm-project/pull/99554 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler edited https://github.com/llvm/llvm-project/pull/91667 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Rafael Auler via llvm-branch-commits
@@ -2523,6 +2523,16 @@ BinaryFunction *BinaryContext::getBinaryFunctionAtAddress(uint64_t Address) { return nullptr; } +/// Deregister JumpTable registered at a given \p Address and delete it. +void BinaryContext::deleteJumpTable(uint64_t Address) { + JumpTable *JT =

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Rafael Auler via llvm-branch-commits
@@ -1876,6 +1876,13 @@ class X86MCPlusBuilder : public MCPlusBuilder { //add %r2, %r1 //jmp *%r1 // +// or a fixed indirect jump template: +// +//movslq En(%rip), {%r2|%r1} +//lea PIC_JUMP_TABLE(%rip), {%r1|%r2} <- MemLocInstr

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. Thanks for working on this, Amir https://github.com/llvm/llvm-project/pull/91667 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [llvm] [BOLT] Eliminate dead jump tables (PR #91666)

2024-05-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler requested changes to this pull request. Looks like this is dangerous and crashes binaries in our tests? Do you still want to move forward with this stack? Or are you working on it? If this stack is work in progress, maybe mark it as "changes planned" or the

[llvm-branch-commits] [llvm] [BOLT][NFCI] Fix return type of BC::getSignedValueAtAddress (PR #91664)

2024-05-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/91664 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [BOLT][NFC] Define getExprValue helper (PR #91663)

2024-05-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/91663 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [BOLT][NFC] Simplify analyzeIndirectBranch (PR #91662)

2024-05-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/91662 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LGTM thanks https://github.com/llvm/llvm-project/pull/93075 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [llvm] [bolt] Revise IDE folder structure (PR #89742)

2024-04-24 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/89742 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add secondary entry points to BAT (PR #86218)

2024-03-25 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/86218 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add secondary entry points to BAT (PR #86218)

2024-03-25 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler edited https://github.com/llvm/llvm-project/pull/86218 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add secondary entry points to BAT (PR #86218)

2024-03-25 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler requested changes to this pull request. https://github.com/llvm/llvm-project/pull/86218 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [llvm] [BOLT] Add secondary entry points to BAT (PR #86218)

2024-03-25 Thread Rafael Auler via llvm-branch-commits
@@ -244,6 +259,17 @@ void BoltAddressTranslation::writeMaps(std::map , InOffset >> 1, BBHash, BBIndex)); } } +uint32_t PrevOffset = 0; +if (!Cold && NumSecondaryEntryPoints) { + LLVM_DEBUG(dbgs() << "Secondary entry

[llvm-branch-commits] [BOLT] Emit intra-function control flow in YAMLBAT (PR #76911)

2024-03-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/76911 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add CallSiteInfo entries in YAMLBAT (PR #76896)

2024-03-22 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/76896 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [BOLT] Emit intra-function control flow in YAMLBAT (PR #76911)

2024-03-21 Thread Rafael Auler via llvm-branch-commits
@@ -128,6 +128,26 @@ class BoltAddressTranslation { /// Returns BB index by function output address (after BOLT) and basic block /// input offset. unsigned getBBIndex(uint64_t FuncOutputAddress, uint32_t BBInputOffset) const; + + using BBHashMap = std::map>; + ///

[llvm-branch-commits] [BOLT] Add number of basic blocks to BAT (PR #86045)

2024-03-21 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/86045 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add BB index to BAT (PR #86044)

2024-03-21 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/86044 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Output basic YAML profile in BAT mode (PR #76910)

2024-03-21 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LG https://github.com/llvm/llvm-project/pull/76910 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)

2024-03-20 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76907 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add binary introspection/JIT manager (PR #81346)

2024-02-12 Thread Rafael Auler via llvm-branch-commits
@@ -0,0 +1,99 @@ +#include "bolt/Rewrite/JITRewriteInstance.h" +#include "bolt/Core/BinaryContext.h" +#include "llvm/BinaryFormat/ELF.h" +#include "llvm/Support/TargetSelect.h" +#include "gtest/gtest.h" + +using namespace llvm; +using namespace llvm::object; +using namespace

[llvm-branch-commits] [BOLT] Log through JournalingStreams (PR #81524)

2024-02-12 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. Thanks, here's what I think is a suitable commit message for this one: Make core BOLT functionality more friendly to being used as a library instead of in our standalone driver llvm-bolt. To accomplish this, we augment BinaryContext

[llvm-branch-commits] [llvm] [BOLT] Propagate BOLTErrors from Core, RewriteInstance, and passes (2/2) (PR #81523)

2024-02-12 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. Thanks, as commit message: As part of the effort to refactor old error handling code that would directly call exit(1), in this patch continue the migration on libCore, libRewrite and libPasses to use the new BOLTError class whenever a

[llvm-branch-commits] [BOLT][NFC] Add BOLTError and return it from passes (1/2) (PR #81522)

2024-02-12 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler edited https://github.com/llvm/llvm-project/pull/81522 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [BOLT][NFC] Add BOLTError and return it from passes (1/2) (PR #81522)

2024-02-12 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. Thanks, as commit message we can put something like: As part of the effort to refactor old error handling code that would directly call exit(1), in this patch we add a new class BOLTError and auxiliary functions createFatalBOLTError()

[llvm-branch-commits] [llvm] [BOLT] Add binary introspection/JIT manager (PR #81346)

2024-02-09 Thread Rafael Auler via llvm-branch-commits
rafaelauler wrote: Depends on #81082 https://github.com/llvm/llvm-project/pull/81346 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Add binary introspection/JIT manager (PR #81346)

2024-02-09 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler created https://github.com/llvm/llvm-project/pull/81346 Add a class that allows a process to introspect or investigate itself by disassembling its memory contents just-in-time with BOLT. An example is shown in a new unittest binary. This leverages the new

[llvm-branch-commits] [clang] [openmp] [libc] [lldb] [clang-tools-extra] [flang] [mlir] [libcxx] [llvm] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)

2024-01-25 Thread Rafael Auler via llvm-branch-commits
@@ -36,9 +37,12 @@ void BoltAddressTranslation::writeEntriesForBB(MapTy , if (BBInputOffset == BinaryBasicBlock::INVALID_OFFSET) return; - LLVM_DEBUG(dbgs() << "BB " << BB.getName() << "\n"); - LLVM_DEBUG(dbgs() << " Key: " << Twine::utohexstr(BBOutputOffset) -

[llvm-branch-commits] [llvm] [openmp] [flang] [clang] [mlir] [lldb] [libcxx] [clang-tools-extra] [libc] [BOLT][NFC] Pass BF/BB hashes to BAT (PR #76906)

2024-01-25 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76906 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [clang] [libc] [llvm] [libcxx] [openmp] [lldb] [flang] [mlir] [clang-tools-extra] [BOLT] Deduplicate equal offsets in BAT (PR #76905)

2024-01-25 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76905 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [lldb] [clang] [BOLT] Fix spurious boltedcollection from merge-fdata (PR #78653)

2024-01-18 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/78653 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [flang] [clang] [clang-tools-extra] [mlir] [libc] [libcxx] [openmp] [llvm] [lldb] [BOLT] Use continuous output addresses in delta encoding in BAT (PR #76904)

2024-01-18 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/76904 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [mlir] [clang] [flang] [openmp] [lldb] [libc] [libcxx] [clang-tools-extra] [llvm] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-12 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. Thanks, looks good. https://github.com/llvm/llvm-project/pull/76903 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [llvm] [clang-tools-extra] [libcxx] [lldb] [libc] [flang] [clang] [mlir] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -119,6 +130,7 @@ class BoltAddressTranslation { uint64_t FuncAddress); std::map Maps; + std::map ColdMaps; rafaelauler wrote: Kind of weird that this is only used for write(), and not during parsing. There is a lost symmetry

[llvm-branch-commits] [clang] [mlir] [clang-tools-extra] [libcxx] [flang] [llvm] [libc] [lldb] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -11,6 +11,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/DataExtractor.h" rafaelauler wrote: Not sure why was this moved here https://github.com/llvm/llvm-project/pull/76903

[llvm-branch-commits] [lldb] [llvm] [libcxx] [mlir] [clang-tools-extra] [clang] [libc] [flang] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -78,10 +79,20 @@ class BoltAddressTranslation { BoltAddressTranslation() {} + /// Write the serialized address translation table for a function. + template rafaelauler wrote: Move to private: ? https://github.com/llvm/llvm-project/pull/76903

[llvm-branch-commits] [libcxx] [mlir] [clang-tools-extra] [clang] [llvm] [flang] [libc] [lldb] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler edited https://github.com/llvm/llvm-project/pull/76903 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [mlir] [clang] [flang] [lldb] [llvm] [libcxx] [clang-tools-extra] [libc] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -160,12 +164,31 @@ std::error_code BoltAddressTranslation::parse(StringRef Buf) { return make_error_code(llvm::errc::io_error); Error Err(Error::success()); + std::vector HotFuncs; rafaelauler wrote: Is this HotFuncs vector going to be used in

[llvm-branch-commits] [llvm] [mlir] [flang] [lldb] [libc] [libcxx] [clang] [clang-tools-extra] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -78,10 +79,20 @@ class BoltAddressTranslation { BoltAddressTranslation() {} + /// Write the serialized address translation table for a function. + template + void writeMaps(std::map , raw_ostream ); + /// Write the serialized address translation tables for each

[llvm-branch-commits] [llvm] [clang-tools-extra] [lldb] [clang] [libc] [libcxx] [mlir] [flang] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler requested changes to this pull request. https://github.com/llvm/llvm-project/pull/76903 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [llvm] [clang-tools-extra] [lldb] [clang] [libc] [libcxx] [mlir] [BOLT] Delta-encode function start addresses in BAT (PR #76902)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76902 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [clang-tools-extra] [clang] [libcxx] [mlir] [llvm] [libc] [lldb] [BOLT] Delta-encode offsets in BAT (PR #76900)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -164,12 +167,16 @@ std::error_code BoltAddressTranslation::parse(StringRef Buf) { LLVM_DEBUG(dbgs() << "Parsing " << NumEntries << " entries for 0x" << Twine::utohexstr(Address) << "\n"); +uint64_t InputOffset = 0, OutputOffset = 0;

[llvm-branch-commits] [clang] [mlir] [libc] [lldb] [clang-tools-extra] [llvm] [libcxx] [BOLT] Delta-encode offsets in BAT (PR #76900)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -114,9 +114,12 @@ void BoltAddressTranslation::write(const BinaryContext , raw_ostream ) { << Twine::utohexstr(Address) << ".\n"); encodeULEB128(Address, OS); encodeULEB128(NumEntries, OS); +uint64_t InOffset = 0, OutOffset = 0;

[llvm-branch-commits] [clang-tools-extra] [mlir] [lldb] [libcxx] [llvm] [libc] [clang] [BOLT] Delta-encode offsets in BAT (PR #76900)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler edited https://github.com/llvm/llvm-project/pull/76900 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [clang-tools-extra] [lldb] [clang] [libc] [libcxx] [mlir] [BOLT] Delta-encode offsets in BAT (PR #76900)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76900 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [mlir] [clang-tools-extra] [libc] [libcxx] [clang] [lldb] [BOLT] Encode BAT using ULEB128 (PR #76899)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. Great! https://github.com/llvm/llvm-project/pull/76899 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [libcxx] [libc] [clang-tools-extra] [llvm] [lldb] [clang] [mlir] [BOLT] Add BOLT Address Translation documentation (PR #76898)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
@@ -0,0 +1,97 @@ +# BOLT Address Translation (BAT) +# Purpose +A regular profile collection for BOLT involves collecting samples from +unoptimized binary. BOLT Address Translation allows collecting profile +from BOLT-optimized binary and using it for optimizing the input

[llvm-branch-commits] [llvm] [libc] [mlir] [libcxx] [clang-tools-extra] [lldb] [clang] [BOLT] Add BOLT Address Translation documentation (PR #76898)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76898 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [mlir] [lldb] [clang] [libcxx] [clang-tools-extra] [libc] [BOLT] Add BOLT Address Translation documentation (PR #76898)

2024-01-11 Thread Rafael Auler via llvm-branch-commits
https://github.com/rafaelauler edited https://github.com/llvm/llvm-project/pull/76898 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits