From 417c1a3150e28e98f90e019677622a6a438e24d2 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Tue, 9 Jul 2013 21:38:08 +0000 Subject: [PATCH] Fix PR16571, which is a bug in the code that checks that all of the types in the bundle are uniform. llvm-svn: 185970 --- lib/Transforms/Vectorize/SLPVectorizer.cpp | 4 +++- test/Transforms/SLPVectorizer/X86/pr16571.ll | 22 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/Transforms/SLPVectorizer/X86/pr16571.ll diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 93ff1f7e5b5..af6a07b34fa 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -172,7 +172,7 @@ static unsigned getSameOpcode(ArrayRef VL) { static Type* getSameType(ArrayRef VL) { Type *Ty = VL[0]->getType(); for (int i = 1, e = VL.size(); i < e; i++) - if (VL[0]->getType() != Ty) + if (VL[i]->getType() != Ty) return 0; return Ty; @@ -389,6 +389,8 @@ private: void BoUpSLP::buildTree(ArrayRef Roots) { deleteTree(); + if (!getSameType(Roots)) + return; buildTree_rec(Roots, 0); } diff --git a/test/Transforms/SLPVectorizer/X86/pr16571.ll b/test/Transforms/SLPVectorizer/X86/pr16571.ll new file mode 100644 index 00000000000..13d82149c0c --- /dev/null +++ b/test/Transforms/SLPVectorizer/X86/pr16571.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -slp-vectorizer -S -mtriple=i686-pc-win32 -mcpu=corei7-avx + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32" +target triple = "i686-pc-win32" + +define hidden fastcc void @"System.PrimitiveTypesParser.TryParseIEEE754(char*,uint,double&)"() unnamed_addr { +"@0": + br i1 undef, label %"@38.lr.ph", label %"@37" + +"@37": ; preds = %"@38.lr.ph", %"@44", %"@0" + ret void + +"@44": ; preds = %"@38.lr.ph" + %0 = add i64 undef, undef + %1 = add i32 %mainPartDigits.loc.0.ph45, 1 + br i1 undef, label %"@38.lr.ph", label %"@37" + +"@38.lr.ph": ; preds = %"@44", %"@0" + %mainDoublePart.loc.0.ph46 = phi i64 [ %0, %"@44" ], [ 0, %"@0" ] + %mainPartDigits.loc.0.ph45 = phi i32 [ %1, %"@44" ], [ 0, %"@0" ] + br i1 undef, label %"@44", label %"@37" +}