Michael Kruse | bc88a78 | 2017-08-01 20:01:34 +0000 | [diff] [blame] | 1 | ; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck %s -match-full-lines |
| 2 | ; |
| 3 | ; Remove redundant store (a store that writes the same value already |
| 4 | ; at the destination) in a region. |
| 5 | ; |
| 6 | define void @redundant_region_scalar(i32 %n, double* noalias nonnull %A) { |
| 7 | entry: |
| 8 | br label %for |
| 9 | |
| 10 | for: |
| 11 | %j = phi i32 [0, %entry], [%j.inc, %inc] |
| 12 | %j.cmp = icmp slt i32 %j, %n |
| 13 | br i1 %j.cmp, label %bodyA, label %exit |
| 14 | |
| 15 | |
| 16 | bodyA: |
| 17 | %val1 = load double, double* %A |
| 18 | br label %region_entry |
| 19 | |
| 20 | region_entry: |
| 21 | %val2 = load double, double* %A |
| 22 | %cmp = fcmp oeq double %val1, 0.0 |
| 23 | br i1 %cmp, label %region_true, label %region_exit |
| 24 | |
| 25 | region_true: |
| 26 | br label %region_exit |
| 27 | |
| 28 | region_exit: |
| 29 | br label %bodyB |
| 30 | |
| 31 | bodyB: |
| 32 | store double %val2, double* %A |
| 33 | br label %inc |
| 34 | |
| 35 | |
| 36 | inc: |
| 37 | %j.inc = add nuw nsw i32 %j, 1 |
| 38 | br label %for |
| 39 | |
| 40 | exit: |
| 41 | br label %return |
| 42 | |
| 43 | return: |
| 44 | ret void |
| 45 | } |
| 46 | |
| 47 | |
| 48 | ; CHECK: Statistics { |
| 49 | ; CHECK: Redundant writes removed: 3 |
| 50 | ; CHECK: } |
| 51 | |
| 52 | ; CHECK: After accesses { |
| 53 | ; CHECK-NEXT: } |