mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
SLP Vectorizer: Erase instructions outside the vectorizeTree method.
The RAII builder location guard is saving a reference to instructions, so we can't erase instructions during vectorization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184671 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -848,6 +848,12 @@ bool FuncSLP::vectorizeStoreChain(ArrayRef<Value *> Chain, int CostThreshold) {
|
|||||||
if (Cost < CostThreshold) {
|
if (Cost < CostThreshold) {
|
||||||
DEBUG(dbgs() << "SLP: Decided to vectorize cost=" << Cost << "\n");
|
DEBUG(dbgs() << "SLP: Decided to vectorize cost=" << Cost << "\n");
|
||||||
vectorizeTree(Operands);
|
vectorizeTree(Operands);
|
||||||
|
|
||||||
|
// Remove the scalar stores.
|
||||||
|
for (int i = 0, e = VF; i < e; ++i)
|
||||||
|
cast<Instruction>(Operands[i])->eraseFromParent();
|
||||||
|
|
||||||
|
// Move to the next bundle.
|
||||||
i += VF - 1;
|
i += VF - 1;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
@@ -865,6 +871,11 @@ bool FuncSLP::vectorizeStoreChain(ArrayRef<Value *> Chain, int CostThreshold) {
|
|||||||
DEBUG(dbgs() << "SLP: Found store chain cost = " << Cost
|
DEBUG(dbgs() << "SLP: Found store chain cost = " << Cost
|
||||||
<< " for size = " << ChainLen << "\n");
|
<< " for size = " << ChainLen << "\n");
|
||||||
vectorizeTree(Chain);
|
vectorizeTree(Chain);
|
||||||
|
|
||||||
|
// Remove all of the scalar stores.
|
||||||
|
for (int i = 0, e = Chain.size(); i < e; ++i)
|
||||||
|
cast<Instruction>(Chain[i])->eraseFromParent();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1100,9 +1111,6 @@ Value *FuncSLP::vectorizeTree_rec(ArrayRef<Value *> VL) {
|
|||||||
Value *VecPtr =
|
Value *VecPtr =
|
||||||
Builder.CreateBitCast(SI->getPointerOperand(), VecTy->getPointerTo());
|
Builder.CreateBitCast(SI->getPointerOperand(), VecTy->getPointerTo());
|
||||||
Builder.CreateStore(VecValue, VecPtr)->setAlignment(Alignment);
|
Builder.CreateStore(VecValue, VecPtr)->setAlignment(Alignment);
|
||||||
|
|
||||||
for (int i = 0, e = VL.size(); i < e; ++i)
|
|
||||||
cast<Instruction>(VL[i])->eraseFromParent();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user