Skip to content

Commit fe9751f

Browse files
authored
Merge pull request #31585 from compnerd/likely
runtime: replace `LLVM_LIKELY` with `SWIFT_LIKELY` (NFC)
2 parents 7ed3058 + e7996a7 commit fe9751f

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
@@ -2963,7 +2963,7 @@ findBridgeWitness(const Metadata *T) {
29632963
}
29642964

29652965
auto w = swift_conformsToObjectiveCBridgeable(T);
2966-
if (LLVM_LIKELY(w))
2966+
if (SWIFT_LIKELY(w))
29672967
return reinterpret_cast<const _ObjectiveCBridgeableWitnessTable *>(w);
29682968
// Class and ObjC existential metatypes can be bridged, but metatypes can't
29692969
// 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
@@ -4682,8 +4682,9 @@ swift_getAssociatedTypeWitnessSlowImpl(
46824682
#endif
46834683

46844684
// If the low bit of the witness is clear, it's already a metadata pointer.
4685-
if (LLVM_LIKELY((uintptr_t(witness) &
4686-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4685+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4686+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4687+
0)) {
46874688
// Cached metadata pointers are always complete.
46884689
return MetadataResponse{(const Metadata *)witness, MetadataState::Complete};
46894690
}
@@ -4803,8 +4804,9 @@ swift::swift_getAssociatedTypeWitness(MetadataRequest request,
48034804
extraDiscriminator));
48044805
#endif
48054806

4806-
if (LLVM_LIKELY((uintptr_t(witness) &
4807-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4807+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4808+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4809+
0)) {
48084810
// Cached metadata pointers are always complete.
48094811
return MetadataResponse{(const Metadata *)witness, MetadataState::Complete};
48104812
}
@@ -4855,8 +4857,9 @@ static const WitnessTable *swift_getAssociatedConformanceWitnessSlowImpl(
48554857
#endif
48564858

48574859
// Fast path: we've already resolved this to a witness table, so return it.
4858-
if (LLVM_LIKELY((uintptr_t(witness) &
4859-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4860+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4861+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4862+
0)) {
48604863
return static_cast<const WitnessTable *>(witness);
48614864
}
48624865

@@ -4931,8 +4934,9 @@ const WitnessTable *swift::swift_getAssociatedConformanceWitness(
49314934
#endif
49324935

49334936
// Fast path: we've already resolved this to a witness table, so return it.
4934-
if (LLVM_LIKELY((uintptr_t(witness) &
4935-
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) == 0)) {
4937+
if (SWIFT_LIKELY((reinterpret_cast<uintptr_t>(witness) &
4938+
ProtocolRequirementFlags::AssociatedTypeMangledNameBit) ==
4939+
0)) {
49364940
return static_cast<const WitnessTable *>(witness);
49374941
}
49384942

0 commit comments

Comments
 (0)