SLPVectorizer asserts in buildtree_rec
| 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;
Fix pushed from http://reviews.llvm.org/D20685
Similar problem in AA: https://llvm.org/bugs/show_bug.cgi?id=27418