[PATCH] D155420: [PostDom] add findNearestCommonDominator for instructions
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 06:22:13 PDT 2023
nikic added a comment.
I think I would prefer to add this as a local helper to MemCpyOpt until we have a second use case.
================
Comment at: llvm/include/llvm/Analysis/PostDominators.h:49
+ /// Find the nearest instruction I that post-dominates both I1 and I2, in the
+ /// sense that a result produced after I will be available at both I1 and I2.
+ Instruction *findNearestCommonDominator(Instruction *I1,
----------------
The "in the sense" part isn't correct for post-dominators.
================
Comment at: llvm/lib/Analysis/PostDominators.cpp:90
+ return I1;
+ return PDomBB->getFirstNonPHI();
+}
----------------
I wasn't able to come up with an example where the nearest common post-dom would be an exception pad, so I think getFirstNonPHI() is fine.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155420/new/
https://reviews.llvm.org/D155420
More information about the llvm-commits
mailing list