diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-06-21 18:33:29 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-06-21 20:06:25 +0200 |
commit | d9fe96fe264e72c0a5c58cdd40b4efa14d18f475 (patch) | |
tree | 1c2b205310d3c2c19c851e9059c39fe48974ff42 /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | |
parent | 0c09e5bd74db90497a272e723213293981633a18 (diff) | |
download | llvm-d9fe96fe264e72c0a5c58cdd40b4efa14d18f475.zip llvm-d9fe96fe264e72c0a5c58cdd40b4efa14d18f475.tar.gz llvm-d9fe96fe264e72c0a5c58cdd40b4efa14d18f475.tar.bz2 |
[OpaquePtr] Support opaque constant expression GEP
Adjust assertions to use isOpaqueOrPointeeTypeMatches() and make
it return an opaque pointer result for an opaque base pointer. We
also need to enumerate the element type, as it is no longer
implicitly enumerated through the pointer type.
Differential Revision: https://reviews.llvm.org/D104655
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index abfdcd6..42d6abe 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -28,6 +28,7 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" +#include "llvm/IR/Operator.h" #include "llvm/IR/Type.h" #include "llvm/IR/Use.h" #include "llvm/IR/User.h" @@ -1006,9 +1007,12 @@ void ValueEnumerator::EnumerateOperandType(const Value *V) { EnumerateOperandType(Op); } - if (auto *CE = dyn_cast<ConstantExpr>(C)) + if (auto *CE = dyn_cast<ConstantExpr>(C)) { if (CE->getOpcode() == Instruction::ShuffleVector) EnumerateOperandType(CE->getShuffleMaskForBitcode()); + if (CE->getOpcode() == Instruction::GetElementPtr) + EnumerateType(cast<GEPOperator>(CE)->getSourceElementType()); + } } void ValueEnumerator::EnumerateAttributes(AttributeList PAL) { |