[PATCH] D88190: C API: functions to get mask of a ShuffleVector

Craig Disselkoen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 16:15:28 PDT 2020


cdisselkoen created this revision.
cdisselkoen added a reviewer: arsenm.
Herald added a reviewer: deadalnix.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
cdisselkoen requested review of this revision.
Herald added a subscriber: wdng.

Previously, commit 1ee6ec2bf <https://reviews.llvm.org/rG1ee6ec2bf370fbd1d93f34c8b56741a9d3f22ed2> removed the mask operand from the
ShuffleVector instruction, storing the mask data separately in the instruction
instead; this reduced the number of operands of ShuffleVector from 3 to 2.
AFAICT, this change unintentionally caused a regression in the LLVM C API.
Specifically, it is no longer possible to get the mask of a ShuffleVector
instruction through the C API.  This patch introduces new functions which
together allow a C API user to get the mask of a ShuffleVector instruction,
restoring the functionality which was previously available through
LLVMGetOperand().

This patch also adds tests for this change to the llvm-c-test executable, which
involved adding support for InsertElement, ExtractElement, and ShuffleVector
itself (as well as constant vectors) to echo.cpp.  Previously, vector
operations weren't tested at all in echo.ll.

I also fixed some typos in comments and help-text nearby these changes, which I
happened to spot while developing this patch.  Since the typo fixes are technically
unrelated other than being in the same files, I'm happy to take them out if
you'd rather they not be included in the patch.

I'm not sure who the appropriate reviewer / code owner is for this diff,
so I'm taking a guess and adding @arsenm since they reviewed D67132 <https://reviews.llvm.org/D67132> which
also touched the C API. If this is wrong, feel free to let me know.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88190

Files:
  llvm/include/llvm-c/Core.h
  llvm/lib/IR/Core.cpp
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/tools/llvm-c-test/echo.cpp
  llvm/tools/llvm-c-test/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88190.293890.patch
Type: text/x-patch
Size: 11121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200923/74d5e574/attachment.bin>


More information about the llvm-commits mailing list