[PATCH] D70243: Lowering CPI/JTI/BA to assembly

Xiangling Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 08:35:23 PST 2019


Xiangling_L marked 4 inline comments as done.
Xiangling_L added a comment.

In D70243#1750779 <https://reviews.llvm.org/D70243#1750779>, @jasonliu wrote:

> Some observation for constant pool lowering:
>  We put all the constant pool data into rodata section, and create one TC entry per constant pool reference.
>  It hinders the ability for linker to garbage collect unused data. (Generates them into a separate RO section helps a bit, but won't fully solve this issue)
>  And we would also create a lot of TC entries for constant pool that might not get cleanup.
>
> For comparison, gcc generates the value of constant pool data directly into the TC entry. It's faster and garbage collectable if not used.


I did some investigation about LLVM constant pool, as I remember, except for int value which will be put directly into TC entry, others like double, float etc. will be put into constant pool in LLVM. If we want to mimic GCC behavior, it probably would be a large piece of refactoring.

> xlC generates all the constant pool data in a single csect, but reference different data with one TC entry. Less efficient, but still less TC entry generated, and it does not mess with the other rodata.

Sorry, but can you list your testcase and some explanatory emitted results here, I am not able to reproduce what you said. And based on my observation, xlC generates one RO csect and one TC entry for each global const value [eg. `float a = 5.56`].

> So with this implementation, it would work functionally. But performance and space wise, could not compare to the other two compilers.
>  I'm Okay with moving forward with some TODOs in our mind.

Thank you for your advice.  Some plan I have in mind for emitting jump table index is that once we start supporting unique sections something like `-fdata-sections`, then we can emit each JTI to unique RO section. So I put an assertion in `getSectionForJumpTable`. And based on your suggestion I think I can do something similar in `getSectionForConstant`. Please let me know if this will resolve your concerns.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70243/new/

https://reviews.llvm.org/D70243





More information about the llvm-commits mailing list