[llvm] [LLVM][IR] Add textual shorthand for specifying constant vector splats. (PR #74620)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 08:46:21 PST 2023


================
@@ -3981,6 +3981,33 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
     return false;
   }
 
+  case lltok::kw_splat: {
+    Lex.Lex();
+    if (parseToken(lltok::lparen, "expected '(' after vector splat"))
+      return true;
+    Constant *C;
+    if (parseGlobalTypeAndValue(C))
+      return true;
+    if (parseToken(lltok::rparen, "expected ')' at end of vector splat"))
+      return true;
+
+    if (auto *CI = dyn_cast<ConstantInt>(C)) {
----------------
paulwalker-arm wrote:

It turns out when extending the work to cover non-immediate values I inadvertently introduced a parsing bug so I don't think I can safely use `t_Constant`.  That said, this doesn't effect the core of your suggestion so I'll funnel all the splat cases down the same path, I'll just need to give it a new name.

https://github.com/llvm/llvm-project/pull/74620


More information about the llvm-commits mailing list