[llvm] [AMDGPU] Fix missing `IsExact` flag when expanding vector binary operator (PR #86712)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 12:27:18 PDT 2024


https://github.com/shiltian updated https://github.com/llvm/llvm-project/pull/86712

>From 57eba6f8eb92c6f3c04e3c91535ccd678c1e33d6 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Tue, 26 Mar 2024 15:27:06 -0400
Subject: [PATCH] [AMDGPU] Fix missing `IsExact` flag when expanding vector
 binary operator

---
 llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
index bddf3d958a1ae6..3390462eb5caa0 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
@@ -1594,6 +1594,11 @@ bool AMDGPUCodeGenPrepareImpl::visitBinaryOperator(BinaryOperator &I) {
           }
         }
 
+        if (auto *NewEltI = dyn_cast<Instruction>(NewElt))
+          if (PossiblyExactOperator::isPossiblyExactOpcode(
+                  NewEltI->getOpcode()))
+            NewEltI->setIsExact(I.isExact());
+
         NewDiv = Builder.CreateInsertElement(NewDiv, NewElt, N);
       }
     } else {



More information about the llvm-commits mailing list