forked from OSchip/llvm-project
[LICM] Add test for writeonly fn with noalias call.
Add an additional test for D123473.
This commit is contained in:
parent
fd14646043
commit
ce3bb82e45
|
@ -722,6 +722,48 @@ exit:
|
|||
ret void
|
||||
}
|
||||
|
||||
declare dereferenceable(8) noalias i8* @alloc_writeonly() writeonly
|
||||
|
||||
define void @test_sink_store_to_noalias_call_object_only_loop_may_not_execute1(i8 %n) writeonly {
|
||||
; CHECK: Function Attrs: writeonly
|
||||
; CHECK-LABEL: @test_sink_store_to_noalias_call_object_only_loop_may_not_execute1(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[A:%.*]] = call noalias dereferenceable(8) i8* @alloc_writeonly()
|
||||
; CHECK-NEXT: [[A_PROMOTED:%.*]] = load i8, i8* [[A]], align 1
|
||||
; CHECK-NEXT: br label [[LOOP_HEADER:%.*]]
|
||||
; CHECK: loop.header:
|
||||
; CHECK-NEXT: [[DIV1:%.*]] = phi i8 [ [[A_PROMOTED]], [[ENTRY:%.*]] ], [ [[DIV:%.*]], [[LOOP_LATCH:%.*]] ]
|
||||
; CHECK-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[ADD:%.*]], [[LOOP_LATCH]] ]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[I]], [[N:%.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_LATCH]], label [[EXIT:%.*]]
|
||||
; CHECK: loop.latch:
|
||||
; CHECK-NEXT: [[DIV]] = sdiv i8 [[I]], 3
|
||||
; CHECK-NEXT: [[ADD]] = add i8 [[I]], 4
|
||||
; CHECK-NEXT: br label [[LOOP_HEADER]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: [[DIV1_LCSSA:%.*]] = phi i8 [ [[DIV1]], [[LOOP_HEADER]] ]
|
||||
; CHECK-NEXT: store i8 [[DIV1_LCSSA]], i8* [[A]], align 1
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%a = call dereferenceable(8) noalias i8* @alloc_writeonly()
|
||||
br label %loop.header
|
||||
|
||||
loop.header:
|
||||
%i = phi i8 [ 0, %entry ], [ %add, %loop.latch ]
|
||||
%cmp = icmp ult i8 %i, %n
|
||||
br i1 %cmp, label %loop.latch, label %exit
|
||||
|
||||
loop.latch:
|
||||
%div = sdiv i8 %i, 3
|
||||
store i8 %div, i8* %a, align 1
|
||||
%add = add i8 %i, 4
|
||||
br label %loop.header
|
||||
|
||||
exit:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test_sink_store_only_no_phi_needed() writeonly {
|
||||
; CHECK: Function Attrs: writeonly
|
||||
; CHECK-LABEL: @test_sink_store_only_no_phi_needed(
|
||||
|
|
Loading…
Reference in New Issue