@@ -2588,6 +2588,17 @@ bool X86FastISel::TryEmitSmallMemcpy(X86AddressMode DestAM,
2588
2588
return true ;
2589
2589
}
2590
2590
2591
+ // Add an annotation to an intrinsic instruction, specifying whether the
2592
+ // intrinsic has been inlined or not.
2593
+ void annotateIntrinsic (const IntrinsicInst *II, bool Inlined) {
2594
+ IntrinsicInst *CI = const_cast <IntrinsicInst *>(II);
2595
+ LLVMContext& C = CI->getContext ();
2596
+ ConstantInt *CInt;
2597
+ CInt = ConstantInt::get (C, APInt (1 , Inlined ? 1 : 0 ));
2598
+ MDNode* N = MDNode::get (C, ConstantAsMetadata::get (CInt));
2599
+ CI->setMetadata (" yk.intrinsic.inlined" , N);
2600
+ }
2601
+
2591
2602
bool X86FastISel::fastLowerIntrinsicCall (const IntrinsicInst *II) {
2592
2603
// FIXME: Handle more intrinsics.
2593
2604
switch (II->getIntrinsicID ()) {
@@ -2725,6 +2736,7 @@ bool X86FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
2725
2736
// without a call if possible.
2726
2737
uint64_t Len = cast<ConstantInt>(MCI->getLength ())->getZExtValue ();
2727
2738
if (IsMemcpySmall (Len)) {
2739
+ annotateIntrinsic (II, true );
2728
2740
X86AddressMode DestAM, SrcAM;
2729
2741
if (!X86SelectAddress (MCI->getRawDest (), DestAM) ||
2730
2742
!X86SelectAddress (MCI->getRawSource (), SrcAM))
@@ -2741,6 +2753,7 @@ bool X86FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
2741
2753
if (MCI->getSourceAddressSpace () > 255 || MCI->getDestAddressSpace () > 255 )
2742
2754
return false ;
2743
2755
2756
+ annotateIntrinsic (II, false );
2744
2757
return lowerCallTo (II, " memcpy" , II->getNumArgOperands () - 1 );
2745
2758
}
2746
2759
case Intrinsic::memset : {
0 commit comments