[PATCH] D18367: Introduce llvm.load.relative intrinsic.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 17:25:18 PDT 2016

pcc added a comment.

> Are you planning to store v-table entries relative to the v-table's address point rather than the address of the slot?

Yes, exactly. Sorry if that wasn't clear before. On most architectures the vtable load can be expressed as a reg+imm load; we can achieve a shorter call sequence by using that register as an addend rather than having an additional immediate.

> Even if so, can't that sort of further adjustment be trivially done by the caller instead of baking it into the intrinsic?

We could certainly do it that way, but the problem with that is that I think it would make other parts of the compiler more complicated. For example, the whole-program virtual call optimizer would need to do more IR walking in order to discover the slot offset (which would now need to be present in two places in the IR and verified to be equal) and the call site. That was one of the things I wanted to address in the current design of the vcall optimizer (see also http://lists.llvm.org/pipermail/llvm-dev/2016-February/096146.html).


More information about the llvm-commits mailing list