[llvm] r246033 - [AArch64] Remove a use-after-free when collecting stats.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 06:39:49 PDT 2015
Author: mcrosier
Date: Wed Aug 26 08:39:48 2015
New Revision: 246033
URL: http://llvm.org/viewvc/llvm-project?rev=246033&view=rev
Log:
[AArch64] Remove a use-after-free when collecting stats.
The call to mergePairedInsns() deletes MI, so the later use by isUnscaledLdSt()
is referencing freed memory.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=246033&r1=246032&r2=246033&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Wed Aug 26 08:39:48 2015
@@ -984,15 +984,15 @@ bool AArch64LoadStoreOpt::optimizeBlock(
MachineBasicBlock::iterator Paired =
findMatchingInsn(MBBI, Flags, ScanLimit);
if (Paired != E) {
+ ++NumPairCreated;
+ if (isUnscaledLdSt(MI))
+ ++NumUnscaledPairCreated;
+
// Merge the loads into a pair. Keeping the iterator straight is a
// pain, so we let the merge routine tell us what the next instruction
// is after it's done mucking about.
MBBI = mergePairedInsns(MBBI, Paired, Flags);
-
Modified = true;
- ++NumPairCreated;
- if (isUnscaledLdSt(MI))
- ++NumUnscaledPairCreated;
break;
}
++MBBI;
More information about the llvm-commits
mailing list