@@ -1584,55 +1584,29 @@ exit:
1584
1584
ret void
1585
1585
}
1586
1586
1587
- define void @redundant_branch_and_tail_folding (ptr %dst , i1 %c ) optsize {
1587
+ define void @redundant_branch_and_tail_folding (ptr %dst , i1 %c ) {
1588
1588
; DEFAULT-LABEL: define void @redundant_branch_and_tail_folding(
1589
- ; DEFAULT-SAME: ptr [[DST:%.*]], i1 [[C:%.*]]) #[[ATTR4:[0-9]+]] {
1589
+ ; DEFAULT-SAME: ptr [[DST:%.*]], i1 [[C:%.*]]) {
1590
1590
; DEFAULT-NEXT: entry:
1591
1591
; DEFAULT-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
1592
1592
; DEFAULT: vector.ph:
1593
1593
; DEFAULT-NEXT: br label [[VECTOR_BODY:%.*]]
1594
1594
; DEFAULT: vector.body:
1595
- ; DEFAULT-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[PRED_STORE_CONTINUE6:%.* ]] ]
1596
- ; DEFAULT-NEXT: [[VEC_IND :%.*]] = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[PRED_STORE_CONTINUE6 ]] ]
1597
- ; DEFAULT-NEXT: [[TMP0 :%.*]] = icmp ule <4 x i64> [[VEC_IND ]], splat (i64 20 )
1595
+ ; DEFAULT-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY ]] ]
1596
+ ; DEFAULT-NEXT: [[VEC_IND1 :%.*]] = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY ]] ]
1597
+ ; DEFAULT-NEXT: [[VEC_IND :%.*]] = add <4 x i64> [[VEC_IND1 ]], splat (i64 4 )
1598
1598
; DEFAULT-NEXT: [[TMP1:%.*]] = add nuw nsw <4 x i64> [[VEC_IND]], splat (i64 1)
1599
1599
; DEFAULT-NEXT: [[TMP2:%.*]] = trunc <4 x i64> [[TMP1]] to <4 x i32>
1600
- ; DEFAULT-NEXT: [[TMP3:%.*]] = extractelement <4 x i1> [[TMP0]], i32 0
1601
- ; DEFAULT-NEXT: br i1 [[TMP3]], label [[PRED_STORE_IF:%.*]], label [[PRED_STORE_CONTINUE:%.*]]
1602
- ; DEFAULT: pred.store.if:
1603
- ; DEFAULT-NEXT: [[TMP4:%.*]] = extractelement <4 x i32> [[TMP2]], i32 0
1604
- ; DEFAULT-NEXT: store i32 [[TMP4]], ptr [[DST]], align 4
1605
- ; DEFAULT-NEXT: br label [[PRED_STORE_CONTINUE]]
1606
- ; DEFAULT: pred.store.continue:
1607
- ; DEFAULT-NEXT: [[TMP5:%.*]] = extractelement <4 x i1> [[TMP0]], i32 1
1608
- ; DEFAULT-NEXT: br i1 [[TMP5]], label [[PRED_STORE_IF1:%.*]], label [[PRED_STORE_CONTINUE2:%.*]]
1609
- ; DEFAULT: pred.store.if1:
1610
- ; DEFAULT-NEXT: [[TMP6:%.*]] = extractelement <4 x i32> [[TMP2]], i32 1
1611
- ; DEFAULT-NEXT: store i32 [[TMP6]], ptr [[DST]], align 4
1612
- ; DEFAULT-NEXT: br label [[PRED_STORE_CONTINUE2]]
1613
- ; DEFAULT: pred.store.continue2:
1614
- ; DEFAULT-NEXT: [[TMP7:%.*]] = extractelement <4 x i1> [[TMP0]], i32 2
1615
- ; DEFAULT-NEXT: br i1 [[TMP7]], label [[PRED_STORE_IF3:%.*]], label [[PRED_STORE_CONTINUE4:%.*]]
1616
- ; DEFAULT: pred.store.if3:
1617
- ; DEFAULT-NEXT: [[TMP8:%.*]] = extractelement <4 x i32> [[TMP2]], i32 2
1618
- ; DEFAULT-NEXT: store i32 [[TMP8]], ptr [[DST]], align 4
1619
- ; DEFAULT-NEXT: br label [[PRED_STORE_CONTINUE4]]
1620
- ; DEFAULT: pred.store.continue4:
1621
- ; DEFAULT-NEXT: [[TMP9:%.*]] = extractelement <4 x i1> [[TMP0]], i32 3
1622
- ; DEFAULT-NEXT: br i1 [[TMP9]], label [[PRED_STORE_IF5:%.*]], label [[PRED_STORE_CONTINUE6]]
1623
- ; DEFAULT: pred.store.if5:
1624
1600
; DEFAULT-NEXT: [[TMP10:%.*]] = extractelement <4 x i32> [[TMP2]], i32 3
1625
1601
; DEFAULT-NEXT: store i32 [[TMP10]], ptr [[DST]], align 4
1626
- ; DEFAULT-NEXT: br label [[PRED_STORE_CONTINUE6]]
1627
- ; DEFAULT: pred.store.continue6:
1628
- ; DEFAULT-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
1602
+ ; DEFAULT-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8
1629
1603
; DEFAULT-NEXT: [[VEC_IND_NEXT]] = add <4 x i64> [[VEC_IND]], splat (i64 4)
1630
- ; DEFAULT-NEXT: [[TMP11 :%.*]] = icmp eq i64 [[INDEX_NEXT]], 24
1631
- ; DEFAULT-NEXT: br i1 [[TMP11 ]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP28:![0-9]+]]
1604
+ ; DEFAULT-NEXT: [[TMP3 :%.*]] = icmp eq i64 [[INDEX_NEXT]], 16
1605
+ ; DEFAULT-NEXT: br i1 [[TMP3 ]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP28:![0-9]+]]
1632
1606
; DEFAULT: middle.block:
1633
- ; DEFAULT-NEXT: br i1 true , label [[EXIT:%.*]], label [[SCALAR_PH]]
1607
+ ; DEFAULT-NEXT: br i1 false , label [[EXIT:%.*]], label [[SCALAR_PH]]
1634
1608
; DEFAULT: scalar.ph:
1635
- ; DEFAULT-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 24 , [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
1609
+ ; DEFAULT-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 16 , [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
1636
1610
; DEFAULT-NEXT: br label [[LOOP_HEADER:%.*]]
1637
1611
; DEFAULT: loop.header:
1638
1612
; DEFAULT-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ]
@@ -1649,7 +1623,7 @@ define void @redundant_branch_and_tail_folding(ptr %dst, i1 %c) optsize {
1649
1623
; DEFAULT-NEXT: ret void
1650
1624
;
1651
1625
; PRED-LABEL: define void @redundant_branch_and_tail_folding(
1652
- ; PRED-SAME: ptr [[DST:%.*]], i1 [[C:%.*]]) #[[ATTR4:[0-9]+]] {
1626
+ ; PRED-SAME: ptr [[DST:%.*]], i1 [[C:%.*]]) {
1653
1627
; PRED-NEXT: entry:
1654
1628
; PRED-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
1655
1629
; PRED: vector.ph:
0 commit comments