Skip to content
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

llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp: PVS-Studio: two similar code fragments #31827

Closed
llvmbot opened this issue Mar 31, 2017 · 2 comments
Labels
backend:Hexagon bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 31, 2017

Bugzilla Link 32480
Resolution FIXED
Resolved on Mar 31, 2017 13:48
Version trunk
OS Windows NT
Blocks #30344
Reporter LLVM Bugzilla Contributor
CC @kparzysz-quic,@RKSimon

Extended Description

We have found a bug using PVS-Studio tool. PVS-Studio is a static code analyzer for C, C++ and C#: https://www.viva64.com/en/pvs-studio/

Analyzer warning: V778 Two similar code fragments were found. Perhaps, this is a typo and 'FS' variable should be used instead of 'TS'. hexagonearlyifconv.cpp 549

bool HexagonEarlyIfConversion::isProfitable(....) const
{
....
unsigned TS = 0, FS = 0, Spare = 0;
if (FP.TrueB) {
TS = std::distance(FP.TrueB->begin(),
FP.TrueB->getFirstTerminator());
if (TS < HEXAGON_PACKET_SIZE)
Spare += HEXAGON_PACKET_SIZE-TS; // <=
}
if (FP.FalseB) {
FS = std::distance(FP.FalseB->begin(),
FP.FalseB->getFirstTerminator());
if (FS < HEXAGON_PACKET_SIZE)
Spare += HEXAGON_PACKET_SIZE-TS; // <= FS ???
}
unsigned TotalIn = TS+FS;
....
}

@RKSimon
Copy link
Collaborator

RKSimon commented Mar 31, 2017

Krzysztof please can you take a look?

@kparzysz-quic
Copy link

Fixed in r299258.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Hexagon bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants