Skip to content

Options: add the documented functionControl spelling as an alias - #424

Open
pvelesko wants to merge 2 commits into
intel:masterfrom
pvelesko:fix/functioncontrol-option-alias
Open

Options: add the documented functionControl spelling as an alias#424
pvelesko wants to merge 2 commits into
intel:masterfrom
pvelesko:fix/functioncontrol-option-alias

Conversation

@pvelesko

@pvelesko pvelesko commented Aug 4, 2026

Copy link
Copy Markdown

IGCInternalOptions.td documents the option as -ze-intel-functionControl but defines only functonControl, 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.cpp still reads OPT_functonControl_common.

The test asserts on the compilation effect, since there is no diagnostic to check: FunctionControl=3 forces 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_tests only builds with -DIGC_OPTION__ENABLE_OCLOC_LIT_TESTS=ON.

Fixes #422

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

functionControl internal option is documented but only the misspelled functonControl works

1 participant