Skip to content

Commit cac9773

Browse files
committed
[SelectionDAG] Don't create entries in ValueMap in ComputePHILiveOutRegInfo
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.
1 parent b38e78c commit cac9773

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,14 @@ void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
445445
IntVT = TLI->getTypeToTransformTo(PN->getContext(), IntVT);
446446
unsigned BitWidth = IntVT.getSizeInBits();
447447

448-
Register DestReg = ValueMap[PN];
449-
if (!Register::isVirtualRegister(DestReg))
448+
auto It = ValueMap.find(PN);
449+
if (It == ValueMap.end())
450450
return;
451+
452+
Register DestReg = It->second;
453+
if (DestReg == 0)
454+
return
455+
assert(Register::isVirtualRegister(DestReg) && "Expected a virtual reg");
451456
LiveOutRegInfo.grow(DestReg);
452457
LiveOutInfo &DestLOI = LiveOutRegInfo[DestReg];
453458

0 commit comments

Comments
 (0)