[lld][macho] Move unwind logic from equalsVariable to equalsConstant (#165325)
Since equalsVariable runs a lot more times, we want to minimize the work
it
needs to do. Anything not dependent on the icfEqClass values should get
hoisted
out.
With this change, ICF runs ~1.7% faster when linking clang.
Benchmarking approach:
cbdr sample -b ~/extract-icf-time.sh ~/old/ld64.lld bin/ld64.lld
--timeout=300s | cbdr analyze -s 95
`extract-icf-time.sh` runs the clang link command with the `--icf=all
--time-trace` flags, then parses out the ICF duration from the resulting
time
trace using `jq`:
jq '{ICF: (.traceEvents[] | select(.name == "Fold Identical Code
Sections") | .dur)}'
Output:
</Users/jezng/extract-icf-time.sh ["/Users/jezng/old/ld64.lld"]>
</Users/jezng/extract-icf-time.sh ["bin/ld64.lld"]> difference (95% CI)
ICF 83678.207 ± 1502.778 82234.751 ± 1290.984 [ -2.0% .. -1.4%]
samples 208 225