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

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 08:38:25 PST 2020


anna added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:1564
+       Context = User;
+     else if (DT->dominates(User, Context))
+       Context = User;
----------------
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...


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

https://reviews.llvm.org/D90456



More information about the llvm-commits mailing list