Skip to content

Commit

Permalink
[SelectionDAG] Don't create entries in ValueMap in ComputePHILiveOutR…
Browse files Browse the repository at this point in the history
…egInfo

Instead of using operator[], use DenseMap::find to prevent default
constructing an entry if it isn't already in the map.

Also simplify a condition to check for 0 instead of a virtual register.
I'm pretty sure we can only get 0 or a virtual register out of the value
map.
  • Loading branch information
topperc committed Mar 23, 2022
1 parent b38e78c commit cac9773
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
Expand Up @@ -445,9 +445,14 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
IntVT = TLI->getTypeToTransformTo(PN->getContext(), IntVT);
unsigned BitWidth = IntVT.getSizeInBits();

Register DestReg = ValueMap[PN];
if (!Register::isVirtualRegister(DestReg))
auto It = ValueMap.find(PN);
if (It == ValueMap.end())
return;

Register DestReg = It->second;
if (DestReg == 0)
return
assert(Register::isVirtualRegister(DestReg) && "Expected a virtual reg");
LiveOutRegInfo.grow(DestReg);
LiveOutInfo &DestLOI = LiveOutRegInfo[DestReg];

Expand Down

0 comments on commit cac9773

Please sign in to comment.