Skip to content

runtime: replace LLVM_LIKELY with SWIFT_LIKELY (NFC) #31585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/public/runtime/Casting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2965,7 +2965,7 @@ findBridgeWitness(const Metadata *T) {
}

auto w = swift_conformsToObjectiveCBridgeable(T);
if (LLVM_LIKELY(w))
if (SWIFT_LIKELY(w))
return reinterpret_cast<const _ObjectiveCBridgeableWitnessTable *>(w);
// Class and ObjC existential metatypes can be bridged, but metatypes can't
// directly conform to protocols yet. Use a stand-in conformance for a type
Expand Down
20 changes: 12 additions & 8 deletions stdlib/public/runtime/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4688,8 +4688,9 @@ swift_getAssociatedTypeWitnessSlowImpl(
#endif

// If the low bit of the witness is clear, it's already a metadata pointer.
if (LLVM_LIKELY((uintptr_t(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
0)) {
// Cached metadata pointers are always complete.
return MetadataResponse{(const Metadata *)witness, MetadataState::Complete};
}
Expand Down Expand Up @@ -4809,8 +4810,9 @@ swift::swift_getAssociatedTypeWitness(MetadataRequest request,
extraDiscriminator));
#endif

if (LLVM_LIKELY((uintptr_t(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
0)) {
// Cached metadata pointers are always complete.
return MetadataResponse{(const Metadata *)witness, MetadataState::Complete};
}
Expand Down Expand Up @@ -4861,8 +4863,9 @@ static const WitnessTable *swift_getAssociatedConformanceWitnessSlowImpl(
#endif

// Fast path: we've already resolved this to a witness table, so return it.
if (LLVM_LIKELY((uintptr_t(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
0)) {
return static_cast<const WitnessTable *>(witness);
}

Expand Down Expand Up @@ -4937,8 +4940,9 @@ const WitnessTable *swift::swift_getAssociatedConformanceWitness(
#endif

// Fast path: we've already resolved this to a witness table, so return it.
if (LLVM_LIKELY((uintptr_t(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
0)) {
return static_cast<const WitnessTable *>(witness);
}

Expand Down