Skip to content

Commit

Permalink
Fix LoopUnroll/2011-08-09-PhiUpdate.ll test
Browse files Browse the repository at this point in the history
Use patterns for block names instead of fixed names.
Remove checks for dead function.
  • Loading branch information
clin111 authored and vmaksimo committed Nov 23, 2021
1 parent 3e35c44 commit 61e2db1
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions llvm/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
; update_test_checks.py will hardcode the block names.
; Used flexible names to align with the our version of the inliner.
; If this needs an update in the future, it should just be copied to a new file.

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s -instcombine -inline -jump-threading -loop-unroll -unroll-count=4 | FileCheck %s
;
Expand All @@ -18,22 +22,23 @@ define i32 @foo() uwtable ssp align 2 {
; CHECK-LABEL: @foo(
; CHECK-NEXT: if.end:
; CHECK-NEXT: [[CALL2:%.*]] = call i32 @getval()
; CHECK-NEXT: br label [[LAND_LHS_TRUE_I:%.*]]
; CHECK: land.lhs.true.i:
; CHECK-NEXT: br label %[[LAND_LHS_TRUE_I:.*]]
; CHECK: [[LAND_LHS_TRUE_I]]
; CHECK-NEXT: [[CMP4_I:%.*]] = call zeroext i1 @check() #[[ATTR0:[0-9]+]]
; CHECK-NEXT: br i1 [[CMP4_I]], label [[BAR_EXIT:%.*]], label [[DO_COND:%.*]]
; CHECK: bar.exit:
; CHECK-NEXT: [[TMP7_I:%.*]] = call i32 @getval() #[[ATTR0]]
; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[TMP7_I]], 0
; CHECK-NEXT: br i1 [[CMP_NOT]], label [[DO_COND]], label [[LAND_LHS_TRUE:%.*]]
; CHECK: land.lhs.true:

; CHECK-NEXT: br i1 [[CMP_NOT]], label [[DO_COND]], label %[[LAND_LHS_TRUE:.*]]
; CHECK: [[LAND_LHS_TRUE]]
; CHECK-NEXT: [[CALL10:%.*]] = call i32 @getval()
; CHECK-NEXT: [[CMP11:%.*]] = icmp eq i32 [[CALL10]], 0
; CHECK-NEXT: br i1 [[CMP11]], label [[RETURN:%.*]], label [[DO_COND]]
; CHECK: do.cond:
; CHECK-NEXT: [[CMP18:%.*]] = icmp sgt i32 [[CALL2]], -1
; CHECK-NEXT: br i1 [[CMP18]], label [[LAND_LHS_TRUE_I_1:%.*]], label [[RETURN]]
; CHECK: land.lhs.true.i.1:
; CHECK-NEXT: br i1 [[CMP18]], label %[[LAND_LHS_TRUE_I_1:.*]], label [[RETURN]]
; CHECK: [[LAND_LHS_TRUE_I_1]]
; CHECK-NEXT: [[CMP4_I_1:%.*]] = call zeroext i1 @check() #[[ATTR0]]
; CHECK-NEXT: br i1 [[CMP4_I_1]], label [[BAR_EXIT_1:%.*]], label [[DO_COND_1:%.*]]
; CHECK: bar.exit.1:
Expand All @@ -46,8 +51,8 @@ define i32 @foo() uwtable ssp align 2 {
; CHECK-NEXT: br i1 [[CMP11_1]], label [[RETURN]], label [[DO_COND_1]]
; CHECK: do.cond.1:
; CHECK-NEXT: [[CMP18_1:%.*]] = icmp sgt i32 [[CALL2]], -1
; CHECK-NEXT: br i1 [[CMP18_1]], label [[LAND_LHS_TRUE_I_2:%.*]], label [[RETURN]]
; CHECK: land.lhs.true.i.2:
; CHECK-NEXT: br i1 [[CMP18_1]], label %[[LAND_LHS_TRUE_I_2:.*]], label [[RETURN]]
; CHECK: [[LAND_LHS_TRUE_I_2]]
; CHECK-NEXT: [[CMP4_I_2:%.*]] = call zeroext i1 @check() #[[ATTR0]]
; CHECK-NEXT: br i1 [[CMP4_I_2]], label [[BAR_EXIT_2:%.*]], label [[DO_COND_2:%.*]]
; CHECK: bar.exit.2:
Expand All @@ -60,8 +65,8 @@ define i32 @foo() uwtable ssp align 2 {
; CHECK-NEXT: br i1 [[CMP11_2]], label [[RETURN]], label [[DO_COND_2]]
; CHECK: do.cond.2:
; CHECK-NEXT: [[CMP18_2:%.*]] = icmp sgt i32 [[CALL2]], -1
; CHECK-NEXT: br i1 [[CMP18_2]], label [[LAND_LHS_TRUE_I_3:%.*]], label [[RETURN]]
; CHECK: land.lhs.true.i.3:
; CHECK-NEXT: br i1 [[CMP18_2]], label %[[LAND_LHS_TRUE_I_3:.*]], label [[RETURN]]
; CHECK: [[LAND_LHS_TRUE_I_3]]
; CHECK-NEXT: [[CMP4_I_3:%.*]] = call zeroext i1 @check() #[[ATTR0]]
; CHECK-NEXT: br i1 [[CMP4_I_3]], label [[BAR_EXIT_3:%.*]], label [[DO_COND_3:%.*]]
; CHECK: bar.exit.3:
Expand All @@ -74,9 +79,9 @@ define i32 @foo() uwtable ssp align 2 {
; CHECK-NEXT: br i1 [[CMP11_3]], label [[RETURN]], label [[DO_COND_3]]
; CHECK: do.cond.3:
; CHECK-NEXT: [[CMP18_3:%.*]] = icmp sgt i32 [[CALL2]], -1
; CHECK-NEXT: br i1 [[CMP18_3]], label [[LAND_LHS_TRUE_I]], label [[RETURN]], !llvm.loop [[LOOP0:![0-9]+]]
; CHECK-NEXT: br i1 [[CMP18_3]], label %[[LAND_LHS_TRUE_I]], label [[RETURN]], !llvm.loop [[LOOP0:![0-9]+]]
; CHECK: return:
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[TMP7_I]], [[LAND_LHS_TRUE]] ], [ 0, [[DO_COND]] ], [ [[TMP7_I_1]], [[LAND_LHS_TRUE_1]] ], [ 0, [[DO_COND_1]] ], [ [[TMP7_I_2]], [[LAND_LHS_TRUE_2]] ], [ 0, [[DO_COND_2]] ], [ [[TMP7_I_3]], [[LAND_LHS_TRUE_3]] ], [ 0, [[DO_COND_3]] ]
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[TMP7_I]], %[[LAND_LHS_TRUE]] ], [ 0, [[DO_COND]] ], [ [[TMP7_I_1]], [[LAND_LHS_TRUE_1]] ], [ 0, [[DO_COND_1]] ], [ [[TMP7_I_2]], [[LAND_LHS_TRUE_2]] ], [ 0, [[DO_COND_2]] ], [ [[TMP7_I_3]], [[LAND_LHS_TRUE_3]] ], [ 0, [[DO_COND_3]] ]
; CHECK-NEXT: ret i32 [[RETVAL_0]]
;
entry:
Expand Down Expand Up @@ -106,18 +111,7 @@ return: ; preds = %do.cond, %land.lhs.
}

define linkonce_odr i32 @bar() nounwind uwtable ssp align 2 {
;
; CHECK-LABEL: @bar(
; CHECK-NEXT: land.lhs.true:
; CHECK-NEXT: [[CMP4:%.*]] = call zeroext i1 @check()
; CHECK-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_END:%.*]]
; CHECK: cond.true:
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @getval()
; CHECK-NEXT: br label [[COND_END]]
; CHECK: cond.end:
; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP7]], [[COND_TRUE]] ], [ 0, [[LAND_LHS_TRUE:%.*]] ]
; CHECK-NEXT: ret i32 [[COND]]
;
; This function is dead and should not be checked.
entry:
br i1 undef, label %land.lhs.true, label %cond.end

Expand Down

0 comments on commit 61e2db1

Please sign in to comment.