[PATCH] D158042: [LICM] Check hasNoSignedZeros in hoistFPAssociation.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 18:01:57 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: nikic, pawosm01, paulwalker-arm, huntergr, qcolombet, fhahn.
Herald added subscribers: StephenFan, asbirlea, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

This matches the check done by the Reassociate pass that we're
trying to reverse.

Is there a reason we don't need to check this here?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158042

Files:
  llvm/lib/Transforms/Scalar/LICM.cpp


Index: llvm/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LICM.cpp
+++ llvm/lib/Transforms/Scalar/LICM.cpp
@@ -2696,7 +2696,7 @@
   Value *VariantOp = nullptr, *InvariantOp = nullptr;
 
   if (!match(&I, m_FMul(m_Value(VariantOp), m_Value(InvariantOp))) ||
-      !I.hasAllowReassoc())
+      !I.hasAllowReassoc() || !I.hasNoSignedZeros())
     return false;
   if (L.isLoopInvariant(VariantOp))
     std::swap(VariantOp, InvariantOp);
@@ -2711,7 +2711,7 @@
     Worklist.push_back(VariantBinOp);
   while (!Worklist.empty()) {
     BinaryOperator *BO = Worklist.pop_back_val();
-    if (!BO->hasOneUse() || !BO->hasAllowReassoc())
+    if (!BO->hasOneUse() || !BO->hasAllowReassoc() || !BO->hasNoSignedZeros())
       return false;
     BinaryOperator *Op0, *Op1;
     if (match(BO, m_FAdd(m_BinOp(Op0), m_BinOp(Op1)))) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158042.550565.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/ba1367bf/attachment.bin>


More information about the llvm-commits mailing list