[PATCH] D63138: [Analysis] add isSplatValue() for vectors in IR

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 11:43:04 PDT 2019


lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/VectorUtils.cpp:333
+    if (isa<UndefValue>(V))
+      return true;
+    // FIXME: Constant splat analysis does not allow undef elements.
----------------
nikic wrote:
> This seems potentially problematic, as there's no guarantee that all (independent) undef values will be chosen to be the same value down the line.
> 
> I don't know if this is a problem in the context where this is intended to be used though. Is isSplatValue() going to be used heuristically (for profitability) or is it necessary for transformation correctness?
This is correct and is in line with other cases like this.
`undef` here basically means "this can have any value, we don't care", the uses won't care about that lane.
We can define `undef` to have some value, so we could just fill the `undef` lines with the splat value, and this get back to the original situation of a splat vector.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63138/new/

https://reviews.llvm.org/D63138





More information about the llvm-commits mailing list