[llvm] [SROA] Propagate no-signed-zeros(nsz) fast-math flag on the phi node using function attribute (PR #83381)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 30 03:38:02 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);
----------------
arsenm wrote:
I'd probably reorder these checks; FPOp = dyn_cast<FPMathOperator>(); if (FPop && fnAttrIsNSZ) { FPOp->setHasNoSignedZeros() }
This also needs a comment explaining why this needs to be done
https://github.com/llvm/llvm-project/pull/83381
More information about the llvm-commits
mailing list