[all-commits] [llvm/llvm-project] c47656: [IRForTarget] Don't pass nullptr to GetElementPtrI...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 9 12:14:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c476566be5d025a3f122392af481a74f887911e6
      https://github.com/llvm/llvm-project/commit/c476566be5d025a3f122392af481a74f887911e6
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-07-09 (Fri, 09 Jul 2021)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

  Log Message:
  -----------
  [IRForTarget] Don't pass nullptr to GetElementPtrInst::Create() (NFC)

In one case use the source element type of the original GEP. In the
other the correct type isn't obvious to me, so use
getPointerElementType() for now.


  Commit: b00cff56cfb15cbfa74cb512c9cee1c402cce55b
      https://github.com/llvm/llvm-project/commit/b00cff56cfb15cbfa74cb512c9cee1c402cce55b
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-07-09 (Fri, 09 Jul 2021)

  Changed paths:
    M llvm/include/llvm/IR/Instructions.h

  Log Message:
  -----------
  Reapply [IR] Don't accept nullptr as GEP element type

Reapply after fixing another occurrence in lldb that was relying
on this in the preceding commit.

-----

GetElementPtrInst::Create() (and IRBuilder methods based on it)
currently accept nullptr as the element type, and will fetch the
element type from the pointer in that case. Remove this fallback,
as it is incompatible with opaque pointers. I've removed a handful
of leftover calls using this behavior as a preliminary step.

Out-of-tree code affected by this change should either pass a proper
type, or can temporarily explicitly call getPointerElementType(),
if the newly added assertion is encountered.

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


Compare: https://github.com/llvm/llvm-project/compare/0813bd1696dc...b00cff56cfb1


More information about the All-commits mailing list