@@ -6461,42 +6461,24 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
6461
6461
RegName, getValue (RegValue)));
6462
6462
return ;
6463
6463
}
6464
- case Intrinsic::memcpy : {
6465
- const auto &MCI = cast<MemCpyInst>(I);
6466
- SDValue Op1 = getValue (I.getArgOperand (0 ));
6467
- SDValue Op2 = getValue (I.getArgOperand (1 ));
6468
- SDValue Op3 = getValue (I.getArgOperand (2 ));
6469
- // @llvm.memcpy defines 0 and 1 to both mean no alignment.
6470
- Align DstAlign = MCI.getDestAlign ().valueOrOne ();
6471
- Align SrcAlign = MCI.getSourceAlign ().valueOrOne ();
6472
- Align Alignment = std::min (DstAlign, SrcAlign);
6473
- bool isVol = MCI.isVolatile ();
6474
- // FIXME: Support passing different dest/src alignments to the memcpy DAG
6475
- // node.
6476
- SDValue Root = isVol ? getRoot () : getMemoryRoot ();
6477
- SDValue MC = DAG.getMemcpy (Root, sdl, Op1, Op2, Op3, Alignment, isVol,
6478
- /* AlwaysInline */ false , &I, std::nullopt,
6479
- MachinePointerInfo (I.getArgOperand (0 )),
6480
- MachinePointerInfo (I.getArgOperand (1 )),
6481
- I.getAAMetadata (), BatchAA);
6482
- updateDAGForMaybeTailCall (MC);
6483
- return ;
6484
- }
6464
+ case Intrinsic::memcpy :
6485
6465
case Intrinsic::memcpy_inline: {
6486
6466
const auto &MCI = cast<MemCpyInst>(I);
6487
6467
SDValue Dst = getValue (I.getArgOperand (0 ));
6488
6468
SDValue Src = getValue (I.getArgOperand (1 ));
6489
6469
SDValue Size = getValue (I.getArgOperand (2 ));
6490
- assert (isa<ConstantSDNode>(Size ) && " memcpy_inline needs constant size" );
6470
+ assert ((!MCI.isForceInlined () || isa<ConstantSDNode>(Size )) &&
6471
+ " memcpy_inline needs constant size" );
6491
6472
// @llvm.memcpy.inline defines 0 and 1 to both mean no alignment.
6492
6473
Align DstAlign = MCI.getDestAlign ().valueOrOne ();
6493
6474
Align SrcAlign = MCI.getSourceAlign ().valueOrOne ();
6494
6475
Align Alignment = std::min (DstAlign, SrcAlign);
6495
6476
bool isVol = MCI.isVolatile ();
6496
6477
// FIXME: Support passing different dest/src alignments to the memcpy DAG
6497
6478
// node.
6498
- SDValue MC = DAG.getMemcpy (getRoot (), sdl, Dst, Src, Size , Alignment, isVol,
6499
- /* AlwaysInline */ true , &I, std::nullopt,
6479
+ SDValue Root = isVol ? getRoot () : getMemoryRoot ();
6480
+ SDValue MC = DAG.getMemcpy (Root, sdl, Dst, Src, Size , Alignment, isVol,
6481
+ MCI.isForceInlined (), &I, std::nullopt,
6500
6482
MachinePointerInfo (I.getArgOperand (0 )),
6501
6483
MachinePointerInfo (I.getArgOperand (1 )),
6502
6484
I.getAAMetadata (), BatchAA);
0 commit comments