Index: src/IceCfg.cpp |
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
index a113b95d47948ddd03c1bbe7bd864c2aa3642bd5..1209d7ea0ca96b46e05ba7edafb58b74f3a1737b 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(); |
tlively
2016/06/25 02:09:37
This fixes the problem of the leftmost redzone bei
|
}); |
// Process the allocas in order of decreasing stack alignment. This allows |
// us to pack less-aligned pieces after more-aligned ones, resulting in less |
@@ -747,6 +747,8 @@ void Cfg::processAllocas(bool SortAndCombine) { |
bool HasDynamicAllocation = false; |
for (Inst &Instr : EntryNode->getInsts()) { |
if (auto *Alloca = llvm::dyn_cast<InstAlloca>(&Instr)) { |
+ if (Instr.isDeleted()) |
+ continue; |
uint32_t AlignmentParam = Alloca->getAlignInBytes(); |
if (AlignmentParam > StackAlignment) |
HasLargeAlignment = true; |
@@ -769,7 +771,7 @@ void Cfg::processAllocas(bool SortAndCombine) { |
if (Node == EntryNode) |
continue; |
for (Inst &Instr : Node->getInsts()) { |
- if (llvm::isa<InstAlloca>(&Instr)) { |
+ if (llvm::isa<InstAlloca>(&Instr) && !Instr.isDeleted()) { |
Jim Stichnoth
2016/06/25 17:14:13
Can you use the "standard" pattern here?
if (In
tlively
2016/06/27 17:03:57
Done.
|
// Allocations outside the entry block require a frame pointer. |
HasDynamicAllocation = true; |
break; |
@@ -792,7 +794,7 @@ void Cfg::processAllocas(bool SortAndCombine) { |
uint32_t MaxAlignment = StackAlignment; |
for (Inst &Instr : EntryNode->getInsts()) { |
Jim Stichnoth
2016/06/25 17:14:13
Same thing here, start the loop with a isDeleted()
tlively
2016/06/27 17:03:57
Done.
|
if (auto *Alloca = llvm::dyn_cast<InstAlloca>(&Instr)) { |
- if (!llvm::isa<Constant>(Alloca->getSizeInBytes())) |
+ if (!llvm::isa<Constant>(Alloca->getSizeInBytes()) || Alloca->isDeleted()) |
continue; |
uint32_t AlignmentParam = Alloca->getAlignInBytes(); |
// For default align=0, set it to the real value 1, to avoid any |