From b67031112fd3f6d6bb03880e31ec179ebbf6153d Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Thu, 18 Jul 2019 03:23:47 +0000 Subject: [PATCH] [RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch Issue found by ASan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366397 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/RISCV/RISCVInstrInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Target/RISCV/RISCVInstrInfo.cpp b/lib/Target/RISCV/RISCVInstrInfo.cpp index 2608906bb43..99c8d2ef73d 100644 --- a/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -290,9 +290,9 @@ unsigned RISCVInstrInfo::removeBranch(MachineBasicBlock &MBB, return 0; // Remove the branch. - I->eraseFromParent(); if (BytesRemoved) *BytesRemoved += getInstSizeInBytes(*I); + I->eraseFromParent(); I = MBB.end(); @@ -303,9 +303,9 @@ unsigned RISCVInstrInfo::removeBranch(MachineBasicBlock &MBB, return 1; // Remove the branch. - I->eraseFromParent(); if (BytesRemoved) *BytesRemoved += getInstSizeInBytes(*I); + I->eraseFromParent(); return 2; } -- 2.49.0