[PATCH] D107254: [VectorUtils] Teach findScalarElement to return splat value.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 14:24:50 PDT 2021


spatel added inline comments.


================
Comment at: llvm/lib/Analysis/VectorUtils.cpp:329
+    if (Value *Splat = getSplatValue(V))
+      if (EltNo < VTy->getElementCount().getKnownMinValue())
+        return Splat;
----------------
sdesmalen wrote:
> @spatel, I wasn't entirely sure if similar arguments apply as mentioned here: https://reviews.llvm.org/D104867#2840537
Oops - missed this comment. If it's a splat, then do we care what EltNo is?

Ie, if we have this:
define i64 @ext_lane_from_splat(i64 %v) {
  %in = insertelement <vscale x 4 x i64> poison, i64 %v, i32 0
  %splat = shufflevector <vscale x 4 x i64> %in, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
  %r = extractelement <vscale x 4 x i64> %splat, i32 4 ; what does it mean if there are only 4 elts at runtime?
  ret i64 %r
}

Should it simplify to `ret i64 %v`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107254



More information about the llvm-commits mailing list