[LVI] Extract addValueHandle() method (NFC)

There will be more places registering value handles.
This commit is contained in:
Nikita Popov 2020-06-20 12:49:08 +02:00
parent 64ecf85f63
commit d3d4e4bcb7
1 changed files with 7 additions and 3 deletions

View File

@ -183,6 +183,12 @@ namespace {
return It->second.get();
}
void addValueHandle(Value *Val) {
auto HandleIt = ValueHandles.find_as(Val);
if (HandleIt == ValueHandles.end())
ValueHandles.insert({ Val, this });
}
public:
void insertResult(Value *Val, BasicBlock *BB,
const ValueLatticeElement &Result) {
@ -195,9 +201,7 @@ namespace {
else
Entry->LatticeElements.insert({ Val, Result });
auto HandleIt = ValueHandles.find_as(Val);
if (HandleIt == ValueHandles.end())
ValueHandles.insert({ Val, this });
addValueHandle(Val);
}
Optional<ValueLatticeElement> getCachedValueInfo(Value *V,