aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-03-23 15:19:29 +0100
committerNikita Popov <npopov@redhat.com>2022-03-23 15:39:39 +0100
commit40d7d2ed66c20ccdd1a5e5a4c76879ca0bb40918 (patch)
tree825caab3bd2be488c485d0279dd5575ff965f75c /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parentba365561455e467664df8c656f111b26fd1f81de (diff)
downloadllvm-40d7d2ed66c20ccdd1a5e5a4c76879ca0bb40918.zip
llvm-40d7d2ed66c20ccdd1a5e5a4c76879ca0bb40918.tar.gz
llvm-40d7d2ed66c20ccdd1a5e5a4c76879ca0bb40918.tar.bz2
[Bitcode] Check for live uses of llvm.cmdline/embedded.module
The one use check here is very misleading: At this point we should actually have no uses, because the only possible use in llvm.used was already dropped. But because the use in llvm.used is generally bitcasted, we end up still having one dead use here. What we actually want to check is that there are no live uses, for which a helper has recently been added.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 96f5666..d203fab 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4943,7 +4943,7 @@ void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
ConstantExpr::getPointerBitCastOrAddrSpaceCast(GV, UsedElementType));
if (llvm::GlobalVariable *Old =
M.getGlobalVariable("llvm.embedded.module", true)) {
- assert(Old->hasOneUse() &&
+ assert(Old->hasZeroLiveUses() &&
"llvm.embedded.module can only be used once in llvm.compiler.used");
GV->takeName(Old);
Old->eraseFromParent();
@@ -4966,7 +4966,7 @@ void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
UsedArray.push_back(
ConstantExpr::getPointerBitCastOrAddrSpaceCast(GV, UsedElementType));
if (llvm::GlobalVariable *Old = M.getGlobalVariable("llvm.cmdline", true)) {
- assert(Old->hasOneUse() &&
+ assert(Old->hasZeroLiveUses() &&
"llvm.cmdline can only be used once in llvm.compiler.used");
GV->takeName(Old);
Old->eraseFromParent();