Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multi-edge phi node code generation
It is possible, after optimziations for the two branches of a conditional to go to the same basic block. We have an IR invariant that requires the incoming value to be the same for both incoming edges in this case. LLVM has the same invariant. However, translating from a julia-incoming-value to an LLVM one may require additional code generation, and without further GVN, LLVM does not know that the two values are identical and thus believes its invariants are violated. The fix is relatively straightforward. Since we don't have user-inserted switch terminators, we can simply emit a conditional branch with equal successors as unconditional branches and skip codegening one of the phi paths. This avoids the issue and also generates less code in this case. Fixes #27594
- Loading branch information