mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-04 01:11:44 +00:00
6587d6dd55
Reject the following IR as malformed (assuming that %entry, %next are not in a loop): next: %y = phi i32 [ 0, %entry ] %x = phi i32 [ %y, %entry ] Such PHI nodes came up in PR26718. While there was no consensus on whether or not this is valid IR, most opinions on that bug and in a discussion on the llvm-dev mailing list tended towards a "strict interpretation" (term by Joseph Tremoulet) of PHI node uses. Also, the language reference explicitly states that "the use of each incoming value is deemed to occur on the edge from the corresponding predecessor block to the current block" and `DominatorTree::dominates(Instruction*, Use&)` uses this definition as well. For the code mentioned in PR15384, clang does not compile to such PHIs (anymore?). The test case still hangs when replacing `%tmp6` with `%tmp` in revisions before r176366 (where PR15384 has been fixed). The occurrence of %tmp6 therefore was probably unintentional. Its value is not used except in other PHIs. Reviewers: majnemer, reames, JosephTremoulet, bkramer, grosser, jdoerfert, kparzysz, sanjoy Differential Revision: http://reviews.llvm.org/D18443 llvm-svn: 264528
48 lines
1.3 KiB
LLVM
48 lines
1.3 KiB
LLVM
; RUN: opt -S -loop-vectorize < %s
|
|
|
|
; PR15384
|
|
define void @test1(i32 %arg) {
|
|
bb:
|
|
br label %bb1
|
|
|
|
bb1: ; preds = %bb5, %bb
|
|
%tmp = phi i32 [ 1, %bb ], [ %tmp7, %bb5 ]
|
|
%tmp2 = phi i32 [ %arg, %bb ], [ %tmp9, %bb5 ]
|
|
br i1 true, label %bb5, label %bb3
|
|
|
|
bb3: ; preds = %bb1
|
|
br label %bb4
|
|
|
|
bb4: ; preds = %bb3
|
|
br label %bb5
|
|
|
|
bb5: ; preds = %bb4, %bb1
|
|
%tmp6 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ]
|
|
%tmp7 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ]
|
|
%tmp8 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ]
|
|
%tmp9 = add nsw i32 %tmp2, 1
|
|
%tmp10 = icmp eq i32 %tmp9, 0
|
|
br i1 %tmp10, label %bb11, label %bb1
|
|
|
|
bb11: ; preds = %bb5
|
|
ret void
|
|
}
|
|
|
|
; PR15748
|
|
define void @test2() {
|
|
bb:
|
|
br label %bb1
|
|
|
|
bb1: ; preds = %bb1, %bb
|
|
%tmp = phi i32 [ 0, %bb ], [ %tmp5, %bb1 ]
|
|
%tmp2 = phi i32 [ 0, %bb ], [ 1, %bb1 ]
|
|
%tmp3 = phi i32 [ 0, %bb ], [ %tmp4, %bb1 ]
|
|
%tmp4 = or i32 %tmp2, %tmp3
|
|
%tmp5 = add nsw i32 %tmp, 1
|
|
%tmp6 = icmp eq i32 %tmp5, 0
|
|
br i1 %tmp6, label %bb7, label %bb1
|
|
|
|
bb7: ; preds = %bb1
|
|
ret void
|
|
}
|