[PATCH] D90456: [IndVars] Use more precise context when eliminating narrowing

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 00:35:05 PST 2020


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:1569
+       Context =
+           DT->findNearestCommonDominator(Context->getParent(),
+                                          User->getParent())->getTerminator();
----------------
skatkov wrote:
> What do you think about introducing the method in DT which finds nearestCommonDominator for an array of values?
> Here, just to collect all users and trigger the utility method?
> 
> Alternatively, introduce findNearestCommonDominator which accepts Instructions or values in DomTree?
> And use just it instead of this dispatching.
It's a good idea.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:1573
+  // No users, the instruction is dead.
+  if (!Context) {
+    DeadInsts.emplace_back(NarrowUse);
----------------
skatkov wrote:
> If all users are NarrowDef, should we mark it as dead?
NarrowDef will be deleted in the end in any case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90456/new/

https://reviews.llvm.org/D90456



More information about the llvm-commits mailing list