[llvm] r366397 - [RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 20:23:47 PDT 2019
Author: asb
Date: Wed Jul 17 20:23:47 2019
New Revision: 366397
URL: http://llvm.org/viewvc/llvm-project?rev=366397&view=rev
Log:
[RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch
Issue found by ASan.
Modified:
llvm/trunk/lib/Target/RISCV/RISCVInstrInfo.cpp
Modified: llvm/trunk/lib/Target/RISCV/RISCVInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVInstrInfo.cpp?rev=366397&r1=366396&r2=366397&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVInstrInfo.cpp Wed Jul 17 20:23:47 2019
@@ -290,9 +290,9 @@ unsigned RISCVInstrInfo::removeBranch(Ma
return 0;
// Remove the branch.
- I->eraseFromParent();
if (BytesRemoved)
*BytesRemoved += getInstSizeInBytes(*I);
+ I->eraseFromParent();
I = MBB.end();
@@ -303,9 +303,9 @@ unsigned RISCVInstrInfo::removeBranch(Ma
return 1;
// Remove the branch.
- I->eraseFromParent();
if (BytesRemoved)
*BytesRemoved += getInstSizeInBytes(*I);
+ I->eraseFromParent();
return 2;
}
More information about the llvm-commits
mailing list