Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class SSAUpdaterImpl {
continue;

// Look for an existing PHI.
FindExistingPHI(Info->BB, BlockList);
FindExistingPHI(Info->BB);
if (Info->AvailableVal)
continue;

Expand Down Expand Up @@ -412,19 +412,19 @@ class SSAUpdaterImpl {

/// FindExistingPHI - Look through the PHI nodes in a block to see if any of
/// them match what is needed.
void FindExistingPHI(BlkT *BB, BlockListTy *BlockList) {
void FindExistingPHI(BlkT *BB) {
SmallVector<BBInfo *, 20> TaggedBlocks;
for (auto &SomePHI : BB->phis()) {
if (CheckIfPHIMatches(&SomePHI, TaggedBlocks)) {
RecordMatchingPHIs(BlockList);
RecordMatchingPHIs(TaggedBlocks);
break;
}
}
}

/// CheckIfPHIMatches - Check if a PHI node matches the placement and values
/// in the BBMap.
bool CheckIfPHIMatches(PhiT *PHI, SmallVectorImpl<BBInfo *> &TaggedBlocks) {
bool CheckIfPHIMatches(PhiT *PHI, BlockListTy &TaggedBlocks) {
// Match failed: clear all the PHITag values. Only need to clear visited
// blocks.
auto Cleanup = make_scope_exit([&]() {
Expand Down Expand Up @@ -484,15 +484,15 @@ class SSAUpdaterImpl {

/// RecordMatchingPHIs - For each PHI node that matches, record it in both
/// the BBMap and the AvailableVals mapping.
void RecordMatchingPHIs(BlockListTy *BlockList) {
for (typename BlockListTy::iterator I = BlockList->begin(),
E = BlockList->end(); I != E; ++I)
if (PhiT *PHI = (*I)->PHITag) {
BlkT *BB = PHI->getParent();
ValT PHIVal = Traits::GetPHIValue(PHI);
(*AvailableVals)[BB] = PHIVal;
BBMap[BB]->AvailableVal = PHIVal;
}
void RecordMatchingPHIs(BlockListTy &TaggedBlocks) {
for (BBInfo *Block : TaggedBlocks) {
PhiT *PHI = Block->PHITag;
assert(PHI && "PHITag didn't set?");
BlkT *BB = PHI->getParent();
ValT PHIVal = Traits::GetPHIValue(PHI);
(*AvailableVals)[BB] = PHIVal;
BBMap[BB]->AvailableVal = PHIVal;
}
}
};

Expand Down