mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Fix a crash in SROA. This was reported independently by Takumi and
David (I think), but I would appreciate folks verifying that this fixes the big crasher. I'm still working on a reduced test case, but because this was causing problems I wanted to get the fix checked in quickly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164585 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
24ab21c691
commit
72bf29f45d
@ -202,11 +202,11 @@ public:
|
|||||||
use_iterator use_begin(const_iterator I) { return Uses[I - begin()].begin(); }
|
use_iterator use_begin(const_iterator I) { return Uses[I - begin()].begin(); }
|
||||||
use_iterator use_end(unsigned Idx) { return Uses[Idx].end(); }
|
use_iterator use_end(unsigned Idx) { return Uses[Idx].end(); }
|
||||||
use_iterator use_end(const_iterator I) { return Uses[I - begin()].end(); }
|
use_iterator use_end(const_iterator I) { return Uses[I - begin()].end(); }
|
||||||
void use_insert(unsigned Idx, use_iterator UI, const PartitionUse &U) {
|
void use_push_back(unsigned Idx, const PartitionUse &U) {
|
||||||
Uses[Idx].insert(UI, U);
|
Uses[Idx].push_back(U);
|
||||||
}
|
}
|
||||||
void use_insert(const_iterator I, use_iterator UI, const PartitionUse &U) {
|
void use_push_back(const_iterator I, const PartitionUse &U) {
|
||||||
Uses[I - begin()].insert(UI, U);
|
Uses[I - begin()].push_back(U);
|
||||||
}
|
}
|
||||||
void use_erase(unsigned Idx, use_iterator UI) { Uses[Idx].erase(UI); }
|
void use_erase(unsigned Idx, use_iterator UI) { Uses[Idx].erase(UI); }
|
||||||
void use_erase(const_iterator I, use_iterator UI) {
|
void use_erase(const_iterator I, use_iterator UI) {
|
||||||
@ -853,7 +853,7 @@ private:
|
|||||||
PartitionUse NewUse(std::max(I->BeginOffset, BeginOffset),
|
PartitionUse NewUse(std::max(I->BeginOffset, BeginOffset),
|
||||||
std::min(I->EndOffset, EndOffset),
|
std::min(I->EndOffset, EndOffset),
|
||||||
&User, cast<Instruction>(*U));
|
&User, cast<Instruction>(*U));
|
||||||
P.Uses[I - P.begin()].push_back(NewUse);
|
P.use_push_back(I, NewUse);
|
||||||
if (isa<PHINode>(U->getUser()) || isa<SelectInst>(U->getUser()))
|
if (isa<PHINode>(U->getUser()) || isa<SelectInst>(U->getUser()))
|
||||||
P.PHIOrSelectOpMap[std::make_pair(&User, U->get())]
|
P.PHIOrSelectOpMap[std::make_pair(&User, U->get())]
|
||||||
= std::make_pair(I - P.begin(), P.Uses[I - P.begin()].size() - 1);
|
= std::make_pair(I - P.begin(), P.Uses[I - P.begin()].size() - 1);
|
||||||
@ -1102,8 +1102,6 @@ AllocaPartitioning::AllocaPartitioning(const TargetData &TD, AllocaInst &AI)
|
|||||||
Uses.resize(Partitions.size());
|
Uses.resize(Partitions.size());
|
||||||
UseBuilder UB(TD, AI, *this);
|
UseBuilder UB(TD, AI, *this);
|
||||||
UB();
|
UB();
|
||||||
for (iterator I = Partitions.begin(), E = Partitions.end(); I != E; ++I)
|
|
||||||
std::stable_sort(use_begin(I), use_end(I));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Type *AllocaPartitioning::getCommonType(iterator I) const {
|
Type *AllocaPartitioning::getCommonType(iterator I) const {
|
||||||
@ -2460,8 +2458,7 @@ private:
|
|||||||
else {
|
else {
|
||||||
AllocaPartitioning::PartitionUse OtherUse = *UI;
|
AllocaPartitioning::PartitionUse OtherUse = *UI;
|
||||||
OtherUse.User = Load;
|
OtherUse.User = Load;
|
||||||
P.use_insert(PI, std::upper_bound(UI, P.use_end(PI), OtherUse),
|
P.use_push_back(PI, OtherUse);
|
||||||
OtherUse);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2559,7 +2556,7 @@ private:
|
|||||||
LoadInst *OtherLoad = IsTrueVal ? FL : TL;
|
LoadInst *OtherLoad = IsTrueVal ? FL : TL;
|
||||||
assert(OtherUse.Ptr == OtherLoad->getOperand(0));
|
assert(OtherUse.Ptr == OtherLoad->getOperand(0));
|
||||||
OtherUse.User = OtherLoad;
|
OtherUse.User = OtherLoad;
|
||||||
P.use_insert(PI, P.use_end(PI), OtherUse);
|
P.use_push_back(PI, OtherUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer alignment and TBAA info if present.
|
// Transfer alignment and TBAA info if present.
|
||||||
@ -2576,8 +2573,6 @@ private:
|
|||||||
LI->replaceAllUsesWith(V);
|
LI->replaceAllUsesWith(V);
|
||||||
Pass.DeadInsts.push_back(LI);
|
Pass.DeadInsts.push_back(LI);
|
||||||
}
|
}
|
||||||
if (PI != P.end())
|
|
||||||
std::stable_sort(P.use_begin(PI), P.use_end(PI));
|
|
||||||
|
|
||||||
deleteIfTriviallyDead(OldPtr);
|
deleteIfTriviallyDead(OldPtr);
|
||||||
return NewPtr == &NewAI;
|
return NewPtr == &NewAI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user