Issue |
98064
|
Summary |
UnrollMaxUpperBound is unused.
|
Labels |
new issue
|
Assignees |
|
Reporter |
hiraditya
|
```cpp
#include<cstring>
#include<wctype.h>
enum {
WC_TYPE_INVALID = 0,
WC_TYPE_ALNUM,
WC_TYPE_ALPHA,
WC_TYPE_BLANK,
WC_TYPE_CNTRL,
WC_TYPE_DIGIT,
WC_TYPE_GRAPH,
WC_TYPE_LOWER,
WC_TYPE_PRINT,
WC_TYPE_PUNCT,
WC_TYPE_SPACE,
WC_TYPE_UPPER,
WC_TYPE_XDIGIT,
WC_TYPE_MAX
};
wctype_t wctype(const char* property) {
static const char* const properties[WC_TYPE_MAX] = {
"<invalid>",
"alnum", "alpha", "blank", "cntrl", "digit", "graph",
"lower", "print", "punct", "space", "upper", "xdigit"
};
for (size_t i = 0; i < WC_TYPE_MAX; ++i) {
if (!strcmp(properties[i], property)) {
return static_cast<wctype_t>(i);
}
}
return static_cast<wctype_t>(0);
}
```
`$ clang -O2 -mllvm -unroll-max-upperbound=2` unrolls the loop completely.
https://godbolt.org/z/KcaExhThq
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs