Index: src/IceCfg.cpp |
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
index a113b95d47948ddd03c1bbe7bd864c2aa3642bd5..3df85697c9e89d98eed7de99e0b10531bfb40e3d 100644 |
--- a/src/IceCfg.cpp |
+++ b/src/IceCfg.cpp |
@@ -654,7 +654,7 @@ void Cfg::sortAndCombineAllocas(CfgVector<Inst *> &Allocas, |
std::sort(Allocas.begin(), Allocas.end(), [](Inst *I1, Inst *I2) { |
auto *A1 = llvm::dyn_cast<InstAlloca>(I1); |
auto *A2 = llvm::dyn_cast<InstAlloca>(I2); |
- return A1->getAlignInBytes() > A2->getAlignInBytes(); |
+ return A1->getAlignInBytes() >= A2->getAlignInBytes(); |
}); |
// Process the allocas in order of decreasing stack alignment. This allows |
// us to pack less-aligned pieces after more-aligned ones, resulting in less |
@@ -746,6 +746,8 @@ void Cfg::processAllocas(bool SortAndCombine) { |
bool HasLargeAlignment = false; |
bool HasDynamicAllocation = false; |
for (Inst &Instr : EntryNode->getInsts()) { |
+ if (Instr.isDeleted()) |
+ continue; |
if (auto *Alloca = llvm::dyn_cast<InstAlloca>(&Instr)) { |
uint32_t AlignmentParam = Alloca->getAlignInBytes(); |
if (AlignmentParam > StackAlignment) |
@@ -769,6 +771,8 @@ void Cfg::processAllocas(bool SortAndCombine) { |
if (Node == EntryNode) |
continue; |
for (Inst &Instr : Node->getInsts()) { |
+ if (Instr.isDeleted()) |
+ continue; |
if (llvm::isa<InstAlloca>(&Instr)) { |
// Allocations outside the entry block require a frame pointer. |
HasDynamicAllocation = true; |
@@ -791,6 +795,8 @@ void Cfg::processAllocas(bool SortAndCombine) { |
// Maximum alignment used by any alloca. |
uint32_t MaxAlignment = StackAlignment; |
for (Inst &Instr : EntryNode->getInsts()) { |
+ if (Instr.isDeleted()) |
+ continue; |
if (auto *Alloca = llvm::dyn_cast<InstAlloca>(&Instr)) { |
if (!llvm::isa<Constant>(Alloca->getSizeInBytes())) |
continue; |