From 8f86f44c4bdf67238d277b8727f7d6a496f654e1 Mon Sep 17 00:00:00 2001 From: Peter Goodman Date: Tue, 3 Nov 2020 17:22:58 -0500 Subject: [PATCH] Hot fix --- lib/BC/InstructionLifter.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/BC/InstructionLifter.cpp b/lib/BC/InstructionLifter.cpp index 0be0e1572..6b3f181f9 100644 --- a/lib/BC/InstructionLifter.cpp +++ b/lib/BC/InstructionLifter.cpp @@ -238,6 +238,12 @@ llvm::Value *InstructionLifter::LoadRegAddress(llvm::BasicBlock *block, if (!added) { DCHECK(reg_ptr_it->second != nullptr); return reg_ptr_it->second; + } + + // It's already a variable in the function. + if (const auto reg_ptr = FindVarInFunction(func, reg_name_, true); reg_ptr) { + reg_ptr_it->second = reg_ptr; + return reg_ptr; // It's a register known to this architecture, so go and build a GEP to it // right now. We'll try to be careful about the placement of the actual @@ -276,9 +282,9 @@ llvm::Value *InstructionLifter::LoadRegAddress(llvm::BasicBlock *block, return reg_ptr; } else { - const auto reg_ptr = FindVarInFunction(func, reg_name_, true); - reg_ptr_it->second = reg_ptr; - return reg_ptr; + LOG(FATAL) + << "Could not locate variable or register " << reg_name_; + return nullptr; } }