Michael Zolotukhin | 1816d03 | 2016-04-29 03:31:25 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -scev-aa -loop-vectorize -print-alias-sets -S -o - 2>&1 | FileCheck %s |
| 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 3 | target triple = "x86_64-unknown-linux-gnu" |
| 4 | |
| 5 | ; PR25281 |
| 6 | ; Just check that we don't crash on this test. |
| 7 | ; CHECK-LABEL: @foo |
| 8 | define void @foo(float** noalias nocapture readonly %in, i32* noalias nocapture readonly %isCompressed, float* noalias nocapture readonly %out) { |
| 9 | entry_block: |
| 10 | %tmp = getelementptr float*, float** %in, i32 0 |
| 11 | %in_0 = load float*, float** %tmp, !alias.scope !0 |
| 12 | %tmp1 = getelementptr i32, i32* %isCompressed, i32 0 |
| 13 | %isCompressed_0 = load i32, i32* %tmp1, !alias.scope !1 |
| 14 | %tmp2 = getelementptr float*, float** %in, i32 1 |
| 15 | %in_1 = load float*, float** %tmp2, !alias.scope !2 |
| 16 | %tmp3 = getelementptr i32, i32* %isCompressed, i32 1 |
| 17 | %isCompressed_1 = load i32, i32* %tmp3, !alias.scope !3 |
| 18 | br label %for_each_frames |
| 19 | |
| 20 | for_each_frames: |
| 21 | %frameIndex = phi i32 [ 0, %entry_block ], [ %nextFrameIndex, %for_each_frames_end ] |
| 22 | %nextFrameIndex = add nuw nsw i32 %frameIndex, 2 |
| 23 | br label %for_each_channel |
| 24 | |
| 25 | for_each_channel: |
| 26 | %channelIndex = phi i32 [ 0, %for_each_frames ], [ %nextChannelIndex, %for_each_channel ] |
| 27 | %nextChannelIndex = add nuw nsw i32 %channelIndex, 1 |
| 28 | %tmp4 = add i32 %frameIndex, %channelIndex |
| 29 | %tmp5 = xor i32 %isCompressed_0, 1 |
| 30 | %tmp6 = mul i32 %frameIndex, %tmp5 |
| 31 | %offset0 = add i32 %tmp6, %channelIndex |
| 32 | %tmp7 = getelementptr float, float* %in_0, i32 %offset0 |
| 33 | %in_0_index = load float, float* %tmp7, align 4, !alias.scope !4 |
| 34 | %tmp8 = xor i32 %isCompressed_1, 1 |
| 35 | %tmp9 = mul i32 %frameIndex, %tmp8 |
| 36 | %offset1 = add i32 %tmp9, %channelIndex |
| 37 | %tmp10 = getelementptr float, float* %in_1, i32 %offset1 |
| 38 | %in_1_index = load float, float* %tmp10, align 4, !alias.scope !5 |
| 39 | %tmp11 = fadd float %in_0_index, %in_1_index |
| 40 | %tmp12 = getelementptr float, float* %out, i32 %tmp4 |
| 41 | store float %tmp11, float* %tmp12, align 4, !alias.noalias !6 |
| 42 | %tmp13 = icmp eq i32 %nextChannelIndex, 2 |
| 43 | br i1 %tmp13, label %for_each_frames_end, label %for_each_channel |
| 44 | |
| 45 | for_each_frames_end: |
| 46 | %tmp14 = icmp eq i32 %nextFrameIndex, 512 |
| 47 | br i1 %tmp14, label %return, label %for_each_frames |
| 48 | |
| 49 | return: |
| 50 | ret void |
| 51 | } |
| 52 | |
| 53 | !0 = distinct !{!0} |
| 54 | !1 = distinct !{!1, !0} |
| 55 | !2 = distinct !{!2, !0} |
| 56 | !3 = distinct !{!3, !0} |
| 57 | !4 = distinct !{!4, !0} |
| 58 | !5 = distinct !{!5, !0} |
| 59 | !6 = !{!2, !3, !4, !5, !1} |