[PATCH] D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 20:21:12 PST 2020


tstellar added a comment.

I may not quite understand what the verifier is looking for here, but rather than trying to undo the optimization in 2 different places, would it be possible to implement this by having the InstructionSelector emit some kind of Pseudo Instruction for inputs to the comparison?  For example, what would normally be selected to:

if w0 s< 1 goto LBB0_4

You could instead emit:

w0 = verify_range w0
if w0 s< 1 goto LBB0_4

verify_range would be a pseudo instruction that gets expanded to  a real instruction  either by ExpandPostRAPseudo or during MC lowering.

This seems like it would be more simple to implement and also more robust.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72787





More information about the llvm-commits mailing list