From 49d9ba575116afd52212ba6116f2dd162bd0ed76 Mon Sep 17 00:00:00 2001 From: Meghana Gupta Date: Wed, 15 Mar 2023 12:16:51 -0700 Subject: [PATCH] Enable LoopRotate on header blocks with forwarding instructions We now have support for guaranteed forwarding phis. Fixes rdar://86210259 --- lib/SILOptimizer/LoopTransforms/LoopRotate.cpp | 5 ----- test/SILOptimizer/looprotate_nontrivial_ossa.sil | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/SILOptimizer/LoopTransforms/LoopRotate.cpp b/lib/SILOptimizer/LoopTransforms/LoopRotate.cpp index 301d790b73871..f84d19c4480e5 100644 --- a/lib/SILOptimizer/LoopTransforms/LoopRotate.cpp +++ b/lib/SILOptimizer/LoopTransforms/LoopRotate.cpp @@ -79,11 +79,6 @@ canDuplicateOrMoveToPreheader(SILLoop *loop, SILBasicBlock *preheader, if (isa(inst)) { return false; } - OwnershipForwardingMixin *ofm = nullptr; - if ((ofm = OwnershipForwardingMixin::get(inst)) && - ofm->getForwardingOwnershipKind() == OwnershipKind::Guaranteed) { - return false; - } if (isa(inst)) { moves.push_back(inst); invariants.insert(inst); diff --git a/test/SILOptimizer/looprotate_nontrivial_ossa.sil b/test/SILOptimizer/looprotate_nontrivial_ossa.sil index b9d562774029f..02c5b09b8862a 100644 --- a/test/SILOptimizer/looprotate_nontrivial_ossa.sil +++ b/test/SILOptimizer/looprotate_nontrivial_ossa.sil @@ -203,7 +203,7 @@ exit: // A guaranteed value whose ownership has been forwarded must not be reborrowed. // // CHECK-LABEL: sil [ossa] @forwarded_borrow_cant_be_reborrowed : $@convention(thin) (@owned BoxStruct) -> () { -// CHECK-NOT: {{bb[0-9]+}}({{%[^,]+}} : @guaranteed $BoxStruct, {{%[^,]+}} : @guaranteed $Klass): +// CHECK: {{bb[0-9]+}}({{%[^,]+}} : @guaranteed $BoxStruct, {{%[^,]+}} : @guaranteed $Klass): // CHECK-LABEL: } // end sil function 'forwarded_borrow_cant_be_reborrowed' sil [ossa] @forwarded_borrow_cant_be_reborrowed : $@convention(thin) (@owned BoxStruct) -> () { bb0(%0 : @owned $BoxStruct):