[PATCH] [AArch64] fix an invalid-iterator-use bug.
Sanjoy Das
sanjoy at playingwithpointers.com
Sun Mar 1 16:19:38 PST 2015
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7988
Files:
llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp
Index: llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp
@@ -189,9 +189,11 @@
IPI->second.push_back(&Use);
// Transfer the dominated uses of IPI to NewPt
// Inserting into the DenseMap may invalidate existing iterator.
- // Keep a copy of the key to find the iterator to erase.
+ // Keep a copy of the key to find the iterator to erase. Keep a copy of the
+ // value so that we don't have to dereference IPI->second.
Instruction *OldInstr = IPI->first;
- InsertPts[NewPt] = std::move(IPI->second);
+ Uses OldUses = std::move(IPI->second);
+ InsertPts[NewPt] = std::move(OldUses);
// Erase IPI.
InsertPts.erase(OldInstr);
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7988.20970.patch
Type: text/x-patch
Size: 872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150302/bf5d36af/attachment.bin>
More information about the llvm-commits
mailing list