File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -2617,13 +2617,29 @@ class UseRewriter : SILInstructionVisitor<UseRewriter> {
2617
2617
vmi->setOperand (opAddr);
2618
2618
}
2619
2619
2620
+ void visitAddressOfBorrowBuiltinInst (BuiltinInst *bi, bool stackProtected) {
2621
+ SILValue value = bi->getOperand (0 );
2622
+ SILValue addr = pass.valueStorageMap .getStorage (value).storageAddress ;
2623
+ auto &astCtx = pass.getModule ()->getASTContext ();
2624
+ SILType rawPointerType = SILType::getRawPointerType (astCtx);
2625
+ SILValue result = builder.createAddressToPointer (
2626
+ bi->getLoc (), addr, rawPointerType, stackProtected);
2627
+ bi->replaceAllUsesWith (result);
2628
+ }
2629
+
2620
2630
void visitBuiltinInst (BuiltinInst *bi) {
2621
2631
switch (bi->getBuiltinKind ().getValueOr (BuiltinValueKind::None)) {
2622
2632
case BuiltinValueKind::Copy: {
2623
2633
SILValue opAddr = addrMat.materializeAddress (use->get ());
2624
2634
bi->setOperand (0 , opAddr);
2625
2635
break ;
2626
2636
}
2637
+ case BuiltinValueKind::AddressOfBorrowOpaque:
2638
+ visitAddressOfBorrowBuiltinInst (bi, /* stackProtected=*/ true );
2639
+ break ;
2640
+ case BuiltinValueKind::UnprotectedAddressOfBorrowOpaque:
2641
+ visitAddressOfBorrowBuiltinInst (bi, /* stackProtected=*/ false );
2642
+ break ;
2627
2643
default :
2628
2644
bi->dump ();
2629
2645
llvm::report_fatal_error (" ^^^ Unimplemented builtin opaque value use." );
You can’t perform that action at this time.
0 commit comments