ojhunt wrote:

> > We should also check whether a loop that simply checks for all whitespaces 
> > is faster. All the non-' ' whitespaces are consecutive numbers together, so 
> > it boils down to a `(c >= '\t' && c <= '\r') || c == ' '` (though `\n` has 
> > special handling, so it might not be as perfect).
> 
> `isHorizontalWhitespace` only matches `' '`, `'\t'`, `'\f'`, `'\v'`. I tried 
> replacing the conditions with
> 
> ```c++
> *CurPtr == ' ' || *CurPtr == '\t' || *CurPtr == '\f' || *CurPtr == '\v'
> ```
> 
> but it is slower, which is understandable seeing [what it optimizes 
> to](https://godbolt.org/z/P6coT8nn5).

That code looks perfectly reasonable - you just need to look at it when its 
part of a loop post-inlining: https://godbolt.org/z/sTz88Y9f9


https://github.com/llvm/llvm-project/pull/180819
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to