From 8fc21f481a5d76c99b92ae08726947450ecd5a91 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 13 Aug 2016 01:55:03 +0100 Subject: [PATCH] RegAlloc: Handle case when def is unused --- src/backend_x64/reg_alloc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index b5e1242e..9352fe15 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -392,7 +392,8 @@ void RegAlloc::EndOfAllocScope() { iter.values.clear(); iter.values.emplace_back(iter.def); iter.def = nullptr; - } else if (!iter.values.empty()) { + } + if (!iter.values.empty()) { auto to_erase = std::remove_if(iter.values.begin(), iter.values.end(), [](const auto& inst){ return inst->use_count <= 0; }); iter.values.erase(to_erase, iter.values.end());