[llvm] [SPIR-V] Fix parsing of command line options for the SPIR-V Backend API call (PR #124653)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 00:46:56 PST 2025


https://github.com/nikic commented:

I don't think this really fixes the issue. If I'm reading this correctly, you still have:

 * A potential thread-safety issue, because only the option parsing is behind a lock, but not the use of those options, so they may be written and accessed concurrently.
 * Clobbering of global options, which is likely to break things if the process does anything else with LLVM other than calling this function.

I think to fix this you need to switch to using a different option parsing implementation does does not use the (global) cl::opt mechanism. For example, using OptTable might work. Though ideally, the API would not require option parsing at all.

https://github.com/llvm/llvm-project/pull/124653


More information about the llvm-commits mailing list