[PATCH] D137407: [GlobalIsel] Handle carry output generated in narrowScalarAddSub legalize action

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 16:08:50 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:5128-5131
+  const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
+  for (MachineInstr &Use : MRI.use_instructions(CarryDst)) {
+    Use.substituteRegister(CarryDst, CarryIn, 0, *TRI);
+  }
----------------
yassingh wrote:
> arsenm wrote:
> > Changing the uses from here isn't the way the legalizer expects to work. Each instruction is legalized on its own without modifying other instructions, and using intermediate cast operations. The artifact combiner is then responsible for cleaning out illegal intermediate types 
> The artifact combiner is not automatically doing this. Can you direct where or how should I modify ArtifactCombiner? 
Re-reading the comment, I think I misunderstood what you were trying to do. In any case, it's inappropriate to be looking through use_instructions here. You should only be modifying  the original MI. If you're trying to only modify the one use in MI, you should change that operand directly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137407



More information about the llvm-commits mailing list