[llvm] [SROA] Propagate no-signed-zeros(nsz) fast-math flag on the phi node using function attribute (PR #83381)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 23:20:40 PDT 2024


================
@@ -1113,6 +1113,14 @@ void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred,
         for (unsigned i = 0; i != NumEdges; ++i)
           APN->addIncoming(IncomingVals[AllocaNo], Pred);
 
+        if (APN->isComplete() &&
+            APN->getFunction()
+                ->getFnAttribute("no-signed-zeros-fp-math")
+                .getValueAsBool() &&
+            isa<FPMathOperator>(APN)) {
+          APN->setHasNoSignedZeros(true);
----------------
sushgokh wrote:

`FPOp->setHasNoSignedZeros()` was not allowed since setHasNoSignedZeros() is a private member of FPMathOperator

https://github.com/llvm/llvm-project/pull/83381


More information about the llvm-commits mailing list