[llvm] [AMDGPU] Disable atomic optimization of fadd/fsub with result (PR #96479)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 05:09:08 PDT 2024


================
@@ -202,11 +202,17 @@ void AMDGPUAtomicOptimizerImpl::visitAtomicRMWInst(AtomicRMWInst &I) {
   case AtomicRMWInst::Min:
   case AtomicRMWInst::UMax:
   case AtomicRMWInst::UMin:
-  case AtomicRMWInst::FAdd:
-  case AtomicRMWInst::FSub:
   case AtomicRMWInst::FMax:
   case AtomicRMWInst::FMin:
     break;
+  case AtomicRMWInst::FAdd:
+  case AtomicRMWInst::FSub:
+    if (!I.use_empty()) {
+      // Bail out because the way we would calculate the result value is
+      // incorrect in the presence of NaNs and infinities.
----------------
arsenm wrote:

Add a todo to fix the 0->-0 case and check no-nan/no-infs? 

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


More information about the llvm-commits mailing list