Fix skipping deleted instructions before replacing operands.
Fixes hitting a (benign) assert in replaceSource().
Change-Id: I7f984d484133e619717d004f20cd671a54473185
Reviewed-on: https://chromium-review.googlesource.com/414490
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 0af025b..c76c097 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -853,15 +853,17 @@
// Block should not end with a call
}
while (Current != End && !llvm::isa<InstCall>(iteratorToInst(Current))) {
- for (SizeT i = 0; i < Current->getSrcSize(); ++i) {
- if (auto *Const = llvm::dyn_cast<Constant>(Current->getSrc(i))) {
- if (Const->getType() == IceType_f32 ||
- Const->getType() == IceType_f64) {
- FloatUses[Const].push_back(Current);
+ if (!Current->isDeleted()) {
+ for (SizeT i = 0; i < Current->getSrcSize(); ++i) {
+ if (auto *Const = llvm::dyn_cast<Constant>(Current->getSrc(i))) {
+ if (Const->getType() == IceType_f32 ||
+ Const->getType() == IceType_f64) {
+ FloatUses[Const].push_back(Current);
+ }
}
}
}
- Current++;
+ ++Current;
}
for (auto &Pair : FloatUses) {
static constexpr SizeT MinUseThreshold = 3;