-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[GVN][NFC] Use early return in phiTranslateImpl() #149268
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
Conversation
@llvm/pr-subscribers-llvm-transforms Author: Madhur Amilkanthwar (madhur13490) ChangesFull diff: https://github.com/llvm/llvm-project/pull/149268.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 8bff458f88bb9..affae41ed2c83 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -2367,12 +2367,15 @@ uint32_t GVNPass::ValueTable::phiTranslateImpl(const BasicBlock *Pred,
// See if we can refine the value number by looking at the PN incoming value
// for the given predecessor.
if (PHINode *PN = NumberingPhi[Num]) {
- if (PN->getParent() == PhiBlock)
- for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I)
- if (PN->getIncomingBlock(I) == Pred)
- if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
- return TransVal;
- return Num;
+ if (PN->getParent() != PhiBlock)
+ return Num;
+
+ for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I) {
+ if (PN->getIncomingBlock(I) != Pred)
+ continue;
+ if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
+ return TransVal;
+ }
}
if (BasicBlock *BB = NumberingBB[Num]) {
|
This reverts commit 1d398a9.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/23672 Here is the relevant piece of the build log for the reference
|
continue; | ||
if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false)) | ||
return TransVal; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously we would return Num;
if no translated incoming value could be found, now we fall through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, realized this. Reverted in #149270
No description provided.