1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/CodeGen/AArch64/fast-isel-switch-phi.ll
Juergen Ributzka 7bc40d4ed6 [FastISel] Undo phi node updates when falling-back to SelectionDAG.
The included test case would fail, because the MI PHI node would have two
operands from the same predecessor.

This problem occurs when a switch instruction couldn't be selected. This happens
always, because there is no default switch support for FastISel to begin with.

The problem was that FastISel would first add the operand to the PHI nodes and
then fall-back to SelectionDAG, which would then in turn add the same operands
to the PHI nodes again.

This fix removes these duplicate PHI node operands by reseting the
PHINodesToUpdate to its original state before FastISel tried to select the
instruction.

This fixes <rdar://problem/18155224>.

llvm-svn: 216640
2014-08-28 02:06:55 +00:00

27 lines
573 B
LLVM

; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel -verify-machineinstrs < %s
; REQUIRES: asserts
; Test that the Machine Instruction PHI node doesn't have more than one operand
; from the same predecessor.
define i32 @foo(i32 %a, i32 %b, i1 %c) {
entry:
br i1 %c, label %switch, label %direct
switch:
switch i32 %a, label %exit [
i32 43, label %continue
i32 45, label %continue
]
direct:
%var = add i32 %b, 1
br label %continue
continue:
%var.phi = phi i32 [ %var, %direct ], [ 0, %switch ], [ 0, %switch ]
ret i32 %var.phi
exit:
ret i32 1
}