[llvm] [AMDGPU] Folding imm offset in more cases for scratch access (PR #70634)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 18:02:55 PST 2023


================
@@ -4486,14 +4494,67 @@ bool AMDGPUInstructionSelector::isDSOffset2Legal(Register Base, int64_t Offset0,
   return KB->signBitIsZero(Base);
 }
 
+// Whether we can infer the operands are non-negative if the result is
+// non-negative.
+bool canInferNonNegativeOperands(MachineInstr *Addr) {
+  return Addr->getOpcode() == TargetOpcode::G_OR ||
+         (Addr->getOpcode() == TargetOpcode::G_PTR_ADD &&
+          Addr->getFlag(MachineInstr::NoUWrap));
+};
----------------
ruiling wrote:

Maybe just `isNoUnsignedWrap`?

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


More information about the llvm-commits mailing list