diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index d64c5d24fc8..c8b0ea8c992 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -788,33 +788,15 @@ bool DSE::handleEndBlock(BasicBlock &BB) { const DataLayout &DL = BB.getModule()->getDataLayout(); - // becomes false once lifetime intrinsics are observable or useful for stack - // coloring - bool canRemoveLifetimeIntrinsics = true; - // Scan the basic block backwards for (BasicBlock::iterator BBI = BB.end(); BBI != BB.begin(); ){ --BBI; - Value *V = nullptr; - if (canRemoveLifetimeIntrinsics) - if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(BBI)) - switch (II->getIntrinsicID()) { - default: break; - case Intrinsic::lifetime_start: - case Intrinsic::lifetime_end: - V = II->getArgOperand(1); - break; - } - - if (!V && hasMemoryWrite(BBI, *TLI) && isRemovable(BBI)) - V = getStoredPointerOperand(BBI); - - // If we found a store, check to see if it points into a dead stack value. - if (V) { + // If we find a store, check to see if it points into a dead stack value. + if (hasMemoryWrite(BBI, *TLI) && isRemovable(BBI)) { // See through pointer-to-pointer bitcasts SmallVector<Value *, 4> Pointers; - GetUnderlyingObjects(V, Pointers, DL); + GetUnderlyingObjects(getStoredPointerOperand(BBI), Pointers, DL); // Stores to stack values are valid candidates for removal. bool AllDead = true; @@ -862,15 +844,6 @@ bool DSE::handleEndBlock(BasicBlock &BB) { continue; } - if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(BBI)) - if (II->getIntrinsicID() == Intrinsic::lifetime_start) { - // We found a lifetime start for a live object, which we could not - // remove. So we must stop removing lifetime intrinsics from this block - // because they're useful for stack coloring again - canRemoveLifetimeIntrinsics = false; - continue; - } - if (auto CS = CallSite(BBI)) { // Remove allocation function calls from the list of dead stack objects; // there can't be any references before the definition. |