[PATCH] D65144: [InstCombine] Fold '((%x * %y) u/ %x) != %y' to '@llvm.umul.with.overflow' + overflow bit extraction

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 07:25:07 PDT 2019


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3341
   Value *X, *Y;
+  Instruction *Mul;
   bool NeedNegation;
----------------
Instruction *Mul = nullptr;?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3347
                          m_Value(Y)))) {
+    Mul = nullptr;
     // Canonicalize as-if %y was on RHS.
----------------
..remove


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3378
+  if (Mul)
+    Builder.SetInsertPoint(Mul);
+
----------------
Also add multi use check?

bool HasMultiUseMul = Mul && !Mul->hasOneUse();
if (..)




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65144





More information about the llvm-commits mailing list