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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 11:53:58 PST 2022


spatel planned changes to this revision.
spatel added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1157
+  const APInt *DivC;
+  auto *PEO = dyn_cast_if_present<PossiblyExactOperator>(Q.CxtI);
+  if (PEO && PEO->isExact() && match(Op1, m_APInt(DivC)) &&
----------------
nikic wrote:
> This is not correct, Q.CxtI can be an unrelated instruction. You need to pass the exact flag down into the function.
Ah, I saw how some FMF were handled and followed that code pattern, but now I see how no-wrap is handled for other opcodes.


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

https://reviews.llvm.org/D140733



More information about the llvm-commits mailing list