When splitting a const, insert prior to the terminal branch group. (#1325)
* When splitting a const, insert prior to the terminal branch group. Closes #1159
Given code like the following, on x86_64, which does not have i128 registers:
ebb0(v0: i64):
v1 = iconst.i128 0
v2 = icmp_imm eq v0, 1
brnz v2, ebb1
jump ebb2(v1)
It would be split to:
ebb0(v0: i64):
v1 = iconst.i128 0
v2 = icmp_imm eq v0, 1
brnz v2, ebb1
v3, v4 = isplit.i128 v1
jump ebb2(v3, v4)
But that fails basic-block invariants. This patch changes that to:
ebb0(v0: i64):
v1 = iconst.i128 0
v2 = icmp_imm eq v0, 1
v3, v4 = isplit.i128 v1
brnz v2, ebb1
jump ebb2(v3, v4)
* Add isplit-bb.clif testcase