From a7d4a73d2d43d39ea78d5c94c64a708ff3bf4e0e Mon Sep 17 00:00:00 2001 From: Pietro Fezzardi Date: Tue, 16 Jun 2026 17:11:07 +0200 Subject: [PATCH] ExitSSA: don't exclude PHINodes with non-phi Users Before this commit, the code never put in the same group two PHINodes if one of them had a non-phi User. This condition was wrong and was unnecessarily preventing valig PHINodes to be put in the same group. This caused the generation of a lot more local variables than necessary. --- lib/Canonicalize/ExitSSAPass.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/Canonicalize/ExitSSAPass.cpp b/lib/Canonicalize/ExitSSAPass.cpp index 8b8594a5d..d5ca3c4b5 100644 --- a/lib/Canonicalize/ExitSSAPass.cpp +++ b/lib/Canonicalize/ExitSSAPass.cpp @@ -122,12 +122,6 @@ static std::vector> getPHIEquivalenceClasses(Function &F) { if (PHISameVariableClasses.isEquivalent(&PHI, PHIUser)) continue; - // If the PHI has a user that is not another PHI, it cannot be put in - // the same equivalence class as the PHIUser, so we bail out. - if (llvm::any_of(PHI.users(), - [](const User *U) { return not isa(U); })) - continue; - PHINode *PHILeader = PHISameVariableClasses.getLeaderValue(&PHI); PHINode *UserLeader = PHISameVariableClasses.getLeaderValue(PHIUser);