@@ -1539,27 +1539,22 @@ CallInst *replaceCalledFunction(Module &M, OutlinableRegion &Region) {
1539
1539
// / \returns The found or newly created BasicBlock to contain the needed
1540
1540
// / PHINodes to be used as outputs.
1541
1541
static BasicBlock *findOrCreatePHIBlock (OutlinableGroup &Group, Value *RetVal) {
1542
- DenseMap<Value *, BasicBlock *>::iterator PhiBlockForRetVal,
1543
- ReturnBlockForRetVal;
1544
- PhiBlockForRetVal = Group.PHIBlocks .find (RetVal);
1545
- ReturnBlockForRetVal = Group.EndBBs .find (RetVal);
1542
+ // Find if a PHIBlock exists for this return value already. If it is
1543
+ // the first time we are analyzing this, we will not, so we record it.
1544
+ auto [PhiBlockForRetVal, Inserted] = Group.PHIBlocks .try_emplace (RetVal);
1545
+ if (!Inserted)
1546
+ return PhiBlockForRetVal->second ;
1547
+
1548
+ auto ReturnBlockForRetVal = Group.EndBBs .find (RetVal);
1546
1549
assert (ReturnBlockForRetVal != Group.EndBBs .end () &&
1547
1550
" Could not find output value!" );
1548
1551
BasicBlock *ReturnBB = ReturnBlockForRetVal->second ;
1549
1552
1550
- // Find if a PHIBlock exists for this return value already. If it is
1551
- // the first time we are analyzing this, we will not, so we record it.
1552
- PhiBlockForRetVal = Group.PHIBlocks .find (RetVal);
1553
- if (PhiBlockForRetVal != Group.PHIBlocks .end ())
1554
- return PhiBlockForRetVal->second ;
1555
-
1556
1553
// If we did not find a block, we create one, and insert it into the
1557
1554
// overall function and record it.
1558
- bool Inserted = false ;
1559
1555
BasicBlock *PHIBlock = BasicBlock::Create (ReturnBB->getContext (), " phi_block" ,
1560
1556
ReturnBB->getParent ());
1561
- std::tie (PhiBlockForRetVal, Inserted) =
1562
- Group.PHIBlocks .insert (std::make_pair (RetVal, PHIBlock));
1557
+ PhiBlockForRetVal->second = PHIBlock;
1563
1558
1564
1559
// We find the predecessors of the return block in the newly created outlined
1565
1560
// function in order to point them to the new PHIBlock rather than the already
0 commit comments