From: Dylan Noblesmith Date: Mon, 25 Aug 2014 01:59:36 +0000 (+0000) Subject: AArch64: use std::vector for temp array X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7fb86b07055295dddedabd0d1ce784db45632ca0;p=oota-llvm.git AArch64: use std::vector for temp array git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216365 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AArch64/AArch64CollectLOH.cpp b/lib/Target/AArch64/AArch64CollectLOH.cpp index f621a28c802..38dbeb95927 100644 --- a/lib/Target/AArch64/AArch64CollectLOH.cpp +++ b/lib/Target/AArch64/AArch64CollectLOH.cpp @@ -1071,7 +1071,8 @@ bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) { bool Modified = false; // Start with ADRP. - InstrToInstrs *ColorOpToReachedUses = new InstrToInstrs[NbReg]; + std::vector COTRUVector(NbReg); + auto ColorOpToReachedUses = COTRUVector.data(); // Compute the reaching def in ADRP mode, meaning ADRP definitions // are first considered as uses. @@ -1086,10 +1087,9 @@ bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) { // Compute LOH for ADRP. computeADRP(ADRPToReachingDefs, *AArch64FI, MDT); - delete[] ColorOpToReachedUses; - // Continue with general ADRP -> ADD/LDR -> LDR/STR pattern. - ColorOpToReachedUses = new InstrToInstrs[NbReg]; + COTRUVector.clear(); + COTRUVector.resize(NbReg); // first perform a regular reaching def analysis. reachingDef(MF, ColorOpToReachedUses, RegToId, false, DummyOp); @@ -1103,7 +1103,6 @@ bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) { // Compute other than AdrpAdrp LOH. computeOthers(UsesToReachingDefs, ColorOpToReachedUses, *AArch64FI, RegToId, MDT); - delete[] ColorOpToReachedUses; if (BasicBlockScopeOnly) MF.DeleteMachineInstr(DummyOp);