Skip to content

Commit e7996a7

Browse files
committed
runtime: replace LLVM_LIKELY with SWIFT_LIKELY (NFC)
Use the Swift namespaced version of the macro and reduce the dependency on LLVMSupport.
1 parent c29c42f commit e7996a7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

stdlib/public/runtime/Casting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2965,7 +2965,7 @@ findBridgeWitness(const Metadata *T) {
29652965
}
29662966

29672967
auto w = swift_conformsToObjectiveCBridgeable(T);
2968-
if (LLVM_LIKELY(w))
2968+
if (SWIFT_LIKELY(w))
29692969
return reinterpret_cast<const _ObjectiveCBridgeableWitnessTable *>(w);
29702970
// Class and ObjC existential metatypes can be bridged, but metatypes can't
29712971
// directly conform to protocols yet. Use a stand-in conformance for a type

stdlib/public/runtime/Metadata.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4688,8 +4688,9 @@ swift_getAssociatedTypeWitnessSlowImpl(
46884688
#endif
46894689

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

4812-
if (LLVM_LIKELY((uintptr_t(witness) &
4813-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4813+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4814+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4815+
0)) {
48144816
// Cached metadata pointers are always complete.
48154817
return MetadataResponse{(const Metadata *)witness, MetadataState::Complete};
48164818
}
@@ -4861,8 +4863,9 @@ static const WitnessTable *swift_getAssociatedConformanceWitnessSlowImpl(
48614863
#endif
48624864

48634865
// Fast path: we've already resolved this to a witness table, so return it.
4864-
if (LLVM_LIKELY((uintptr_t(witness) &
4865-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4866+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4867+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4868+
0)) {
48664869
return static_cast<const WitnessTable *>(witness);
48674870
}
48684871

@@ -4937,8 +4940,9 @@ const WitnessTable *swift::swift_getAssociatedConformanceWitness(
49374940
#endif
49384941

49394942
// Fast path: we've already resolved this to a witness table, so return it.
4940-
if (LLVM_LIKELY((uintptr_t(witness) &
4941-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4943+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4944+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4945+
0)) {
49424946
return static_cast<const WitnessTable *>(witness);
49434947
}
49444948

0 commit comments

Comments
 (0)