[PATCH] D156497: [BPF] Emit UNDEF rather than constant 0

Alexei Starovoitov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 18:05:41 PDT 2023


ast added a comment.

Sorry for the delay. I've been on PTO.
The change looks fine, but it's not clear to me what code will be generated with UNDEF. 
Before the change it would be 'r0=0; exit' and now just 'exit' ?
Meaning that r0 will be left in whatever state that previous code did.
So instead of generating consistent return 0 the user would have to debug random return values ?
The chance of failing the verifier is slim. The functions are rarely completely empty.
r0 is likely used in the earlier code and the verifier won't complain that it's not initialized.
So the change contradicts the intent to remove the footgun.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156497



More information about the llvm-commits mailing list