Commit e1e17832 by Nicolas Capens Committed by Nicolas Capens

Fix skipping deleted instructions before replacing operands.

Fixes hitting a (benign) assert in replaceSource(). Change-Id: I7f984d484133e619717d004f20cd671a54473185 Reviewed-on: https://chromium-review.googlesource.com/414490Reviewed-by: 's avatarJim Stichnoth <stichnot@chromium.org>
parent 8be69751
...@@ -853,15 +853,17 @@ void Cfg::floatConstantCSE() { ...@@ -853,15 +853,17 @@ void Cfg::floatConstantCSE() {
// Block should not end with a call // Block should not end with a call
} }
while (Current != End && !llvm::isa<InstCall>(iteratorToInst(Current))) { while (Current != End && !llvm::isa<InstCall>(iteratorToInst(Current))) {
for (SizeT i = 0; i < Current->getSrcSize(); ++i) { if (!Current->isDeleted()) {
if (auto *Const = llvm::dyn_cast<Constant>(Current->getSrc(i))) { for (SizeT i = 0; i < Current->getSrcSize(); ++i) {
if (Const->getType() == IceType_f32 || if (auto *Const = llvm::dyn_cast<Constant>(Current->getSrc(i))) {
Const->getType() == IceType_f64) { if (Const->getType() == IceType_f32 ||
FloatUses[Const].push_back(Current); Const->getType() == IceType_f64) {
FloatUses[Const].push_back(Current);
}
} }
} }
} }
Current++; ++Current;
} }
for (auto &Pair : FloatUses) { for (auto &Pair : FloatUses) {
static constexpr SizeT MinUseThreshold = 3; static constexpr SizeT MinUseThreshold = 3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment