Changes in directory llvm/lib/Transforms/IPO:
GlobalOpt.cpp updated: 1.82 -> 1.83 --- Log message: Fix a bug in heap-sra that caused compilation failure of office-ispell. --- Diffs of the changes: (+19 -3) GlobalOpt.cpp | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.82 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.83 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.82 Sat Dec 30 23:48:39 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Tue Jan 9 17:29:37 2007 @@ -1016,9 +1016,25 @@ // loads, and all uses of those loads are simple. Rewrite them to use loads // of the per-field globals instead. while (!GV->use_empty()) { - LoadInst *LI = cast<LoadInst>(GV->use_back()); - RewriteUsesOfLoadForHeapSRoA(LI, FieldGlobals); - LI->eraseFromParent(); + if (LoadInst *LI = dyn_cast<LoadInst>(GV->use_back())) { + RewriteUsesOfLoadForHeapSRoA(LI, FieldGlobals); + LI->eraseFromParent(); + } else { + // Must be a store of null. + StoreInst *SI = cast<StoreInst>(GV->use_back()); + assert(isa<Constant>(SI->getOperand(0)) && + cast<Constant>(SI->getOperand(0))->isNullValue() && + "Unexpected heap-sra user!"); + + // Insert a store of null into each global. + for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { + Constant *Null = + Constant::getNullValue(FieldGlobals[i]->getType()->getElementType()); + new StoreInst(Null, FieldGlobals[i], SI); + } + // Erase the original store. + SI->eraseFromParent(); + } } // The old global is now dead, remove it. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits