Skip to content

Commit 02a6074

Browse files
committed
Use used's element type if it's available.
1 parent 42ed775 commit 02a6074

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5501,8 +5501,9 @@ void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
55015501
// Save llvm.compiler.used and remove it.
55025502
SmallVector<Constant *, 2> UsedArray;
55035503
SmallVector<GlobalValue *, 4> UsedGlobals;
5504-
Type *UsedElementType = PointerType::getUnqual(M.getContext());
55055504
GlobalVariable *Used = collectUsedGlobalVariables(M, UsedGlobals, true);
5505+
Type *UsedElementType = Used ? Used->getValueType()->getArrayElementType()
5506+
: PointerType::getUnqual(M.getContext());
55065507
for (auto *GV : UsedGlobals) {
55075508
if (GV->getName() != "llvm.embedded.module" &&
55085509
GV->getName() != "llvm.cmdline")

0 commit comments

Comments
 (0)