diff options
author | Rong Xu <xur@google.com> | 2018-10-09 23:10:56 +0000 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2018-10-09 23:10:56 +0000 |
commit | 5c7bf1a75652ef73968b3737d44ea4bd2fe49673 (patch) | |
tree | 7fcd99a61e82b0a4136bf62513a68b828958dc33 | |
parent | c62dfe512ecd15c074f31965cdb40b59da6a3835 (diff) | |
download | bcm5719-llvm-5c7bf1a75652ef73968b3737d44ea4bd2fe49673.tar.gz bcm5719-llvm-5c7bf1a75652ef73968b3737d44ea4bd2fe49673.zip |
[X86] Fix sanitizer bot failure from 344085
Fix the memory issue exposed by sanitizer.
llvm-svn: 344092
-rw-r--r-- | llvm/lib/Target/X86/X86CondBrFolding.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86CondBrFolding.cpp b/llvm/lib/Target/X86/X86CondBrFolding.cpp index 9a5ae704171..8b9ef20d916 100644 --- a/llvm/lib/Target/X86/X86CondBrFolding.cpp +++ b/llvm/lib/Target/X86/X86CondBrFolding.cpp @@ -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(); } |