[llvm] [AMDGPU][GlobalISel] Save a copy in one case of addrspacecast (PR #104789)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 03:55:13 PDT 2024


================
@@ -2368,25 +2368,30 @@ bool AMDGPULegalizerInfo::legalizeAddrSpaceCast(
   if (DestAS == AMDGPUAS::FLAT_ADDRESS &&
       (SrcAS == AMDGPUAS::LOCAL_ADDRESS ||
        SrcAS == AMDGPUAS::PRIVATE_ADDRESS)) {
-    Register ApertureReg = getSegmentAperture(SrcAS, MRI, B);
-    if (!ApertureReg.isValid())
-      return false;
+    auto castLocalOrPrivateToFlat = [&](const DstOp &Dst) -> Register {
+      Register ApertureReg = getSegmentAperture(SrcAS, MRI, B);
+      if (!ApertureReg.isValid())
+        return false;
----------------
jayfoad wrote:

I guess I've broken this error case but I don't understand when it would ever happen.

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


More information about the llvm-commits mailing list