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

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 12:22:54 PDT 2023


yonghong-song added a comment.

Thanks @eddyz87 for a detailed example. The following is my understanding.

- In any case, there is a compilation error. The binary should not be used since it is invalid with large chance.
- The continual optimization will be done with either existing code or this patch (Constant 0 -> UNDEF)
- For existing code, for *extra* parameters, the compilation will proceed with those extra parameters as constant 0.
- With this patch, for *extra* parameters, the compilation will proceed with those extra parameters as undefined.
- 'constant 0' may simplify the code and largely preserve the code flow.
- 'undefined' may also simplify the code as compiler may discard some codes involved with 'undefined' values.

I think either 'constant 0' or 'undefined' func proto argument should not impact subsequent compilation warnings.
The only possible difference is generated code and with 'constant 0' is surely more close to the original code.
Considering the buggy binary should not be really used by verifier, I think staying with existing 'constant 0'
seems more reasonable, unless a more stronger argument favors 'undef' approach.


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