[llvm] [AMDGPU] Improve detection of non-null addrspacecast operands (PR #82311)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 00:25:53 PST 2024


================
@@ -2263,6 +2269,11 @@ bool AMDGPULegalizerInfo::legalizeAddrSpaceCast(
   const AMDGPUTargetMachine &TM
     = static_cast<const AMDGPUTargetMachine &>(MF.getTarget());
 
+  // For llvm.amdgcn.addrspacecast.nonnull we can always assume non-null, for
+  // G_ADDRSPACE_CAST we need to guess.
+  const bool IsKnownNonNull =
+      isa<GIntrinsic>(MI) ? true : isKnownNonNull(Src, MRI, TM, SrcAS);
----------------
arsenm wrote:

```suggestion
  const bool IsKnownNonNull =
      isa<GIntrinsic>(MI) || isKnownNonNull(Src, MRI, TM, SrcAS);
```

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


More information about the llvm-commits mailing list