Skip to content

Commit 3637316

Browse files
committed
Allow SimplifyCFG::simplifyArgument on borrowed values
1 parent 4299974 commit 3637316

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -3730,8 +3730,6 @@ bool SimplifyCFG::simplifyArgument(SILBasicBlock *BB, unsigned i) {
37303730
}
37313731
if (inst->getOwnershipKind() == OwnershipKind::Owned)
37323732
return !inst->getSingleUse();
3733-
if (BorrowedValue borrow = BorrowedValue(inst->getOperand(0)))
3734-
return borrow.isLocalScope();
37353733
return false;
37363734
};
37373735

test/SILOptimizer/simplify_cfg_ossa_bbargs.sil

+4-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ bb3:
266266
}
267267

268268
// CHECK-LABEL: sil [ossa] @test_simplify_enum_arg_guaranteed1 :
269-
// CHECK: bb1([[ARG:%.*]] : @guaranteed $FakeOptional<Klass>)
269+
// CHECK: bb1([[ARG:%.*]] : @guaranteed $Klass)
270270
// CHECK-LABEL: } // end sil function 'test_simplify_enum_arg_guaranteed1'
271271
sil [ossa] @test_simplify_enum_arg_guaranteed1 : $@convention(thin) (@owned Klass) -> () {
272272
bb0(%0 : @owned $Klass):
@@ -290,7 +290,9 @@ bb2:
290290
return %t : $()
291291
}
292292

293-
// CHECK: bb1([[ARG:%.*]] : @guaranteed $NonTrivialStruct)
293+
// CHECK-LABEL: sil [ossa] @test_simplify_enum_arg_guaranteed2 :
294+
// CHECK: bb1([[ARG:%.*]] : @guaranteed $Klass)
295+
// CHECK-LABEL: } // end sil function 'test_simplify_enum_arg_guaranteed2'
294296
sil [ossa] @test_simplify_enum_arg_guaranteed2 : $@convention(thin) (@owned Klass) -> () {
295297
bb0(%0 : @owned $Klass):
296298
specify_test "simplify_cfg_simplify_argument @block[1] 0"

0 commit comments

Comments
 (0)