This is an archive of the discontinued LLVM Phabricator instance.

Reorder Value.def to optimize code size

Authored by serge-sans-paille on Oct 27 2017, 7:56 AM.



If the first values in Value.def is the range of constant, then the code generated by `isa<Constant>` is smaller by one operation (basically, an add is removed). It turns out this small optimization reduces the size of the statically linked clang binary by 400ko on my laptop. The theoritical performance gain is non visible from my benchmarks, but the size dropdown is.

Diff Detail


Event Timeline

grandinj added inline comments.
59 ↗(On Diff #120608)

Consant -> Constant

@grandinj : are you okay with the change otherwise?

Sorry, I'm not an LLVM reviewer of any note, can't make any useful decisions

Adding pete to the list of subscribers, as accordning to `svn log` he's the original author of the file.

mehdi_amini added a reviewer: pcc.
rnk accepted this revision.Nov 13 2017, 12:25 PM


I checked, and we wrap this enum in our C API, so there should be no ABI concerns here. See LLVMValueKind LLVMGetValueKind(LLVMValueRef Val) in IR/Core.cpp.

This revision is now accepted and ready to land.Nov 13 2017, 12:25 PM
Closed by commit rL318083: Reorder Value.def to optimize code size (authored by serge_sans_paille). · Explain WhyNov 13 2017, 12:57 PM
This revision was automatically updated to reflect the committed changes.

Thanks @rnk for the review!

Mmmh, build failing due to a funny warning that illustrates the optimization, see Update in r318087.