[PATCH] D94142: [IR] Allow scalable vectors in structs to support intrinsics returning multiple values.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 13:28:35 PST 2021


sdesmalen added a comment.

This change should be mentioned in the LangRef as well, because that currently specifies:

> scalable vectors cannot be global variables or members of structs or arrays because their size is unknown at compile time.

Not allowing scalable-vectors in aggregates was one of the restrictions we had to accept in order to get the scalable vector type accepted, so I guess this also needs a ping to the mailing list? I tried to find a pointer to where this was previously discussed, but the closest I can find is this thread: https://groups.google.com/g/llvm-dev/c/TIEJ5-Y4jxU/m/TGHP_2CDBAAJ which mentions discussions @huntergr had at the dev meeting. From what I remember, there was concern that scalable vectors were already complicated and this restriction was a way to avoid issues around struct layout, alignment, offsets in structs with both scalable and non-scalable members, etc. If these types can't be allocated or use getelemenptr, some or most of that complexity probably falls away, so this limited relaxation seems quite elegant.



================
Comment at: llvm/test/Other/scalable-vector-struct-intrinsic.ll:6
+; values from intrinsics.
+
+declare { <vscale x 2 x i32>, <vscale x 2 x i1> } @llvm.sadd.with.overflow.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i32>)
----------------
I guess this patch allows:
  declare { <vscale x 2 x i32>, i32 } @foo()

Is that deliberate?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94142



More information about the llvm-commits mailing list