compiler: fix invalid incoming block in complex typeassert flow

A single *ssa.BasicBlock may be split in multiple LLVM basic blocks due
to typeassert instructions. This means the incoming block and outgoing
block are different. PHI nodes need to get the result from the outgoing
block, which was fixed before, but incoming branches need to branch to
the incoming block, not the outgoing block.

Branching to the outgoing block led to a LLVM verification error when
compiling the fmt package.

Originally found in (*fmt.pp).handleMethods.
This commit is contained in:
Ayke van Laethem
2018-10-23 14:59:44 +02:00
parent 96f74ec153
commit 6c6a43310a
3 changed files with 32 additions and 15 deletions
+1
View File
@@ -16,3 +16,4 @@ is Tuple: 0 8 16 24
SmallPair.Print: 3 5
Stringer.String(): foo
Stringer.(*Thing).String(): foo
nested switch: true