Bryant Wong | 7cb7446 | 2016-12-27 17:58:12 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | ; RUN: opt -basicaa -scoped-noalias -memcpyopt -S %s | FileCheck %s |
| 3 | |
| 4 | %T = type { i8, i32 } |
| 5 | |
| 6 | ; memcpy(%d, %a) should not be generated since store2 may-aliases load %a. |
| 7 | define void @f(%T* %a, %T* %b, %T* %c, %T* %d) { |
| 8 | ; CHECK-LABEL: @f( |
| 9 | ; CHECK-NEXT: [[VAL:%.*]] = load %T, %T* %a, !alias.scope !0 |
| 10 | ; CHECK-NEXT: store %T { i8 23, i32 23 }, %T* %b, !alias.scope !3 |
| 11 | ; CHECK-NEXT: store %T { i8 44, i32 44 }, %T* %c, !alias.scope !6, !noalias !3 |
| 12 | ; CHECK-NEXT: store %T [[VAL]], %T* %d, !alias.scope !9, !noalias !12 |
| 13 | ; CHECK-NEXT: ret void |
| 14 | ; |
| 15 | %val = load %T, %T* %a, !alias.scope !{!10} |
| 16 | |
| 17 | ; store1 may-aliases the load |
| 18 | store %T { i8 23, i32 23 }, %T* %b, !alias.scope !{!11} |
| 19 | |
| 20 | ; store2 may-aliases the load and store3 |
| 21 | store %T { i8 44, i32 44 }, %T* %c, !alias.scope !{!12}, !noalias !{!11} |
| 22 | |
| 23 | ; store3 |
| 24 | store %T %val, %T* %d, !alias.scope !{!13}, !noalias !{!10, !11} |
| 25 | ret void |
| 26 | } |
| 27 | |
| 28 | !0 = !{!0} |
| 29 | !1 = !{!1} |
| 30 | !2 = !{!2} |
| 31 | !3 = !{!3} |
| 32 | |
| 33 | !10 = !{ !10, !0 } |
| 34 | !11 = !{ !11, !1 } |
| 35 | !12 = !{ !12, !2 } |
| 36 | !13 = !{ !13, !3 } |