[PATCH] D61810: [BPF] add new intrinsics preserve_{array,union,struct}_access_index

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 13:38:00 PDT 2019


yonghong-song marked an inline comment as done.
yonghong-song added a comment.

@eli.friedman thanks for the review. I just did some experiments with some performance sensitive bpf programs. It looks the approach I am taking here cause worse case 30% instructions generated by llvm at -O2 level.
So the current approach to convert to intrinsics blindly and later on convert back unnecessary intrinsics to regular GEP and necessary intrinsics to relocatable GEP won't work.
The main reason for performance degradation is:

- intrinsics causing less optimal codes which may contributes 5% performance loss for a relative small routines, for a large routines, I have see the loss is more than 20%.
- intrinsics impact inline decision and less inlining has negative impacts on the performance.

Therefore, instead of blindly converting GEPs to intrinsics, I will try a different approach, design some bpf specific intrinsics to help bpf backend generate relocatable GEP. Considering the potential performance impact,
this approach will be only used when people trade some performance for portability in case bpf performance is not super critical.



================
Comment at: include/llvm/IR/IRBuilder.h:2270
 
+  Value *CreatePreserveArrayAccessIndex(Value *Base, const StringRef &Name,
+                                        unsigned Index) {
----------------
efriedma wrote:
> Don't pass StringRefs by const reference (see https://llvm.org/docs/ProgrammersManual.html#the-stringref-class ).
Thanks for letting me know. Will correct this in all other occasions as well.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61810





More information about the llvm-commits mailing list