summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2019-07-18 03:23:47 +0000
committerAlex Bradbury <asb@lowrisc.org>2019-07-18 03:23:47 +0000
commitad73a436dc3bd9a6da0645872b3e9efe95e45e71 (patch)
tree692ff35136a32ee5d72735c9b1be1a8ec81f8225 /llvm/lib
parentf358cf8de22ded93286992bbe9eeb32d47b2426e (diff)
downloadbcm5719-llvm-ad73a436dc3bd9a6da0645872b3e9efe95e45e71.tar.gz
bcm5719-llvm-ad73a436dc3bd9a6da0645872b3e9efe95e45e71.zip
[RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch
Issue found by ASan. llvm-svn: 366397
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/RISCV/RISCVInstrInfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 2608906bb43..99c8d2ef73d 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud