[PATCH] D107552: [InstCombine] Combine lshr of add that intends to get the carry as llvm.uadd.with.overflow

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 9 04:05:56 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:1060
+
+  // Be conservative if the newly created overflow would be a live-out of it's
+  // basic-block.
----------------
I really don't think we should be doing this..


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:1069
+  Value *X = nullptr, *Y = nullptr;
+  if (match(Op0, m_Add(m_ZExt(m_Value(X)), m_ZExt(m_Value(Y)))) &&
+      X->getType()->getScalarSizeInBits() == ShAmt &&
----------------
Early return


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:1083-1084
+
+      if (Trunc->getParent() != I.getParent())
+        return nullptr;
+
----------------
Presumably you should just set the expansion point to be right after the old `add`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107552



More information about the llvm-commits mailing list