[PATCH] D146699: [GuardWidening] Freeze the introduced use.

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 21:43:40 PDT 2023


mkazantsev accepted this revision.
mkazantsev added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/Scalar/GuardWidening.cpp:582
+          Instruction *User = cast<Instruction>(U);
+          return Res != User && DT.dominates(I, User) &&
+                 !DT.dominates(Res, User);
----------------
skatkov wrote:
> mkazantsev wrote:
> > `I` by default should dominate all its users. What am I missing here?
> No, if the user is a phi node in header.
Ok, got it.


================
Comment at: llvm/lib/Transforms/Scalar/GuardWidening.cpp:611
+    Instruction *I = dyn_cast<Instruction>(V);
+    if (!I || canCreateUndefOrPoison(cast<Operator>(I),
+                                     /*ConsiderFlagsAndMetadata*/ false)) {
----------------
skatkov wrote:
> mkazantsev wrote:
> > Why we can always cast this to operator? What if it's not?
> Any Instruction can be casted to Operator.
Ok, I see how it works.


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

https://reviews.llvm.org/D146699



More information about the llvm-commits mailing list