mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Consider ConstantAggregateZero as well as ConstantArray/Struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129338 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bbfc3b3098
commit
ceb465a8a4
@ -110,7 +110,7 @@ void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
|
||||
GlobalValue *CounterArray, bool beginning) {
|
||||
// Insert the increment after any alloca or PHI instructions...
|
||||
BasicBlock::iterator InsertPos = beginning ? BB->getFirstNonPHI() :
|
||||
BB->getTerminator();
|
||||
BB->getTerminator();
|
||||
while (isa<AllocaInst>(InsertPos))
|
||||
++InsertPos;
|
||||
|
||||
@ -151,10 +151,12 @@ void llvm::InsertProfilingShutdownCall(Function *Callee, Module *Mod) {
|
||||
// delete it, to replace it with one that has a larger array type.
|
||||
std::vector<Constant *> dtors;
|
||||
if (GlobalVariable *GlobalDtors = Mod->getNamedGlobal("llvm.global_dtors")) {
|
||||
ConstantArray *InitList =
|
||||
cast<ConstantArray>(GlobalDtors->getInitializer());
|
||||
for (unsigned i = 0, e = InitList->getType()->getNumElements(); i != e; ++i)
|
||||
dtors.push_back(cast<Constant>(InitList->getOperand(i)));
|
||||
if (ConstantArray *InitList =
|
||||
dyn_cast<ConstantArray>(GlobalDtors->getInitializer())) {
|
||||
for (unsigned i = 0, e = InitList->getType()->getNumElements();
|
||||
i != e; ++i)
|
||||
dtors.push_back(cast<Constant>(InitList->getOperand(i)));
|
||||
}
|
||||
GlobalDtors->eraseFromParent();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user