From 6be07401c1176c1f150100c0bb743ded6b9a21da Mon Sep 17 00:00:00 2001 From: Michael Zolotukhin Date: Fri, 29 Apr 2016 03:31:25 +0000 Subject: [PATCH] [PR25281] Remove AAResultsWrapper from preserved analyses of loop vectorizer. We don't preserve AAResults, because, for one, we don't preserve SCEV-AA. That fixes PR25281. llvm-svn: 267980 --- lib/Transforms/Vectorize/LoopVectorize.cpp | 1 - test/Transforms/LoopVectorize/pr25281.ll | 59 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 test/Transforms/LoopVectorize/pr25281.ll diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index c993d2a73c7..cd781cdc2eb 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2057,7 +2057,6 @@ struct LoopVectorize : public FunctionPass { AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); - AU.addPreserved(); AU.addPreserved(); } diff --git a/test/Transforms/LoopVectorize/pr25281.ll b/test/Transforms/LoopVectorize/pr25281.ll new file mode 100644 index 00000000000..6001a200c94 --- /dev/null +++ b/test/Transforms/LoopVectorize/pr25281.ll @@ -0,0 +1,59 @@ +; RUN: opt < %s -scev-aa -loop-vectorize -print-alias-sets -S -o - 2>&1 | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; PR25281 +; Just check that we don't crash on this test. +; CHECK-LABEL: @foo +define void @foo(float** noalias nocapture readonly %in, i32* noalias nocapture readonly %isCompressed, float* noalias nocapture readonly %out) { +entry_block: + %tmp = getelementptr float*, float** %in, i32 0 + %in_0 = load float*, float** %tmp, !alias.scope !0 + %tmp1 = getelementptr i32, i32* %isCompressed, i32 0 + %isCompressed_0 = load i32, i32* %tmp1, !alias.scope !1 + %tmp2 = getelementptr float*, float** %in, i32 1 + %in_1 = load float*, float** %tmp2, !alias.scope !2 + %tmp3 = getelementptr i32, i32* %isCompressed, i32 1 + %isCompressed_1 = load i32, i32* %tmp3, !alias.scope !3 + br label %for_each_frames + +for_each_frames: + %frameIndex = phi i32 [ 0, %entry_block ], [ %nextFrameIndex, %for_each_frames_end ] + %nextFrameIndex = add nuw nsw i32 %frameIndex, 2 + br label %for_each_channel + +for_each_channel: + %channelIndex = phi i32 [ 0, %for_each_frames ], [ %nextChannelIndex, %for_each_channel ] + %nextChannelIndex = add nuw nsw i32 %channelIndex, 1 + %tmp4 = add i32 %frameIndex, %channelIndex + %tmp5 = xor i32 %isCompressed_0, 1 + %tmp6 = mul i32 %frameIndex, %tmp5 + %offset0 = add i32 %tmp6, %channelIndex + %tmp7 = getelementptr float, float* %in_0, i32 %offset0 + %in_0_index = load float, float* %tmp7, align 4, !alias.scope !4 + %tmp8 = xor i32 %isCompressed_1, 1 + %tmp9 = mul i32 %frameIndex, %tmp8 + %offset1 = add i32 %tmp9, %channelIndex + %tmp10 = getelementptr float, float* %in_1, i32 %offset1 + %in_1_index = load float, float* %tmp10, align 4, !alias.scope !5 + %tmp11 = fadd float %in_0_index, %in_1_index + %tmp12 = getelementptr float, float* %out, i32 %tmp4 + store float %tmp11, float* %tmp12, align 4, !alias.noalias !6 + %tmp13 = icmp eq i32 %nextChannelIndex, 2 + br i1 %tmp13, label %for_each_frames_end, label %for_each_channel + +for_each_frames_end: + %tmp14 = icmp eq i32 %nextFrameIndex, 512 + br i1 %tmp14, label %return, label %for_each_frames + +return: + ret void +} + +!0 = distinct !{!0} +!1 = distinct !{!1, !0} +!2 = distinct !{!2, !0} +!3 = distinct !{!3, !0} +!4 = distinct !{!4, !0} +!5 = distinct !{!5, !0} +!6 = !{!2, !3, !4, !5, !1}