Skip to content

🍒 [BoundsSafety][CodeGen] don't create invalid conditional branches - #13588

Merged
hnrklssn merged 1 commit into
swiftlang:stable/23.xfrom
hnrklssn:cherry-pick-182676090-23.x
Jul 31, 2026
Merged

🍒 [BoundsSafety][CodeGen] don't create invalid conditional branches#13588
hnrklssn merged 1 commit into
swiftlang:stable/23.xfrom
hnrklssn:cherry-pick-182676090-23.x

Conversation

@hnrklssn

Copy link
Copy Markdown
Member

For null checks we would previously create a conditional branch but leave the second target block as nullptr and update it later with the correct block, after it had been created. Now that conditional and unconditional branches are different opcodes, conditional branches are defined as always having two successors, so the successors iterator no longer checks for null before casting. When inside a loop, the LoopInfoStack helper class would inspect all inserted terminator instructions' successors to determine whether the new terminator is the loop latch, leading to the crash.

Avoid this by creating the successor eagerly.

rdar://182676090

(cherry picked from commit 24620a1)

[BoundsSafety][CodeGen] don't create invalid conditional branches

(cherry picked from commit 24620a1)
@hnrklssn
hnrklssn requested a review from rapidsna July 30, 2026 22:19
@hnrklssn

Copy link
Copy Markdown
Member Author

@swift-ci test llvm

@hnrklssn
hnrklssn merged commit e92f3eb into swiftlang:stable/23.x Jul 31, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant