From 9b9624de0cf90261504ac52d2a3114f703c10080 Mon Sep 17 00:00:00 2001 From: Michael Zolotukhin Date: Fri, 31 Oct 2014 22:28:03 +0000 Subject: [PATCH] Correctly update dom-tree after loop vectorizer. llvm-svn: 221009 --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 2 +- .../Transforms/LoopVectorize/incorrect-dom-info.ll | 142 +++++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Transforms/LoopVectorize/incorrect-dom-info.ll diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index a62c0f9..17e1172 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -3428,7 +3428,7 @@ void InnerLoopVectorizer::updateAnalysis() { DT->addNewBlock(LoopMiddleBlock, LoopBypassBlocks[1]); DT->addNewBlock(LoopScalarPreHeader, LoopBypassBlocks[0]); DT->changeImmediateDominator(LoopScalarBody, LoopScalarPreHeader); - DT->changeImmediateDominator(LoopExitBlock, LoopMiddleBlock); + DT->changeImmediateDominator(LoopExitBlock, LoopBypassBlocks[0]); DEBUG(DT->verifyDomTree()); } diff --git a/llvm/test/Transforms/LoopVectorize/incorrect-dom-info.ll b/llvm/test/Transforms/LoopVectorize/incorrect-dom-info.ll new file mode 100644 index 0000000..624ee7e --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/incorrect-dom-info.ll @@ -0,0 +1,142 @@ +; This test is based on one of benchmarks from SPEC2006. It exposes a bug with +; incorrect updating of the dom-tree. +; RUN: opt < %s -loop-vectorize -verify-dom-info +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" + +@PL_utf8skip = external constant [0 x i8] + +; Function Attrs: nounwind ssp uwtable +define void @Perl_pp_quotemeta() #0 { + %len = alloca i64, align 8 + br i1 undef, label %2, label %1 + +;