[llvm] [llvm-profgen] Add branch/target validation (PR #188620)

Wei Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 15:51:32 PDT 2026


================
@@ -637,6 +639,17 @@ bool ProfiledBinary::dissassembleSymbol(std::size_t SI, ArrayRef<uint8_t> Bytes,
         BranchAddressSet.insert(Address);
       }
 
+      if (MCDesc.isIndirectBranch()) {
+        IndirectBranchAddressSet.insert(Address);
+      }
+
+      // Record branch target addresses for branches and calls.
+      if (MCDesc.isCall() || MCDesc.isBranch()) {
+        uint64_t Target = 0;
+        if (MIA->evaluateBranch(Inst, Address, Size, Target))
----------------
apolloww wrote:

If `evaluateBranch` is non-trivial, consider combining it with the one on line 657.

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


More information about the llvm-commits mailing list