[PATCH] D65954: [Reassociate] try harder to convert negative FP constants to positive

Michael Berg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 09:09:52 PDT 2019


mcberg2017 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:2014
+    if (match(Negatible->getOperand(0), m_APFloat(C))) {
+      assert(!match(Negatible->getOperand(1), m_Constant()) &&
+             "Expecting only 1 constant operand");
----------------
How about in place of the assert, logic to bypass candidates that meet these constraints.  It should not happen given how the candidate list is built, however this would ensure if something did get in we would not process it for release builds.


================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:2021
+    if (match(Negatible->getOperand(1), m_APFloat(C))) {
+      assert(!match(Negatible->getOperand(0), m_Constant()) &&
+             "Expecting only 1 constant operand");
----------------
Same here...


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

https://reviews.llvm.org/D65954





More information about the llvm-commits mailing list