Skip to content

Commit 9e81466

Browse files
authored
[LAA] rewrite a test to make it more robust (#93197)
The test select-dependence.ll can be eliminated completely by dce, as it returns a constant, and doesn't write any arguments. Lift out the local allocas into arguments, so that it is less nonsensical. While at it, rename the variables for greater readability, and regenerate the test with UpdateTestChecks.
1 parent 96af54b commit 9e81466

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed
Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
12
; RUN: opt -passes='print<access-info>' -disable-output 2>&1 < %s | FileCheck %s
23

3-
; CHECK: Dependences:
4-
; CHECK-NEXT: Unknown:
5-
; CHECK-NEXT: %t63 = load double, ptr %t62, align 8 ->
6-
; CHECK-NEXT: store double %t63, ptr %t64, align 8
7-
8-
define i32 @test() {
9-
%a1 = alloca [128 x double], align 8
10-
%a2 = alloca [128 x double], align 8
11-
%a3 = alloca [128 x double], align 8
12-
%t30 = getelementptr double, ptr %a2, i64 -32
4+
define void @test(ptr noalias %x, ptr noalias %y, ptr noalias %z) {
5+
; CHECK-LABEL: 'test'
6+
; CHECK-NEXT: loop:
7+
; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
8+
; CHECK-NEXT: Unknown data dependence.
9+
; CHECK-NEXT: Dependences:
10+
; CHECK-NEXT: Unknown:
11+
; CHECK-NEXT: %load = load double, ptr %gep.sel, align 8 ->
12+
; CHECK-NEXT: store double %load, ptr %gep.sel2, align 8
13+
; CHECK-EMPTY:
14+
; CHECK-NEXT: Run-time memory checks:
15+
; CHECK-NEXT: Grouped accesses:
16+
; CHECK-EMPTY:
17+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
18+
; CHECK-NEXT: SCEV assumptions:
19+
; CHECK-EMPTY:
20+
; CHECK-NEXT: Expressions re-written:
21+
;
22+
entry:
23+
%gep.y = getelementptr double, ptr %y, i64 -32
1324
br label %loop
1425

1526
loop:
16-
%t58 = phi i64 [ %t65, %loop ], [ 0, %0 ]
17-
%t59 = icmp ule i64 %t58, 32
18-
%t60 = select i1 %t59, ptr %a1, ptr %t30
19-
%t62 = getelementptr inbounds double, ptr %t60, i64 %t58
20-
%t63 = load double, ptr %t62, align 8
21-
%t61 = select i1 %t59, ptr %a2, ptr %a3
22-
%t64 = getelementptr inbounds double, ptr %t61, i64 %t58
23-
store double %t63, ptr %t64, align 8
24-
%t65 = add nuw nsw i64 %t58, 1
25-
%t66 = icmp eq i64 %t65, 94
26-
br i1 %t66, label %exit, label %loop
27+
%iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
28+
%icmp = icmp ule i64 %iv, 32
29+
%sel = select i1 %icmp, ptr %x, ptr %gep.y
30+
%gep.sel = getelementptr inbounds double, ptr %sel, i64 %iv
31+
%load = load double, ptr %gep.sel, align 8
32+
%sel2 = select i1 %icmp, ptr %y, ptr %z
33+
%gep.sel2 = getelementptr inbounds double, ptr %sel2, i64 %iv
34+
store double %load, ptr %gep.sel2, align 8
35+
%iv.next = add nuw nsw i64 %iv, 1
36+
%exit.cond = icmp eq i64 %iv, 94
37+
br i1 %exit.cond, label %exit, label %loop
2738

2839
exit:
29-
ret i32 0
40+
ret void
3041
}

0 commit comments

Comments
 (0)