Skip to content

[IPO] Avoid repeated hash lookups (NFC) #125639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
12 changes: 6 additions & 6 deletions llvm/lib/Transforms/IPO/IROutliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,22 +1184,22 @@ static std::optional<unsigned> getGVNForPHINode(OutlinableRegion &Region,
for (unsigned Idx = 0, EIdx = PN->getNumIncomingValues(); Idx < EIdx; Idx++) {
Incoming = PN->getIncomingValue(Idx);
IncomingBlock = PN->getIncomingBlock(Idx);
// If the incoming block isn't in the region, we don't have to worry about
// this incoming value.
if (!Blocks.contains(IncomingBlock))
continue;

// If we cannot find a GVN, and the incoming block is included in the region
// this means that the input to the PHINode is not included in the region we
// are trying to analyze, meaning, that if it was outlined, we would be
// adding an extra input. We ignore this case for now, and so ignore the
// region.
std::optional<unsigned> OGVN = Cand.getGVN(Incoming);
if (!OGVN && Blocks.contains(IncomingBlock)) {
if (!OGVN) {
Region.IgnoreRegion = true;
return std::nullopt;
}

// If the incoming block isn't in the region, we don't have to worry about
// this incoming value.
if (!Blocks.contains(IncomingBlock))
continue;

// Collect the canonical numbers of the values in the PHINode.
unsigned GVN = *OGVN;
OGVN = Cand.getCanonicalNum(GVN);
Expand Down