[Simplify] Remove unused instructions and accesses.
[polly-mirror.git] / test / Simplify / dead_access_load.ll
blob3febfa134cef8495de7c09c31e87737028d4f8be
1 ; RUN: opt %loadPolly -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
3 ; Remove a dead load-instruction
4 ; (an load whose result is not used anywhere)
6 ; for (int j = 0; j < n; j += 1) {
7 ;   double val = A[0];
8 ;   A[0] = 42.0;
9 ; }
11 define void @func(i32 %n, double* noalias nonnull %A) {
12 entry:
13   br label %for
15 for:
16   %j = phi i32 [0, %entry], [%j.inc, %inc]
17   %j.cmp = icmp slt i32 %j, %n
18   br i1 %j.cmp, label %body, label %exit
20     body:
21       %val = load double, double* %A
22       store double 42.0, double* %A
23       br label %inc
25 inc:
26   %j.inc = add nuw nsw i32 %j, 1
27   br label %for
29 exit:
30   br label %return
32 return:
33   ret void
37 ; CHECK: Statistics {
38 ; CHECK:     Dead accesses removed: 1
39 ; CHECK:     Dead instructions removed: 1
40 ; CHECK: }
42 ; CHECK:      After accesses {
43 ; CHECK-NEXT:     Stmt_body
44 ; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
45 ; CHECK-NEXT:                 [n] -> { Stmt_body[i0] -> MemRef_A[0] };
46 ; CHECK-NEXT: }