aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-03-11 16:36:56 +0100
committerNikita Popov <npopov@redhat.com>2022-03-11 16:38:58 +0100
commitb7585a08d5dfcc5bb85f00632f7cf8f2924036d8 (patch)
treecc225d99f77d4b1957c8584e1f24a5aa137d29e2 /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
parent60cb83d549a78301678bb7ddbfe95601b2f9694b (diff)
downloadllvm-b7585a08d5dfcc5bb85f00632f7cf8f2924036d8.zip
llvm-b7585a08d5dfcc5bb85f00632f7cf8f2924036d8.tar.gz
llvm-b7585a08d5dfcc5bb85f00632f7cf8f2924036d8.tar.bz2
[Bitcode] Enumerate constexpr GEP source element type in initializer
The constexpr source element type was enumerated if the GEP was used as part of an instruction. However, things like global initializers go through a different code path, and we need to enumerate the type there as well.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 01f7e85..18157d5 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -939,9 +939,12 @@ void ValueEnumerator::EnumerateValue(const Value *V) {
I != E; ++I)
if (!isa<BasicBlock>(*I)) // Don't enumerate BB operand to BlockAddress.
EnumerateValue(*I);
- if (auto *CE = dyn_cast<ConstantExpr>(C))
+ if (auto *CE = dyn_cast<ConstantExpr>(C)) {
if (CE->getOpcode() == Instruction::ShuffleVector)
EnumerateValue(CE->getShuffleMaskForBitcode());
+ if (auto *GEP = dyn_cast<GEPOperator>(CE))
+ EnumerateType(GEP->getSourceElementType());
+ }
// Finally, add the value. Doing this could make the ValueID reference be
// dangling, don't reuse it.