[llvm] r344092 - [X86] Fix sanitizer bot failure from 344085

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 16:10:57 PDT 2018


Author: xur
Date: Tue Oct  9 16:10:56 2018
New Revision: 344092

URL: http://llvm.org/viewvc/llvm-project?rev=344092&view=rev
Log:
[X86] Fix sanitizer bot failure from 344085

Fix the memory issue exposed by sanitizer.

Modified:
    llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp

Modified: llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp?rev=344092&r1=344091&r2=344092&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp Tue Oct  9 16:10:56 2018
@@ -424,8 +424,9 @@ bool X86CondBrFolding::optimize() {
   }
   NumFixedCondBrs += RemoveList.size();
   for (auto MBBI : RemoveList) {
-    for (auto *Succ : MBBI->successors())
-      MBBI->removeSuccessor(Succ);
+    while (!MBBI->succ_empty())
+      MBBI->removeSuccessor(MBBI->succ_end() - 1);
+
     MBBI->eraseFromParent();
   }
 




More information about the llvm-commits mailing list