mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-18 21:24:32 -04:00
[SimpleLoopUnswitch] Form dedicated exits after trivial unswitches.
Summary: Form dedicated exits after trivial unswitches. Fixes PR38737, PR38283. Reviewers: chandlerc, fedor.sergeev Subscribers: sanjoy, jlebar, uabelho, llvm-commits Differential Revision: https://reviews.llvm.org/D51375 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
; RUN: opt < %s -simple-loop-unswitch -disable-output
|
||||
|
||||
; PR38283
|
||||
; PR38737
|
||||
define void @f1() {
|
||||
for.cond1thread-pre-split.lr.ph.lr.ph:
|
||||
%tobool4 = icmp eq i16 undef, 0
|
||||
br label %for.cond1thread-pre-split
|
||||
|
||||
for.cond1thread-pre-split: ; preds = %if.end, %for.cond1thread-pre-split.lr.ph.lr.ph
|
||||
%tobool3 = icmp eq i16 undef, 0
|
||||
br label %for.body2
|
||||
|
||||
for.body2: ; preds = %if.end6, %for.cond1thread-pre-split
|
||||
br i1 %tobool3, label %if.end, label %for.end
|
||||
|
||||
if.end: ; preds = %for.body2
|
||||
br i1 %tobool4, label %if.end6, label %for.cond1thread-pre-split
|
||||
|
||||
if.end6: ; preds = %if.end
|
||||
br i1 undef, label %for.body2, label %for.end
|
||||
|
||||
for.end: ; preds = %if.end6, %for.body2
|
||||
ret void
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
; RUN: opt < %s -simple-loop-unswitch -disable-output
|
||||
|
||||
; PR38283
|
||||
; PR38737
|
||||
define void @Test(i32) {
|
||||
entry:
|
||||
%trunc = trunc i32 %0 to i3
|
||||
br label %outer
|
||||
outer:
|
||||
br label %inner
|
||||
inner:
|
||||
switch i3 %trunc, label %crit_edge [
|
||||
i3 2, label %break
|
||||
i3 1, label %loopexit
|
||||
]
|
||||
crit_edge:
|
||||
br i1 true, label %loopexit, label %inner
|
||||
loopexit:
|
||||
ret void
|
||||
break:
|
||||
br label %outer
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
; RUN: opt < %s -simple-loop-unswitch -disable-output
|
||||
|
||||
; PR38283
|
||||
; PR38737
|
||||
declare void @func_1()
|
||||
|
||||
define void @func_9(i32 signext %arg) {
|
||||
bb:
|
||||
br label %bb5
|
||||
bb5: ; preds = %bb24, %bb
|
||||
%tmp3.0 = phi i32 [ undef, %bb ], [ %tmp29, %bb24 ]
|
||||
%tmp11 = icmp eq i32 %arg, 0
|
||||
%tmp15 = icmp eq i32 %tmp3.0, 0
|
||||
%spec.select = select i1 %tmp15, i32 0, i32 49
|
||||
%tmp1.2 = select i1 %tmp11, i32 %spec.select, i32 9
|
||||
%trunc = trunc i32 %tmp1.2 to i6
|
||||
br label %bb9
|
||||
|
||||
bb9: ; preds = %bb5, %bb19
|
||||
%tmp2.03 = phi i32 [ 0, %bb5 ], [ %tmp21, %bb19 ]
|
||||
switch i6 %trunc, label %bb24 [
|
||||
i6 0, label %bb19
|
||||
i6 -15, label %bb22
|
||||
]
|
||||
|
||||
bb19: ; preds = %bb9
|
||||
%tmp21 = add nuw nsw i32 %tmp2.03, 1
|
||||
%tmp8 = icmp eq i32 %tmp21, 25
|
||||
br i1 %tmp8, label %bb22, label %bb9
|
||||
|
||||
bb22: ; preds = %bb19, %bb9
|
||||
unreachable
|
||||
|
||||
bb24: ; preds = %bb9
|
||||
%tmp29 = or i32 %tmp3.0, 1
|
||||
br label %bb5
|
||||
}
|
||||
Reference in New Issue
Block a user