Skip to content

Commit 19dd906

Browse files
authored
Merge pull request #36167 from gottesmm/pr-761936430320990a32c8dfb2f85d27f171f186ba
[simplify-cfg] Only check if we can remove releases by performing simple jump threading if our block argument is not a trivial type.
2 parents 78346c2 + 34e4e42 commit 19dd906

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,18 +1058,20 @@ bool SimplifyCFG::tryJumpThreading(BranchInst *BI) {
10581058
// given the duplication.
10591059
int ThreadingBudget = 0;
10601060

1061-
for (unsigned i = 0, e = BI->getArgs().size(); i != e; ++i) {
1061+
for (unsigned i : indices(BI->getArgs())) {
1062+
SILValue Arg = BI->getArg(i);
1063+
10621064
// If the value being substituted on is release there is a chance we could
10631065
// remove the release after jump threading.
1064-
if (couldRemoveRelease(SrcBB, BI->getArg(i), DestBB,
1066+
if (!Arg->getType().isTrivial(*SrcBB->getParent()) &&
1067+
couldRemoveRelease(SrcBB, Arg, DestBB,
10651068
DestBB->getArgument(i))) {
10661069
ThreadingBudget = 8;
10671070
break;
10681071
}
10691072

10701073
// If the value being substituted is an enum, check to see if there are any
10711074
// switches on it.
1072-
SILValue Arg = BI->getArg(i);
10731075
if (!getEnumCase(Arg, BI->getParent()) &&
10741076
!isa<IntegerLiteralInst>(Arg))
10751077
continue;

0 commit comments

Comments
 (0)