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

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 19:35:02 PST 2020


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


================
Comment at: llvm/lib/Target/BPF/BPFMIAdjustOpt.cpp:78
+bool BPFMIAdjustOpt::adjustOpt(MachineFunction &MF) {
+  // Find patterns like below:
+  //     %9:gpr32 = COPY $w0
----------------
ast wrote:
> I'm not sure that is correct. Reading lower 32-bit doesn't clear upper bits. I think pattern matching would need to consider the origin of w0. It's not a guarantee that it came as return from a function.
> I think teaching verifier to understand this is a better option. 
good point. the use case is from the function return and then use w0 after that. I want to try verifier because it is tricky to get it 100% right as so many things tangled together. But maybe in verifier we do want 32bit register tracking. The work may help other potential 32bit related issues.


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