[PATCH] D142107: [AVR] Support address space casts

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 18:15:44 PST 2023


aykevl added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRTargetMachine.h:57
+    // pointers.
+    return getPointerSize(SrcAs) == getPointerSize(DestAs);
+  }
----------------
benshi001 wrote:
> it would be better to also check the range, something like
> 
> ```
>    return SrcAs < AVR::NumAddrSpaces && DestAs < AVR::NumAddrSpaces &&
>           getPointerSize(SrcAs) == getPointerSize(DestAs);
> ```
Please take a look at other architecture. Most of them make this a no-op without constraints, like here on ARM:

```
  /// Returns true if a cast between SrcAS and DestAS is a noop.
  bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
    // Addrspacecasts are always noops.
    return true;
  }
```

Why would AVR be different?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142107/new/

https://reviews.llvm.org/D142107



More information about the llvm-commits mailing list