@@ -2822,6 +2822,18 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2822
2822
" 'MoveOnly' types can only be copied in Raw SIL?!" );
2823
2823
}
2824
2824
2825
+ void checkExplicitCopyAddrInst (ExplicitCopyAddrInst *ecai) {
2826
+ require (F.hasOwnership (), " explicit_copy_* is only valid in OSSA." );
2827
+ require (ecai->getSrc ()->getType ().isAddress (),
2828
+ " Src value should be lvalue" );
2829
+ require (ecai->getDest ()->getType ().isAddress (),
2830
+ " Dest address should be lvalue" );
2831
+ requireSameType (ecai->getDest ()->getType (), ecai->getSrc ()->getType (),
2832
+ " Store operand type and dest type mismatch" );
2833
+ require (F.isTypeABIAccessible (ecai->getDest ()->getType ()),
2834
+ " cannot directly copy type with inaccessible ABI" );
2835
+ }
2836
+
2825
2837
void checkMarkUnresolvedMoveAddrInst (MarkUnresolvedMoveAddrInst *SI) {
2826
2838
require (F.hasOwnership (), " Only valid in OSSA." );
2827
2839
require (F.getModule ().getStage () == SILStage::Raw, " Only valid in Raw SIL" );
@@ -2861,6 +2873,14 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2861
2873
" 'MoveOnly' types can only be copied in Raw SIL?!" );
2862
2874
}
2863
2875
2876
+ void checkExplicitCopyValueInst (ExplicitCopyValueInst *I) {
2877
+ require (F.hasOwnership (), " explicit_copy_* is only valid in OSSA." );
2878
+ require (I->getOperand ()->getType ().isObject (),
2879
+ " Source value should be an object value" );
2880
+ require (!I->getOperand ()->getType ().isTrivial (*I->getFunction ()),
2881
+ " Source value should be non-trivial" );
2882
+ }
2883
+
2864
2884
void checkDestroyValueInst (DestroyValueInst *I) {
2865
2885
require (I->getOperand ()->getType ().isObject (),
2866
2886
" Source value should be an object value" );
0 commit comments