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

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 08:48:08 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;
----------------
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
```


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

https://reviews.llvm.org/D90456



More information about the llvm-commits mailing list