[NFC][GVN] Improve loadpre-missed-opportunity.ll test again thanks to @fhahn

This commit is contained in:
Roman Lebedev 2020-07-24 20:31:35 +03:00
parent 805e6bcf22
commit 3319d05630
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 47 additions and 30 deletions

View File

@ -1,25 +1,33 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -gvn -S | FileCheck %s ; RUN: opt < %s -gvn -S | FileCheck %s
define void @loadpre_opportunity(i32** %arg, i1 %arg1, i1 %arg2, i1 %arg3) { define i32 @loadpre_opportunity(i32** %arg, i1 %arg1, i1 %arg2, i1 %arg3) {
; CHECK-LABEL: @loadpre_opportunity( ; CHECK-LABEL: @loadpre_opportunity(
; CHECK-NEXT: bb: ; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB9:%.*]] ; CHECK-NEXT: [[I:%.*]] = load i32*, i32** [[ARG:%.*]], align 8
; CHECK: bb6: ; CHECK-NEXT: [[I6:%.*]] = call i32 @use(i32* [[I]])
; CHECK-NEXT: br label [[BB9]] ; CHECK-NEXT: br label [[BB11:%.*]]
; CHECK: bb9: ; CHECK: bb7:
; CHECK-NEXT: br i1 [[ARG1:%.*]], label [[BB6:%.*]], label [[BB10:%.*]] ; CHECK-NEXT: [[I8:%.*]] = load i32*, i32** [[ARG]], align 8
; CHECK: bb10: ; CHECK-NEXT: [[I10:%.*]] = call i32 @use(i32* [[I8]])
; CHECK-NEXT: call void @somecall() ; CHECK-NEXT: br label [[BB11]]
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB12:%.*]], label [[BB15:%.*]] ; CHECK: bb11:
; CHECK: bb12: ; CHECK-NEXT: [[I12:%.*]] = phi i32 [ [[I6]], [[BB:%.*]] ], [ [[I10]], [[BB7:%.*]] ]
; CHECK-NEXT: br label [[BB13:%.*]] ; CHECK-NEXT: br i1 [[ARG1:%.*]], label [[BB7]], label [[BB13:%.*]]
; CHECK: bb13: ; CHECK: bb13:
; CHECK-NEXT: br i1 [[ARG3:%.*]], label [[BB14:%.*]], label [[BB13]] ; CHECK-NEXT: call void @somecall()
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB14:%.*]], label [[BB17:%.*]]
; CHECK: bb14: ; CHECK: bb14:
; CHECK-NEXT: br label [[BB15]] ; CHECK-NEXT: br label [[BB15:%.*]]
; CHECK: bb15: ; CHECK: bb15:
; CHECK-NEXT: br label [[BB6]] ; CHECK-NEXT: br i1 [[ARG3:%.*]], label [[BB16:%.*]], label [[BB15]]
; CHECK: bb16:
; CHECK-NEXT: br label [[BB17]]
; CHECK: bb17:
; CHECK-NEXT: [[I18:%.*]] = call i1 @cond()
; CHECK-NEXT: br i1 [[I18]], label [[BB7]], label [[BB19:%.*]]
; CHECK: bb19:
; CHECK-NEXT: ret i32 [[I12]]
; ;
bb: bb:
%i = load i32*, i32** %arg, align 8 %i = load i32*, i32** %arg, align 8
@ -27,31 +35,40 @@ bb:
br label %bb5 br label %bb5
bb5: bb5:
br label %bb9 %i6 = call i32 @use(i32* %i4)
br label %bb11
bb6: bb7:
%i7 = load i32*, i32** %arg, align 8 %i8 = load i32*, i32** %arg, align 8
%i8 = getelementptr inbounds i32, i32* %i7, i64 0 %i9 = getelementptr inbounds i32, i32* %i8, i64 0
br label %bb9 %i10 = call i32 @use(i32* %i9)
br label %bb11
bb9: bb11:
br i1 %arg1, label %bb6, label %bb10 %i12 = phi i32 [ %i6, %bb5 ], [ %i10, %bb7 ]
br i1 %arg1, label %bb7, label %bb13
bb10:
call void @somecall()
br i1 %arg2, label %bb12, label %bb15
bb12:
br label %bb13
bb13: bb13:
br i1 %arg3, label %bb14, label %bb13 call void @somecall()
br i1 %arg2, label %bb14, label %bb17
bb14: bb14:
br label %bb15 br label %bb15
bb15: bb15:
br label %bb6 br i1 %arg3, label %bb16, label %bb15
bb16:
br label %bb17
bb17:
%i18 = call i1 @cond()
br i1 %i18, label %bb7, label %bb19
bb19:
ret i32 %i12
} }
declare void @somecall() declare void @somecall()
declare i32 @use(i32*) readnone
declare i1 @cond() readnone