[PATCH] D150388: [CodeGen]Allow targets to use target specific COPY instructions for live range splitting

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 10:12:59 PDT 2023


arsenm added a comment.

In D150388#4504380 <https://reviews.llvm.org/D150388#4504380>, @vitalybuka wrote:

> @@ -1038,10 +1038,10 @@
>
>   /// registers as machine operands, for all other instructions the method calls
>   /// target-dependent implementation.
>   std::optional<DestSourcePair> isCopyInstr(const MachineInstr &MI) const {
>
> - if (MI.isCopy()) {
> - return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
> - }
> - return isCopyInstrImpl(MI);
>
> +    // if (MI.isCopy()) {
> +    return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
> +    // }
> +    // return isCopyInstrImpl(MI);
>
>   }
>    
>   bool isFullCopyInstr(const MachineInstr &MI) const {
>
>   But clang crashes when I use it to build the target test (and many other targets), I can't include the exact stack trace. But maybe you meant something else by your suggestion? 
>
> 1. <eof> parser at end of file
> 2. Code generation
> 3. Running pass 'Function Pass Manager' on module $xyz.
> 4. Running pass 'Greedy Register Allocator' on function
>
>   Target: x86_64-grtev4-linux-gnu
>   
>   I'm still working on a repro.

Yes, this would just crash. You want:

     std::optional<DestSourcePair> isCopyInstr(const MachineInstr &MI) const {
     if (MI.isCopy()) {
      return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
    return std::nullopt;
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150388



More information about the llvm-commits mailing list