Suboptimal codegen — redundant zero-extend instruction in this simple C++ function
Open
llvm:optimizations
missed-optimization
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Take this simple C++ function, which counts the number of holes in the numbers in the string: (0,4,6,9 have 1 hole, 8 has two holes)
```cpp
#include
#include
using ui = std::uint_fast32_t;
using uc = std::uint_fast8_t;
ui countholes(const char* s){
constexpr static std::array pre_table{1,0,0,0,1,0,1,0,2,1};
uc c;
ui tot = 0;
while(true){
c = uc(*s++);
if(c
Contributor guide
Assessment
This issue has not been assessed yet.