[PATCH] D61524: [BPF] Support for compile once and run everywhere

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 17:37:48 PDT 2019


efriedma added a comment.

I've only skimmed the patch, but the BPFAbstractMemberAccess pass seems like a bad idea.  In general, given a series of pointer arithmetic instructions in optimized LLVM IR, it is not possible to recover the original C types; LLVM types are not IR types, and we intentionally do not have any mapping from LLVM types to clang types.  The names are only a weak hint to people reading the IR, and the layouts are only a weak hint to the optimizer about the values stored in the underlying memory.

Your commit message specifically calls out geps with zero indexes, and unions, but those are definitely not the only cases where you can run into trouble.  The optimizer will rewrite your GEPs in unfriendly ways if it thinks the result is simpler; this can mean, for example, that you end up with a gep on a completely different type than the one used by the original code.

If you need to reliably support something like Objective-C non-fragile ivars, at least some of that support needs to be implemented in clang: instead of trying to rewrite geps as an IR "optimization", the IR emitted by the clang frontend should contain some representation of the appropriate arithmetic.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61524





More information about the llvm-commits mailing list