Skip to content

[NFC][SYCL] Fix -Wreorder warning about order of initialization #3660

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 6 commits into from
Apr 30, 2021

Conversation

smanna12
Copy link
Contributor

@smanna12 smanna12 commented Apr 29, 2021

Inside LoopAttributes::LoopAttributes(bool IsParallel) in CGLoopInfo.cpp file,
SYCLIntelFPGAVariantCount is initialized after SYCLSpeculatedIterationsNIterations.

/// Value for count variant (min/max/avg) and count metadata.
llvm::SmallVector<std::pair<const char *, unsigned int>, 2>
SYCLIntelFPGAVariantCount;

This patch removes the initialization from the ctor init list to avoid a -Wreorder warning since SYCLIntelFPGAVariantCount is defined as SmallVector which default constructs just fine here.

Inside LoopAttributes::LoopAttributes(bool IsParallel) in CGLoopInfo.cpp
file, SYCLIntelFPGAVariantCount is initialized after SYCLSpeculatedIterationsNIterations.

Change the order of declaration of these data members to avoid a -Wreorder warning.

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
Signed-off-by: Soumi Manna <soumi.manna@intel.com>
Signed-off-by: Soumi Manna <soumi.manna@intel.com>
@smanna12 smanna12 changed the title Fix warning [NFC][SYCL] Fix -Wreorder warning about order of initialization Apr 29, 2021
@smanna12 smanna12 requested a review from zahiraam April 29, 2021 19:19
@smanna12 smanna12 marked this pull request as ready for review April 29, 2021 19:19
Copy link
Contributor

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

Why is it being initialized at all in the ctor? This is a SmallVector which default constructs just fine, but the constructor init list says SYCLIntelFPGAVariantCount(false) and I have no idea what that even does. :-D I think the correct fix is to remove the initialization from the ctor init list.

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
Signed-off-by: Soumi Manna <soumi.manna@intel.com>
zahiraam
zahiraam previously approved these changes Apr 29, 2021
@smanna12 smanna12 requested a review from AaronBallman April 29, 2021 21:27
Signed-off-by: Soumi Manna <soumi.manna@intel.com>
Copy link
Contributor

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

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

LGTM

@bader bader merged commit c7a2004 into intel:sycl Apr 30, 2021
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.

6 participants