[llvm] [LLVM][Parser] Check invalid overload suffix for intrinsics (PR #108315)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 04:20:06 PDT 2024


jurahul wrote:

Maybe. I didn't know what it is until now. I understand that in the bitcode reader context but did not know that it was supported in the asm parser as well. So currently it looks like we allow any suffix when parsing (and essentially ignore it), so old versions of intrinsics with say different types or different mangling scheme still get parsed and then get auto-upgraded (since the correct mangling can be always constructed from the existing types in the IR).

It seems to be this check could still be useful in some cases. For example, I see ~113 test failures in LLVM due to this and it looks like a lot of them are just typos that get glossed over by the parser. Maybe we can add a mode to enable strict-intrinsic-overload-mangle to llvm-as (and by definition to LLParser and LLVM's assembly parsing API)? The API will disable it by default, so existing users of the API (upstream or downstream) are unaffected. llvm-as will enable it by default, so LLVM lit tests can be strict. Or even the LIT testing infra can enable the strict mode for llvm-as and other tools, with a way to disable it for specific tests. That that we don't unintentionally let bad IR sneak in and stay un-flagged.

WDYT? If this seems reasonable, I can also start a discourse thread if needed. 

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


More information about the llvm-commits mailing list