[all-commits] [llvm/llvm-project] da3496: [llvm-c] Add LLVMGetAggregateElement() function

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jun 23 05:52:29 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: da34966a5a5fea47e3381707f26b3c24a6973569
      https://github.com/llvm/llvm-project/commit/da34966a5a5fea47e3381707f26b3c24a6973569
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-06-23 (Thu, 23 Jun 2022)

  Changed paths:
    M llvm/docs/ReleaseNotes.rst
    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] Add LLVMGetAggregateElement() function

This adds LLVMGetAggregateElement() as a wrapper for
Constant::getAggregateElement(), which allows fetching a
struct/array/vector element without handling different possible
underlying representations.

As the changed echo test shows, previously you for example had to
treat ConstantArray (use LLVMGetOperand) and ConstantDataArray
(use LLVMGetElementAsConstant) separately, not to mention all the
other possible representations (like PoisonValue).

I've deprecated LLVMGetElementAsConstant() in favor of the new
function, which is strictly more powerful (but I could be convinced
to drop the deprecation).

This is partly motivated by https://reviews.llvm.org/D125795,
which drops LLVMConstExtractValue() because the underlying constant
expression no longer exists. This function could previously be used
as a poor man's getAggregateElement().

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




More information about the All-commits mailing list