[Analysis] add optional index parameter to isSplatValue()
authorSanjay Patel <spatel@rotateright.com>
Sun, 2 Feb 2020 14:16:42 +0000 (09:16 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sun, 2 Feb 2020 15:52:00 +0000 (10:52 -0500)
commit9b9e2da07dd3b103e5a41a3519d839117d994ffa
tree2343bb800c6e75fa165626f4b651084eb7052ba2
parenta9ab01a330f4c7c316fa87c8446888c73dae5536
[Analysis] add optional index parameter to isSplatValue()

We want to allow splat value transforms to improve PR44588 and related bugs:
https://bugs.llvm.org/show_bug.cgi?id=44588
...but to do that, we need to know if values are splatted from the same,
specific index (lane) rather than splatted from an arbitrary index.

We can improve the undef handling with 1-liner follow-ups because the
Constant API optionally allow undefs now.

Differential Revision: https://reviews.llvm.org/D73549
llvm/include/llvm/Analysis/VectorUtils.h
llvm/lib/Analysis/VectorUtils.cpp
llvm/unittests/Analysis/VectorUtilsTest.cpp