swiftlang / swift-corelibs-libdispatch

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware
swift.org
Apache License 2.0
2.47k stars 461 forks source link

Skip unneeded check if last_locked is 0 #596

Closed DTeachs closed 2 years ago

DTeachs commented 2 years ago

It will be be checked anyway, and redundant checks mean more points of failure.

DTeachs commented 2 years ago

Also it has the added benefit of clang doing loop unrolling:

https://godbolt.org/z/8qhsrhefj

rokhinip commented 2 years ago

This seems like a reboot of https://github.com/apple/swift-corelibs-libdispatch/pull/566 and https://github.com/apple/swift-corelibs-libdispatch/pull/564 which were declined.