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 fails to remove i<=s.size() in pointer loop. #56612

Open
AngelicosPhosphoros opened this issue Jul 19, 2022 · 0 comments
Open

LLVM fails to remove i<=s.size() in pointer loop. #56612

AngelicosPhosphoros opened this issue Jul 19, 2022 · 0 comments

Comments

@AngelicosPhosphoros
Copy link

Clang fails to DCE using idx <= len in following code.

void do_checks(const int* begin, const size_t len){
    size_t idx = 0;
    const auto end = begin + len;
    for (const int* it = begin; it!=end; ++it, ++idx){
        if (idx <= len){
            // Do something useful
        }
        else
        {
            throw 5;
        }
    }
}

godbolt

Also related: #52851

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants