[PATCH] D156499: [InstCombine] Fold abs of known sign operand when source is sub

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 02:18:04 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1032
+            isImpliedByDomCondition(ICmpInst::ICMP_SLE, X, Y, CxtI, DL))
+      return Known;
+  }
----------------
This looks incorrect from the perspective of the getKnownSign() API. You are returning sign 1 for value 0, which is incorrect. It does work out for the abs optimization because -0 == 0, but it may matter in other cases.


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

https://reviews.llvm.org/D156499



More information about the llvm-commits mailing list