[PATCH] D145073: [InstCombine] fold signed absolute diff patterns

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 09:05:46 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:970
+  if (match(TVal, m_NSWSub(m_Specific(A), m_Specific(B))) &&
+      match(FVal, m_NSWSub(m_Specific(B), m_Specific(A))) &&
+      Pred == CmpInst::ICMP_SGT) {
----------------
It also works for `nuw`: https://alive2.llvm.org/ce/z/YfWtvG (either op can be either `nsw`/`nuw`)


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

https://reviews.llvm.org/D145073



More information about the llvm-commits mailing list