llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

SLPVectorizer asserts in buildtree_rec

Open uabjean opened this issue 10 years ago • 2 comments

Bugzilla Link 27617
Resolution FIXED
Resolved on Jun 09, 2016 04:43
Version trunk
OS Linux
Attachments minimal llvm assembly language file that triggers the assert
CC @hfinkel,@mikaelholmen

Extended Description

For the attached ll code example and the invocation: ./build-all/bin/opt -S -mcpu=x86-64 -mtriple=x86_64-linux -indvars -slp-vectorizer -O1 -o /dev/null foo.opt.ll

I get this assert: opt: ../lib/Transforms/Vectorize/SLPVectorizer.cpp:1005: void (anonymous namespace)::BoUpSLP::buildTree_rec(ArrayRef<llvm::Value *>, unsigned int): Assertion `SameTy && "Invalid types!"' failed.

The problem is that two getelementpointer indicies have differing types. Both have the value 4, but one is of i16 type and one is i64. The recursive call to gather those values fails with an assert because the types differ.

The simplest fix might be to change the assert to allow this. Something like this:

  • bool SameTy = getSameType(VL); (void)SameTy;
  • bool SameTy = allConstant(VL) || getSameType(VL); (void)SameTy;

uabjean avatar May 03 '16 15:05 uabjean

Fix pushed from http://reviews.llvm.org/D20685

uabjean avatar Jun 09 '16 11:06 uabjean

Similar problem in AA: https://llvm.org/bugs/show_bug.cgi?id=27418

mikaelholmen avatar May 10 '16 15:05 mikaelholmen