[PATCH] D116399: [AVR] Fix a bug of register allocation

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 30 04:04:22 PST 2021


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp:378
+      ResNode =
+          CurDAG->getMachineNode(AVR::LPMRdZ, DL, MVT::i8, MVT::Other, Ptr);
       break;
----------------
The deleted operand `RegZ` triggered the `ran out of register`  error, actually we need not spiecify any implicit operands when calling `getMachineNode`.


================
Comment at: llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp:393
   ReplaceUses(SDValue(N, 0), SDValue(ResNode, 0));
   ReplaceUses(SDValue(N, 1), SDValue(ResNode, 1));
   CurDAG->RemoveDeadNode(N);
----------------
We already have `ReplaceUses(SDValue(N, 1), SDValue(ResNode, 1));` in the end of this function, any same lines in other places of current function `AVRDAGToDAGISel::select<ISD::LOAD>(SDNode *N)` are deleted.


================
Comment at: llvm/test/CodeGen/AVR/lpmx.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=avr --mcpu=atmega328 -O0 | FileCheck %s
+
----------------
`-O1` / `-O2` / `-O3` are normal, and only `-O0` triggers the error.


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

https://reviews.llvm.org/D116399



More information about the llvm-commits mailing list