[PATCH] D140733: [InstSimplify] fold exact divide to poison if it is known to not divide evenly

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 05:36:28 PST 2022


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1160
+    KnownBits KnownOp0 = computeKnownBits(Op0, Q.DL, 0, Q.AC, Q.CxtI, Q.DT);
+    if (KnownOp0.countMaxTrailingZeros() < DivC->countTrailingZeros())
+      return PoisonValue::get(Op0->getType());
----------------
spatel wrote:
> lebedev.ri wrote:
> > I think this is a better proof:
> > ```
> > https://alive2.llvm.org/ce/z/zCjKM7
> > But not: https://alive2.llvm.org/ce/z/-tz_RK
> > ```
> Do the extra function args just allow showing the TZ values/bounds more easily, or is there another benefit from writing it like that?
> Do the extra function args just allow showing the TZ values/bounds more easily

Yes. That wasn't apparent to me in original test.


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

https://reviews.llvm.org/D140733



More information about the llvm-commits mailing list