10000 [ESIMD] Fix usage of uninitialized field ESIMDVerifier::ForceStateles… by v-klochkov · Pull Request #8000 · intel/llvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[ESIMD] Fix usage of uninitialized field ESIMDVerifier::ForceStateles… #8000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

v-klochkov
Copy link
Contributor

…sMem

The field was properly initialized in 'ESIMDVerifierPassstruct, but not inESIMDVerifier`.
The first one gets the proper/guarantted value from LangOpts.SYCLESIMDForceStatelessMem, while the second(i.e. ESIMDVerifier) could not do the same as it is initialized from
llvm::createESIMDVerifierPass()

Fixing this issue showed that those SYCL methods that are allowed with -fsycl-esimd-force-stateless-mem, can potentially and legally be used in some other modes, for example, when used in LLVM IR consumed by 'opt' component. Thus the meaning and name of the corresponding fields in ESIMDVerifier and ESIMDVerifierPass structs were renamed from ForceStatelessMem to MayNeedForceStatelessMemModeAPI.

Signed-off-by: Vyacheslav N Klochkov vyacheslav.n.klochkov@intel.com

@@ -187,4 +187,6 @@ INITIALIZE_PASS_BEGIN(ESIMDVerifier, DEBUG_TYPE, "ESIMD-specific IR verifier",
INITIALIZE_PASS_END(ESIMDVerifier, DEBUG_TYPE, "ESIMD-specific IR verifier",
false, false)

ModulePass *llvm::createESIMDVerifierPass() { return new ESIMDVerifier(); }
ModulePass *llvm::createESIMDVerifierPass(bool MayNeedForceStatelessMemModeAPI) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR: Creation of ESIMDVerifier() without arguments left the field 'ForceStatelessMem' uninitialized and thus having random value.

@@ -173,7 +173,7 @@ struct ESIMDVerifier : public ModulePass {
}

bool runOnModule(Module &M) override {
ESIMDVerifierImpl(M, ForceStatelessMem).verify();
ESIMDVerifierImpl(M, MayNeedForceStatelessMemModeAPI).verify();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR: ForceStatelessMem field was used uninitialized here.

…sMem

The field was properly initialized in 'ESIMDVerifierPass` struct, but
not in `ESIMDVerifier`.
The first one gets the proper/guarantted value from
LangOpts.SYCLESIMDForceStatelessMem, while the second(i.e. ESIMDVerifier)
could not do the same as it is initialized from
llvm::createESIMDVerifierPass()

Fixing this issue showed that those SYCL methods that are allowed
with -fsycl-esimd-force-stateless-mem, can potentially and legally be used
in some other modes, for example, when used in LLVM IR consumed by 'opt' component.
Thus the meaning and name of the corresponding fields in ESIMDVerifier and
ESIMDVerifierPass structs were renamed from ForceStatelessMem to
MayNeedForceStatelessMemModeAPI.

Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
@v-klochkov v-klochkov temporarily deployed to aws January 13, 2023 05:24 — with GitHub Actions Inactive
@v-klochkov v-klochkov temporarily deployed to aws January 13, 2023 06:22 — with GitHub Actions Inactive
@v-klochkov v-klochkov marked this pull request as ready for review January 13, 2023 16:39
@v-klochkov v-klochkov requested a review from a team as a code owner January 13, 2023 16:39
@v-klochkov v-klochkov requested a review from sarnex January 13, 2023 16:39
@v-klochkov v-klochkov requested a review from fineg74 January 13, 2023 23:01
@v-klochkov v-klochkov merged commit 8759d07 into intel:sycl Jan 13, 2023
@v-klochkov v-klochkov deleted the esimd_coverity branch January 13, 2023 23:33
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.

3 participants
0