[llvm] r216365 - AArch64: use std::vector for temp array
Dylan Noblesmith
nobled at dreamwidth.org
Sun Aug 24 18:59:36 PDT 2014
Author: nobled
Date: Sun Aug 24 20:59:36 2014
New Revision: 216365
URL: http://llvm.org/viewvc/llvm-project?rev=216365&view=rev
Log:
AArch64: use std::vector for temp array
Modified:
llvm/trunk/lib/Target/AArch64/AArch64CollectLOH.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64CollectLOH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64CollectLOH.cpp?rev=216365&r1=216364&r2=216365&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64CollectLOH.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64CollectLOH.cpp Sun Aug 24 20:59:36 2014
@@ -1071,7 +1071,8 @@ bool AArch64CollectLOH::runOnMachineFunc
bool Modified = false;
// Start with ADRP.
- InstrToInstrs *ColorOpToReachedUses = new InstrToInstrs[NbReg];
+ std::vector<InstrToInstrs> 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::runOnMachineFunc
// 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::runOnMachineFunc
// Compute other than AdrpAdrp LOH.
computeOthers(UsesToReachingDefs, ColorOpToReachedUses, *AArch64FI, RegToId,
MDT);
- delete[] ColorOpToReachedUses;
if (BasicBlockScopeOnly)
MF.DeleteMachineInstr(DummyOp);
More information about the llvm-commits
mailing list