java-topology/tools/tickets/defects/llvm-0001.md
russell@unturf.com db29a08762 undefect. CWE-407 — 92 sites, 42 ecosystems
B&W print-friendly diagrams + tinkerpop-0001 + wave-3 proof sections.
Squash of 94 local commits onto remote master.
2026-03-26 19:48:18 -04:00

1.3 KiB
Raw Blame History

id repo severity status created patched patch
llvm-0001 llvm-project HIGH PATCHED 2026-03-23 2026-03-23 defects/llvm/patch/llvm-0001-globalsmodref-sccset.patch

Defect

File: lib/Analysis/GlobalsModRef.cpp:570 Pattern: is_contained(vector<CGN*>) in call graph traversal during LTO Complexity: O(V×E) Language: C++

Description

During link-time optimization, GlobalsModRef traverses the call graph to determine which globals each function may modify. At line 570, is_contained (a linear search over a SmallVector<CallGraphNode*>) is used to check whether a node has already been visited. Since this check is performed for every edge E in a graph with V nodes, the total traversal cost is O(V×E), which is particularly impactful during LTO over large codebases.

Fix

Replace: is_contained(visited, node) With: visitedSet.count(node) Data structure change: SmallVector<CallGraphNode*> visited → DenseSet<CallGraphNode*> visitedSet

Work required

  • Patch in defects/llvm/patch/
  • Unit test — asserts exact operation counts before/after (in defects/llvm/unit/)
  • Integration test (in defects/llvm/integration/)
  • Benchmark — before/after on V=100,200,400,800 (in defects/llvm/bench/)
  • White paper section