[clang] [llvm] [Transforms][Utils][PromoteMem2Reg] Propagate nnan flag on par with the nsz flag (PR #114271)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 5 11:27:32 PST 2024
================
@@ -1140,6 +1148,15 @@ void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred,
if (isa<FPMathOperator>(APN) && NoSignedZeros)
APN->setHasNoSignedZeros(true);
+ // This allows select instruction folding relevant to floating point
+ // reductions whose operand is a PHI.
+ if (isa<FPMathOperator>(APN) && NoNaNs)
+ APN->setHasNoNaNs(true);
+
+ // Handle NoInfs flag too.
+ if (isa<FPMathOperator>(APN) && NoInfs)
+ APN->setHasNoInfs(true);
----------------
nikic wrote:
I'd suggest to extract a common `if (isa<FPMathOperator>(APN))` around all three.
https://github.com/llvm/llvm-project/pull/114271
More information about the cfe-commits
mailing list