@@ -3851,10 +3851,17 @@ _CONSTEXPR20 _OutIt replace_copy(_InIt _First, _InIt _Last, _OutIt _Dest, const
3851
3851
const auto _ULast = _STD _Get_unwrapped(_Last);
3852
3852
auto _UDest = _STD _Get_unwrapped_n(_Dest, _STD _Idl_distance<_InIt>(_UFirst, _ULast));
3853
3853
for (; _UFirst != _ULast; ++_UFirst, (void) ++_UDest) {
3854
- if (*_UFirst == _Oldval) {
3855
- *_UDest = _Newval;
3854
+ if constexpr (is_integral_v<_Ty> && is_integral_v<iter_value_t<_InIt>>
3855
+ || is_pointer_v<_Ty> && is_pointer_v<iter_value_t<_InIt>>) {
3856
+ // TRANSITION, DevCom-10606350: help the compiler auto-vectorizing for simple types
3857
+ // by making transformation that can be done for simple types
3858
+ *_UDest = (*_UFirst == _Oldval) ? _Newval : *_UFirst;
3856
3859
} else {
3857
- *_UDest = *_UFirst;
3860
+ if (*_UFirst == _Oldval) {
3861
+ *_UDest = _Newval;
3862
+ } else {
3863
+ *_UDest = *_UFirst;
3864
+ }
3858
3865
}
3859
3866
}
3860
3867
@@ -3921,10 +3928,17 @@ namespace ranges {
3921
3928
_STL_INTERNAL_STATIC_ASSERT(indirect_binary_predicate<equal_to, projected<_It, _Pj>, const _Ty1*>);
3922
3929
3923
3930
for (; _First != _Last; ++_First, (void) ++_Result) {
3924
- if (_STD invoke(_Proj, *_First) == _Oldval) {
3925
- *_Result = _Newval;
3931
+ if constexpr (is_integral_v<_Ty2> && is_integral_v<iter_value_t<_It>>
3932
+ || is_pointer_v<_Ty2> && is_pointer_v<iter_value_t<_It>>) {
3933
+ // TRANSITION, DevCom-10606350: help the compiler auto-vectorizing for simple types
3934
+ // by making transformation that can be done for simple types
3935
+ *_Result = _STD invoke(_Proj, *_First) == _Oldval ? _Newval : *_First;
3926
3936
} else {
3927
- *_Result = *_First;
3937
+ if (_STD invoke(_Proj, *_First) == _Oldval) {
3938
+ *_Result = _Newval;
3939
+ } else {
3940
+ *_Result = *_First;
3941
+ }
3928
3942
}
3929
3943
}
3930
3944
0 commit comments