From 9ba0aa2da00a44e41a451aff0e9fc22c584a9203 Mon Sep 17 00:00:00 2001 From: Roman Shirokiy Date: Fri, 8 Jun 2018 08:21:20 +0000 Subject: [LV] Fix PR36983. For a given recurrence, fix all phis in exit block There could be more than one PHIs in exit block using same loop recurrence. Don't assume there is only one and fix each user. Differential Revision: https://reviews.llvm.org/D47788 llvm-svn: 334271 --- llvm/test/Transforms/LoopVectorize/pr36983.ll | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 llvm/test/Transforms/LoopVectorize/pr36983.ll (limited to 'llvm/test/Transforms/LoopVectorize') diff --git a/llvm/test/Transforms/LoopVectorize/pr36983.ll b/llvm/test/Transforms/LoopVectorize/pr36983.ll new file mode 100644 index 00000000000..71b17192255 --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/pr36983.ll @@ -0,0 +1,24 @@ +; RUN: opt < %s -loop-vectorize -S | FileCheck %s + +; There could be more than one LCSSA PHIs in loop exit block. + +; CHECK-LABEL: bb1.bb3_crit_edge: +; CHECK: %_tmp133.lcssa1 = phi i16 [ %scalar.recur, %bb2 ], [ %vector.recur.extract.for.phi, %middle.block ] +; CHECK: %_tmp133.lcssa = phi i16 [ %scalar.recur, %bb2 ], [ %vector.recur.extract.for.phi, %middle.block ] + +define void @f1() { +bb2.lr.ph: + br label %bb2 + +bb2: ; preds = %bb2, %bb2.lr.ph + %_tmp132 = phi i16 [ 0, %bb2.lr.ph ], [ %_tmp10, %bb2 ] + %_tmp133 = phi i16 [ undef, %bb2.lr.ph ], [ %_tmp10, %bb2 ] + %_tmp10 = sub nsw i16 %_tmp132, 1 + %_tmp15 = icmp ne i16 %_tmp10, 0 + br i1 %_tmp15, label %bb2, label %bb1.bb3_crit_edge + +bb1.bb3_crit_edge: ; preds = %bb2 + %_tmp133.lcssa1 = phi i16 [ %_tmp133, %bb2 ] + %_tmp133.lcssa = phi i16 [ %_tmp133, %bb2 ] + ret void +} -- cgit v1.2.3