Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
BruiseLee
on May 20, 2021
|
parent
|
context
|
favorite
| on:
Undefined behavior in C is a reading error
The compiler is allowed to act as if this loop executes exactly 16 times. That means it could unroll and vectorize it for example.
vyodaiken
on May 20, 2021
[–]
It is completely useless to allow compilers to assume false things about the code they generate.
fooker
on May 20, 2021
|
parent
[–]
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
on May 21, 2021
|
root
|
parent
[–]
a) the assumption is not false if it is not false! b) the speedup is not shown anywhere
fooker
on May 23, 2021
|
root
|
parent
[–]
The speedup is more or less the difference between O1 and O3 optimization levels.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: