Options: add the documented functionControl spelling as an alias - #424
Open
pvelesko wants to merge 2 commits into
Open
Options: add the documented functionControl spelling as an alias#424pvelesko wants to merge 2 commits into
pvelesko wants to merge 2 commits into
Conversation
IGCInternalOptions.td advertises "-cl-intel-functonControl [<n>] -ze-intel-functionControl [<n>]" above defm functonControl : CommonSeparate<"functonControl">; CommonSeparate builds every accepted spelling out of that single base string, so the typo is carried by all six prefixes and the documented name exists nowhere. An unrecognized internal option is dropped without a diagnostic, so passing it is silently a no-op. The new ocloc test observes the option's effect rather than just its parsing: FunctionControl=3 is FLAG_FCALL_FORCE_STACKCALL, which makes ProcessFuncAttributes mark the callee noinline + visaStackCall and PrivateMemoryResolution emit "Stack call has been detected". The misspelled spelling produces that warning, the documented spelling does not. Value 1 (FLAG_FCALL_FORCE_INLINE) is also checked so that the integer operand, not merely the option name, is exercised. Only -internal_options is used, so the test does not depend on regkeys. Signed-off-by: Paulius Velesko <pvelesko@pglc.io>
CommonSeparate<"functonControl"> derives all six accepted prefixes from one base string, so the typo in that string was carried by every spelling and -ze-intel-functionControl, which the comment right above the defm advertises, matched nothing and was dropped without a diagnostic. Define the correctly spelled name as an alias of functonControl_common rather than renaming the base string, so the misspelled spelling that users depend on today keeps working. This follows the anonymous "defm : Common*<...>, Alias<..._common>" idiom already used in this file for exp-register-file-size=, vector-coalesing=, load-cache-default=, store-cache-default= and the ldstcombine options. The single consumer, OpenCLOptions.cpp, keeps reading OPT_functonControl_common and needs no change; llvm::opt resolves the alias before matching. The comment on the original defm is corrected to name what that line actually defines. API-Options-Internal.md is generated from the .td and lists alias records, so the three new rows it would gain are added alongside. Signed-off-by: Paulius Velesko <pvelesko@pglc.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IGCInternalOptions.td documents the option as
-ze-intel-functionControlbut defines onlyfunctonControl, so the documented spelling is silently ignored. Unknown internal options produce no diagnostic.Added as an alias rather than a rename, so the existing misspelled form keeps working. No consumer changes:
OpenCLOptions.cppstill readsOPT_functonControl_common.The test asserts on the compilation effect, since there is no diagnostic to check:
FunctionControl=3forces stack calls and emits "Stack call has been detected". It fails before the change and passes after. The last RUN line uses value 1 to check that the value travels through the alias, not just the name.Note that
IGC/ocloc_testsonly builds with-DIGC_OPTION__ENABLE_OCLOC_LIT_TESTS=ON.Fixes #422