@@ -9257,21 +9257,22 @@ SDValue SelectionDAG::getMemcpy(
92579257 // FIXME: pass in SDLoc
92589258 TargetLowering::CallLoweringInfo CLI(*this);
92599259 bool IsTailCall = false;
9260- const char *MemCpyName = TLI->getMemcpyName( );
9260+ RTLIB::LibcallImpl MemCpyImpl = TLI->getLibcallImpl(RTLIB::MEMCPY );
92619261
92629262 if (OverrideTailCall.has_value()) {
92639263 IsTailCall = *OverrideTailCall;
92649264 } else {
9265- bool LowersToMemcpy = StringRef(MemCpyName) == StringRef("memcpy") ;
9265+ bool LowersToMemcpy = MemCpyImpl == RTLIB::impl_memcpy ;
92669266 IsTailCall = isInTailCallPositionWrapper(CI, this, LowersToMemcpy);
92679267 }
92689268
92699269 CLI.setDebugLoc(dl)
92709270 .setChain(Chain)
92719271 .setLibCallee(
9272- TLI->getLibcallCallingConv(RTLIB::MEMCPY ),
9272+ TLI->getLibcallImplCallingConv(MemCpyImpl ),
92739273 Dst.getValueType().getTypeForEVT(*getContext()),
9274- getExternalSymbol(MemCpyName, TLI->getPointerTy(getDataLayout())),
9274+ getExternalSymbol(TLI->getLibcallImplName(MemCpyImpl).data(),
9275+ TLI->getPointerTy(getDataLayout())),
92759276 std::move(Args))
92769277 .setDiscardResult()
92779278 .setTailCall(IsTailCall);
@@ -9361,22 +9362,24 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
93619362 // FIXME: pass in SDLoc
93629363 TargetLowering::CallLoweringInfo CLI(*this);
93639364
9365+ RTLIB::LibcallImpl MemmoveImpl = TLI->getLibcallImpl(RTLIB::MEMMOVE);
9366+
93649367 bool IsTailCall = false;
93659368 if (OverrideTailCall.has_value()) {
93669369 IsTailCall = *OverrideTailCall;
93679370 } else {
9368- bool LowersToMemmove =
9369- TLI->getLibcallName(RTLIB::MEMMOVE) == StringRef("memmove");
9371+ bool LowersToMemmove = MemmoveImpl == RTLIB::impl_memmove;
93709372 IsTailCall = isInTailCallPositionWrapper(CI, this, LowersToMemmove);
93719373 }
93729374
93739375 CLI.setDebugLoc(dl)
93749376 .setChain(Chain)
9375- .setLibCallee(TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
9376- Dst.getValueType().getTypeForEVT(*getContext()),
9377- getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
9378- TLI->getPointerTy(getDataLayout())),
9379- std::move(Args))
9377+ .setLibCallee(
9378+ TLI->getLibcallImplCallingConv(MemmoveImpl),
9379+ Dst.getValueType().getTypeForEVT(*getContext()),
9380+ getExternalSymbol(TLI->getLibcallImplName(MemmoveImpl).data(),
9381+ TLI->getPointerTy(getDataLayout())),
9382+ std::move(Args))
93809383 .setDiscardResult()
93819384 .setTailCall(IsTailCall);
93829385
@@ -9492,8 +9495,10 @@ SDValue SelectionDAG::getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst,
94929495 TLI->getPointerTy(DL)),
94939496 std::move(Args));
94949497 }
9495- bool LowersToMemset =
9496- TLI->getLibcallName(RTLIB::MEMSET) == StringRef("memset");
9498+
9499+ RTLIB::LibcallImpl MemsetImpl = TLI->getLibcallImpl(RTLIB::MEMSET);
9500+ bool LowersToMemset = MemsetImpl == RTLIB::impl_memset;
9501+
94979502 // If we're going to use bzero, make sure not to tail call unless the
94989503 // subsequent return doesn't need a value, as bzero doesn't return the first
94999504 // arg unlike memset.
0 commit comments