mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
avoid an unneeded vector copy. This speeds up mem2reg on the testcase
in PR1432 by 6% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40803 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac4aa4be9b
commit
63cdcaa3d6
@ -76,11 +76,18 @@ namespace {
|
||||
// Data package used by RenamePass()
|
||||
class VISIBILITY_HIDDEN RenamePassData {
|
||||
public:
|
||||
RenamePassData() {}
|
||||
RenamePassData(BasicBlock *B, BasicBlock *P,
|
||||
const std::vector<Value *> &V) : BB(B), Pred(P), Values(V) {}
|
||||
BasicBlock *BB;
|
||||
BasicBlock *Pred;
|
||||
std::vector<Value *> Values;
|
||||
|
||||
void swap(RenamePassData &RHS) {
|
||||
std::swap(BB, RHS.BB);
|
||||
std::swap(Pred, RHS.Pred);
|
||||
Values.swap(RHS.Values);
|
||||
}
|
||||
};
|
||||
|
||||
struct VISIBILITY_HIDDEN PromoteMem2Reg {
|
||||
@ -406,7 +413,8 @@ void PromoteMem2Reg::run() {
|
||||
std::vector<RenamePassData> RenamePassWorkList;
|
||||
RenamePassWorkList.push_back(RenamePassData(F.begin(), 0, Values));
|
||||
while(!RenamePassWorkList.empty()) {
|
||||
RenamePassData RPD = RenamePassWorkList.back();
|
||||
RenamePassData RPD;
|
||||
RPD.swap(RenamePassWorkList.back());
|
||||
RenamePassWorkList.pop_back();
|
||||
// RenamePass may add new worklist entries.
|
||||
RenamePass(RPD.BB, RPD.Pred, RPD.Values, RenamePassWorkList);
|
||||
|
Loading…
Reference in New Issue
Block a user