mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 18:20:39 +00:00
add a simple fast-path for dead allocas
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32750 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -139,6 +139,13 @@ bool SROA::performScalarRepl(Function &F) {
|
|||||||
AllocationInst *AI = WorkList.back();
|
AllocationInst *AI = WorkList.back();
|
||||||
WorkList.pop_back();
|
WorkList.pop_back();
|
||||||
|
|
||||||
|
// Handle dead allocas trivially. These can be formed by SROA'ing arrays
|
||||||
|
// with unused elements.
|
||||||
|
if (AI->use_empty()) {
|
||||||
|
AI->eraseFromParent();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// If we can turn this aggregate value (potentially with casts) into a
|
// If we can turn this aggregate value (potentially with casts) into a
|
||||||
// simple scalar value that can be mem2reg'd into a register value.
|
// simple scalar value that can be mem2reg'd into a register value.
|
||||||
bool IsNotTrivial = false;
|
bool IsNotTrivial = false;
|
||||||
@@ -232,7 +239,7 @@ bool SROA::performScalarRepl(Function &F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, delete the Alloca instruction
|
// Finally, delete the Alloca instruction
|
||||||
AI->getParent()->getInstList().erase(AI);
|
AI->eraseFromParent();
|
||||||
NumReplaced++;
|
NumReplaced++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user