[all-commits] [llvm/llvm-project] 9e367b: C API: functions to get mask of a ShuffleVector

Robert Widmann via All-commits all-commits at lists.llvm.org
Mon Sep 28 03:39:29 PDT 2020


  Branch: refs/heads/release/11.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e367bd69b0d2523237e204b43301e59a5badb29
      https://github.com/llvm/llvm-project/commit/9e367bd69b0d2523237e204b43301e59a5badb29
  Author: Craig Disselkoen <craigdissel at gmail.com>
  Date:   2020-09-28 (Mon, 28 Sep 2020)

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

  Log Message:
  -----------
  C API: functions to get mask of a ShuffleVector

This commit fixes a regression (from LLVM 10 to LLVM 11 RC3) in the LLVM
C API.

Previously, commit 1ee6ec2bf 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.

Differential Revision: https://reviews.llvm.org/D88190

(cherry picked from commit 51cad041e0cb26597c7ccc0fbfaa349b8fffbcda)


  Commit: 293924973057e33fcc63521f582bb9fd41e60cc4
      https://github.com/llvm/llvm-project/commit/293924973057e33fcc63521f582bb9fd41e60cc4
  Author: Robert Widmann <devteam.codafi at gmail.com>
  Date:   2020-09-28 (Mon, 28 Sep 2020)

  Changed paths:
    M llvm/include/llvm-c/Core.h
    M llvm/lib/IR/Core.cpp
    M llvm/tools/llvm-c-test/echo.cpp

  Log Message:
  -----------
  [LLVM-C] Turn a ShuffleVector Constant Into a Getter.

It is not a good idea to expose raw constants in the LLVM C API. Replace this with an explicit getter.

Differential Revision: https://reviews.llvm.org/D88367

(cherry picked from commit 55f727306e727ea9f013d09c9b8aa70dbce6a1bd)


Compare: https://github.com/llvm/llvm-project/compare/1e4b179bf821...293924973057


More information about the All-commits mailing list