Skip to content

[libc++] Suboptimal codegen for std::equal(std::byte) #132672

@halbi2

Description

@halbi2
#include <algorithm>
bool f(char* a, char* b) {
  return std::equal(a, a+16, b, b+16);
}
bool g(std::byte* a, std::byte* b) {
  return std::equal(a, a+16, b, b+16);
}

f generates pcmpeqb. g generates a loop. std::equal should be aware that std::byte is functionally the same as char.

#89820 could relate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions