[llvm] [AMDGPU][CodeGen] Update support (soffset + offset) s_buffer_load's (PR #68302)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 07:57:51 PDT 2023


================
@@ -33,6 +33,11 @@ AMDGPU::getBaseWithConstantOffset(MachineRegisterInfo &MRI, Register Reg,
 
   int64_t Offset;
   if (Def->getOpcode() == TargetOpcode::G_ADD) {
+    // A 32-bit (address + offset) should not cause unsigned 32-bit integer
+    // wraparound, because s_load instructions perform the addition in 64 bits.
+    if (!Def->getFlag(MachineInstr::NoUWrap) &&
+        MRI.getType(Reg).getScalarSizeInBits() == 32 && checkNUW)
----------------
arsenm wrote:

Capitalize checkNUW and move it first to be next to the !nuw part 

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


More information about the llvm-commits mailing list