This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Optimise relocation iteration to remove n^2 loop. NFC.
ClosedPublic

Authored by sbc100 on Aug 21 2018, 2:06 PM.

Details

Summary

This is a rebased version https://reviews.llvm.org/D42176 which
is patch by Nicolas Wilson.

Addresses issue: https://github.com/WebAssembly/tool-conventions/issues/32,
and https://bugs.llvm.org/show_bug.cgi?id=38650

Previously, for each function/segment we iterated over every relocation
to find the relevant ones, which is an n^2 operation. Now, we just make
a single pass.

Event Timeline

sbc100 created this revision.Aug 21 2018, 2:06 PM
sbc100 updated this revision to Diff 161816.Aug 21 2018, 2:11 PM
  • cleanup
sbc100 edited the summary of this revision. (Show Details)Aug 21 2018, 2:11 PM
sbc100 added reviewers: ruiu, ncw.

This change depends on relocations being alwasy stored in offset order, and I'm not convinced that is always that case. I created this change to ensure that llvm always create reloction sections like this but I'm not under what circumstance is might currently fail to do so: https://reviews.llvm.org/D51065

ncw accepted this revision.Aug 22 2018, 1:46 AM

Thanks for rebasing, looks fine to me. I'm glad it's of use to someone.

This revision is now accepted and ready to land.Aug 22 2018, 1:46 AM
This revision was automatically updated to reflect the committed changes.