[llvm] [ConstraintElim] Strengthen flags at the closest dominator of all uses. (PR #220918)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 10:56:36 PDT 2026
================
@@ -75,6 +75,26 @@ static Instruction *getContextInstForUse(Use &U) {
return UserI;
}
+/// Returns the closest program point dominating all uses of \p I, or nullptr if
+/// \p I has no uses.
+static Instruction *findCommonDominatorOfUses(Instruction &I,
+ DominatorTree &DT) {
+ Instruction *CommonDom = nullptr;
+ unsigned NumUses = 0;
+ for (Use &U : I.uses()) {
+ // Conservatively use original instruction, if there are too many uses.
+ if (++NumUses == 16)
+ return &I;
+ Instruction *UserI = getContextInstForUse(U);
+ CommonDom =
+ CommonDom ? DT.findNearestCommonDominator(CommonDom, UserI) : UserI;
----------------
dtcxzyw wrote:
Does it trigger an assertion when one of the users is unreachable?
https://github.com/llvm/llvm-project/pull/220918
More information about the llvm-commits
mailing list