ConstantFolding: Don't crash when encountering vector GEP
authorKeno Fischer <kfischer@college.harvard.edu>
Thu, 8 Dec 2016 17:22:35 +0000 (17:22 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Thu, 8 Dec 2016 17:22:35 +0000 (17:22 +0000)
commitdc09119776454a9dabbe87150b3ca04140fb65fb
tree7335fa837abd99fdf122c623e57cde8892cee976
parent8cb6283e74aae927180a87836dba8dc75aa72253
ConstantFolding: Don't crash when encountering vector GEP

ConstantFolding tried to cast one of the scalar indices to a vector
type. Instead, use the vector type only for the first index (which
is the only one allowed to be a vector) and use its scalar type
otherwise.

Fixes PR31250.

Reviewers: majnemer
Differential Revision: https://reviews.llvm.org/D27389

llvm-svn: 289073
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll [new file with mode: 0644]