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

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 11:03:24 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));
+};
----------------
nhaehnle wrote:

Extraneous ;

Same observation about the function name: should probably be `canInferNoUnsignedWrap`

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


More information about the llvm-commits mailing list