mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
[SROA] More range-based cleanups to SROA, these brought to you by
clang-modernize. I did have to clean up the variable types and whitespace a bit because the use of auto made the code much less readable here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5269b24da1
commit
c62c42b1e4
@ -854,17 +854,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateDebugInfo(Instruction *Inst) const override {
|
void updateDebugInfo(Instruction *Inst) const override {
|
||||||
for (SmallVectorImpl<DbgDeclareInst *>::const_iterator I = DDIs.begin(),
|
for (DbgDeclareInst *DDI : DDIs)
|
||||||
E = DDIs.end(); I != E; ++I) {
|
|
||||||
DbgDeclareInst *DDI = *I;
|
|
||||||
if (StoreInst *SI = dyn_cast<StoreInst>(Inst))
|
if (StoreInst *SI = dyn_cast<StoreInst>(Inst))
|
||||||
ConvertDebugDeclareToDebugValue(DDI, SI, DIB);
|
ConvertDebugDeclareToDebugValue(DDI, SI, DIB);
|
||||||
else if (LoadInst *LI = dyn_cast<LoadInst>(Inst))
|
else if (LoadInst *LI = dyn_cast<LoadInst>(Inst))
|
||||||
ConvertDebugDeclareToDebugValue(DDI, LI, DIB);
|
ConvertDebugDeclareToDebugValue(DDI, LI, DIB);
|
||||||
}
|
for (DbgValueInst *DVI : DVIs) {
|
||||||
for (SmallVectorImpl<DbgValueInst *>::const_iterator I = DVIs.begin(),
|
|
||||||
E = DVIs.end(); I != E; ++I) {
|
|
||||||
DbgValueInst *DVI = *I;
|
|
||||||
Value *Arg = nullptr;
|
Value *Arg = nullptr;
|
||||||
if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
|
if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
|
||||||
// If an argument is zero extended then use argument directly. The ZExt
|
// If an argument is zero extended then use argument directly. The ZExt
|
||||||
@ -3184,12 +3179,10 @@ bool SROA::rewritePartition(AllocaInst &AI, AllocaSlices &S,
|
|||||||
EndOffset, IsVectorPromotable,
|
EndOffset, IsVectorPromotable,
|
||||||
IsIntegerPromotable, PHIUsers, SelectUsers);
|
IsIntegerPromotable, PHIUsers, SelectUsers);
|
||||||
bool Promotable = true;
|
bool Promotable = true;
|
||||||
for (ArrayRef<AllocaSlices::iterator>::const_iterator SUI = SplitUses.begin(),
|
for (auto & SplitUse : SplitUses) {
|
||||||
SUE = SplitUses.end();
|
|
||||||
SUI != SUE; ++SUI) {
|
|
||||||
DEBUG(dbgs() << " rewriting split ");
|
DEBUG(dbgs() << " rewriting split ");
|
||||||
DEBUG(S.printSlice(dbgs(), *SUI, ""));
|
DEBUG(S.printSlice(dbgs(), SplitUse, ""));
|
||||||
Promotable &= Rewriter.visit(*SUI);
|
Promotable &= Rewriter.visit(SplitUse);
|
||||||
++NumUses;
|
++NumUses;
|
||||||
}
|
}
|
||||||
for (AllocaSlices::iterator I = B; I != E; ++I) {
|
for (AllocaSlices::iterator I = B; I != E; ++I) {
|
||||||
@ -3232,14 +3225,10 @@ bool SROA::rewritePartition(AllocaInst &AI, AllocaSlices &S,
|
|||||||
// If we have either PHIs or Selects to speculate, add them to those
|
// If we have either PHIs or Selects to speculate, add them to those
|
||||||
// worklists and re-queue the new alloca so that we promote in on the
|
// worklists and re-queue the new alloca so that we promote in on the
|
||||||
// next iteration.
|
// next iteration.
|
||||||
for (SmallPtrSetImpl<PHINode *>::iterator I = PHIUsers.begin(),
|
for (PHINode *PHIUser : PHIUsers)
|
||||||
E = PHIUsers.end();
|
SpeculatablePHIs.insert(PHIUser);
|
||||||
I != E; ++I)
|
for (SelectInst *SelectUser : SelectUsers)
|
||||||
SpeculatablePHIs.insert(*I);
|
SpeculatableSelects.insert(SelectUser);
|
||||||
for (SmallPtrSetImpl<SelectInst *>::iterator I = SelectUsers.begin(),
|
|
||||||
E = SelectUsers.end();
|
|
||||||
I != E; ++I)
|
|
||||||
SpeculatableSelects.insert(*I);
|
|
||||||
Worklist.insert(NewAI);
|
Worklist.insert(NewAI);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3277,11 +3266,9 @@ removeFinishedSplitUses(SmallVectorImpl<AllocaSlices::iterator> &SplitUses,
|
|||||||
|
|
||||||
// Recompute the max. While this is linear, so is remove_if.
|
// Recompute the max. While this is linear, so is remove_if.
|
||||||
MaxSplitUseEndOffset = 0;
|
MaxSplitUseEndOffset = 0;
|
||||||
for (SmallVectorImpl<AllocaSlices::iterator>::iterator
|
for (AllocaSlices::iterator SplitUse : SplitUses)
|
||||||
SUI = SplitUses.begin(),
|
MaxSplitUseEndOffset =
|
||||||
SUE = SplitUses.end();
|
std::max(SplitUse->endOffset(), MaxSplitUseEndOffset);
|
||||||
SUI != SUE; ++SUI)
|
|
||||||
MaxSplitUseEndOffset = std::max((*SUI)->endOffset(), MaxSplitUseEndOffset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Walks the slices of an alloca and form partitions based on them,
|
/// \brief Walks the slices of an alloca and form partitions based on them,
|
||||||
|
Loading…
Reference in New Issue
Block a user