Skip to content

Commit c46acc0

Browse files
meg-guptaatrick
authored andcommitted
OSSA: SimplifyCFG. Only jump thread for trivial dest block args.
Support for non-trivial args will be added separately.
1 parent 8a45b5f commit c46acc0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,13 @@ bool SimplifyCFG::tryJumpThreading(BranchInst *BI) {
10321032
auto *DestBB = BI->getDestBB();
10331033
auto *SrcBB = BI->getParent();
10341034
TermInst *destTerminator = DestBB->getTerminator();
1035+
if (Fn.hasOwnership()) {
1036+
if (llvm::any_of(DestBB->getArguments(), [this](SILValue op) {
1037+
return !op->getType().isTrivial(Fn);
1038+
})) {
1039+
return false;
1040+
}
1041+
}
10351042
// If the destination block ends with a return, we don't want to duplicate it.
10361043
// We want to maintain the canonical form of a single return where possible.
10371044
if (destTerminator->isFunctionExiting())

0 commit comments

Comments
 (0)