mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-21 12:38:45 +00:00
Change LoadAndStorePromoter to take ArrayRef instead of SmallVectorImpl&.
The array passed to LoadAndStorePromoter's constructor was a constant reference to a SmallVectorImpl, which is just the same as passing an ArrayRef. Also, the data in the array can be 'const Instruction*' instead of 'Instruction*'. Its not possible to convert a SmallVectorImpl<T*> to SmallVectorImpl<const T*>, but ArrayRef does provide such a method. Currently this added calls to makeArrayRef which should be a nop, but i'm going to kick off a discussion about improving ArrayRef to not need these. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237226 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a0706f51ce
commit
19a19a9ad1
@ -14,6 +14,7 @@
|
|||||||
#ifndef LLVM_TRANSFORMS_UTILS_SSAUPDATER_H
|
#ifndef LLVM_TRANSFORMS_UTILS_SSAUPDATER_H
|
||||||
#define LLVM_TRANSFORMS_UTILS_SSAUPDATER_H
|
#define LLVM_TRANSFORMS_UTILS_SSAUPDATER_H
|
||||||
|
|
||||||
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ protected:
|
|||||||
SSAUpdater &SSA;
|
SSAUpdater &SSA;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LoadAndStorePromoter(const SmallVectorImpl<Instruction*> &Insts,
|
LoadAndStorePromoter(ArrayRef<const Instruction*> Insts,
|
||||||
SSAUpdater &S, StringRef Name = StringRef());
|
SSAUpdater &S, StringRef Name = StringRef());
|
||||||
virtual ~LoadAndStorePromoter() {}
|
virtual ~LoadAndStorePromoter() {}
|
||||||
|
|
||||||
|
@ -714,7 +714,8 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LoopPromoter(Value *SP, const SmallVectorImpl<Instruction *> &Insts,
|
LoopPromoter(Value *SP,
|
||||||
|
ArrayRef<const Instruction *> Insts,
|
||||||
SSAUpdater &S, SmallPtrSetImpl<Value *> &PMA,
|
SSAUpdater &S, SmallPtrSetImpl<Value *> &PMA,
|
||||||
SmallVectorImpl<BasicBlock *> &LEB,
|
SmallVectorImpl<BasicBlock *> &LEB,
|
||||||
SmallVectorImpl<Instruction *> &LIP, PredIteratorCache &PIC,
|
SmallVectorImpl<Instruction *> &LIP, PredIteratorCache &PIC,
|
||||||
@ -920,7 +921,8 @@ bool llvm::promoteLoopAccessesToScalars(AliasSet &AS,
|
|||||||
// We use the SSAUpdater interface to insert phi nodes as required.
|
// We use the SSAUpdater interface to insert phi nodes as required.
|
||||||
SmallVector<PHINode*, 16> NewPHIs;
|
SmallVector<PHINode*, 16> NewPHIs;
|
||||||
SSAUpdater SSA(&NewPHIs);
|
SSAUpdater SSA(&NewPHIs);
|
||||||
LoopPromoter Promoter(SomePtr, LoopUses, SSA, PointerMustAliases, ExitBlocks,
|
LoopPromoter Promoter(SomePtr, makeArrayRef(LoopUses), SSA,
|
||||||
|
PointerMustAliases, ExitBlocks,
|
||||||
InsertPts, PIC, *CurAST, *LI, DL, Alignment, AATags);
|
InsertPts, PIC, *CurAST, *LI, DL, Alignment, AATags);
|
||||||
|
|
||||||
// Set up the preheader to have a definition of the value. It is the live-out
|
// Set up the preheader to have a definition of the value. It is the live-out
|
||||||
|
@ -1088,7 +1088,8 @@ class AllocaPromoter : public LoadAndStorePromoter {
|
|||||||
SmallVector<DbgValueInst *, 4> DVIs;
|
SmallVector<DbgValueInst *, 4> DVIs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AllocaPromoter(const SmallVectorImpl<Instruction *> &Insts, SSAUpdater &S,
|
AllocaPromoter(ArrayRef<const Instruction *> Insts,
|
||||||
|
SSAUpdater &S,
|
||||||
AllocaInst &AI, DIBuilder &DIB)
|
AllocaInst &AI, DIBuilder &DIB)
|
||||||
: LoadAndStorePromoter(Insts, S), AI(AI), DIB(DIB) {}
|
: LoadAndStorePromoter(Insts, S), AI(AI), DIB(DIB) {}
|
||||||
|
|
||||||
@ -4418,7 +4419,7 @@ bool SROA::promoteAllocas(Function &F) {
|
|||||||
DeadInsts.push_back(I);
|
DeadInsts.push_back(I);
|
||||||
enqueueUsersInWorklist(*I, Worklist, Visited);
|
enqueueUsersInWorklist(*I, Worklist, Visited);
|
||||||
}
|
}
|
||||||
AllocaPromoter(Insts, SSA, *AI, DIB).run(Insts);
|
AllocaPromoter(makeArrayRef(Insts), SSA, *AI, DIB).run(Insts);
|
||||||
while (!DeadInsts.empty())
|
while (!DeadInsts.empty())
|
||||||
DeadInsts.pop_back_val()->eraseFromParent();
|
DeadInsts.pop_back_val()->eraseFromParent();
|
||||||
AI->eraseFromParent();
|
AI->eraseFromParent();
|
||||||
|
@ -1052,7 +1052,7 @@ class AllocaPromoter : public LoadAndStorePromoter {
|
|||||||
SmallVector<DbgDeclareInst *, 4> DDIs;
|
SmallVector<DbgDeclareInst *, 4> DDIs;
|
||||||
SmallVector<DbgValueInst *, 4> DVIs;
|
SmallVector<DbgValueInst *, 4> DVIs;
|
||||||
public:
|
public:
|
||||||
AllocaPromoter(const SmallVectorImpl<Instruction*> &Insts, SSAUpdater &S,
|
AllocaPromoter(ArrayRef<Instruction*> Insts, SSAUpdater &S,
|
||||||
DIBuilder *DB)
|
DIBuilder *DB)
|
||||||
: LoadAndStorePromoter(Insts, S), AI(nullptr), DIB(DB) {}
|
: LoadAndStorePromoter(Insts, S), AI(nullptr), DIB(DB) {}
|
||||||
|
|
||||||
|
@ -322,12 +322,12 @@ Value *SSAUpdater::GetValueAtEndOfBlockInternal(BasicBlock *BB) {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
LoadAndStorePromoter::
|
LoadAndStorePromoter::
|
||||||
LoadAndStorePromoter(const SmallVectorImpl<Instruction*> &Insts,
|
LoadAndStorePromoter(ArrayRef<const Instruction*> Insts,
|
||||||
SSAUpdater &S, StringRef BaseName) : SSA(S) {
|
SSAUpdater &S, StringRef BaseName) : SSA(S) {
|
||||||
if (Insts.empty()) return;
|
if (Insts.empty()) return;
|
||||||
|
|
||||||
Value *SomeVal;
|
const Value *SomeVal;
|
||||||
if (LoadInst *LI = dyn_cast<LoadInst>(Insts[0]))
|
if (const LoadInst *LI = dyn_cast<LoadInst>(Insts[0]))
|
||||||
SomeVal = LI;
|
SomeVal = LI;
|
||||||
else
|
else
|
||||||
SomeVal = cast<StoreInst>(Insts[0])->getOperand(0);
|
SomeVal = cast<StoreInst>(Insts[0])->getOperand(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user