[PATCH] D65151: [InstSimplify] Drop leftover "division-by-zero guard" around `@llvm.umul.with.overflow` inverted overflow bit

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 08:25:28 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1814-1827
+    return nullptr;
+  auto *Extract = dyn_cast<ExtractValueInst>(Op1);
+  // We should only be extracting the overflow bit.
+  if (!Extract || !Extract->getIndices().equals(1))
+    return nullptr;
+  Value *Agg = Extract->getAggregateOperand();
+  // This should be a multiplication-with-overflow intrinsic.
----------------
spatel wrote:
> A couple of possibilities to reduce the code duplication, but you can decide if it is worth it:
> 1. Make a tiny helper for this chunk of code that matches the extract/intrinsic.
> 2. Add a parameter that tells this function whether we should match the EQ/NE and 'not' part of the pattern (distinguishes between if we were called by 'and' or 'or').
Yeah, this ended up having more duplication than i thought there will be.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65151





More information about the llvm-commits mailing list