[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 20:13:58 PST 2020


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:1564
+       Context = User;
+     else if (DT->dominates(User, Context))
+       Context = User;
----------------
anna wrote:
> skatkov wrote:
> > anna wrote:
> > > dominates is a more expensive check than `comesBefore`. We can special case for uses in the same basic block, i.e. :
> > > ```
> > > if (User->getParent() == Context->getParent() && User->comesBefore(Context))
> > >     Context = User
> > > ```
> > comesBefore is used in DT->dominates...
> yes I know :), but there are a bunch of other checks in DT-dominates() which are first checked that are not needed for the same basic block case. Maybe it doesn't make a difference...
But why do you think that the users will be in the same block? In either case, DT checks cost is nothing compared to SCEV creation cost.


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

https://reviews.llvm.org/D90456



More information about the llvm-commits mailing list