Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
BruiseLee
· 5y ago · 0 comments
The compiler is allowed to act as if this loop executes exactly 16 times. That means it could unroll and vectorize it for example.
Comments
[–]
vyodaiken
5y ago
It is completely useless to allow compilers to assume false things about the code they generate.
[–]
fooker
5y ago
It’s not useless. The assumption is not false if the program doesn’t have undefined behavior. The assumption allows the code to be a few times faster. To disallow this assumption would inhibit these optimizations.
[–]
vyodaiken
5y ago
a) the assumption is not false if it is not false! b) the speedup is not shown anywhere
[–]
fooker
5y ago
The speedup is more or less the difference between O1 and O3 optimization levels.