This change restores the behaviour that global indexes
are assigned in object file order. This was accidentally
changed in https://reviews.llvm.org/D40859.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Looks good. Is the ordering mainly for the stability of the test output, or is it expected to have a tiny improvement to code locality at runtime?
There might be a couple of other places where we could do the same change. For example calculateImports has exactly the same iteration pattern, where the imports are ordered according to the first-importing file, rather than ordered by the file that actually uses the import. Harder to see how to fix that one though. I wouldn't have thought it's worth trying.
LGTM
wasm/Writer.cpp | ||
---|---|---|
617–618 ↗ | (On Diff #126224) | Could you invert the boolean expression so that we can still do early continue (to keep the indentation shallower)? |
I think an aesthetic things. It makes sense for function and global definitions to appear in declaration order.
For import, I think it makes sense for them to appear in the order of the first object the contains the import. I can't imagine a object that imports something but doesn't use it.. at least clang shouldn't produce such a thing.
wasm/Writer.cpp | ||
---|---|---|
617–618 ↗ | (On Diff #126224) | I personally found it more readable this way around. But sure, will change it back |