[PATCH] D155046: [RISCV] Clear kill flags when forming FMA instructions in MachineCombiner.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 00:04:31 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: asb, reames, asi-sc.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: wangpc, eopXD, MaskRay.
Herald added a project: LLVM.

If the operands to the mul have other uses we may be extending their
live range past a kill flag.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155046

Files:
  llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
  llvm/test/CodeGen/RISCV/machine-combiner.mir


Index: llvm/test/CodeGen/RISCV/machine-combiner.mir
===================================================================
--- llvm/test/CodeGen/RISCV/machine-combiner.mir
+++ llvm/test/CodeGen/RISCV/machine-combiner.mir
@@ -1,5 +1,5 @@
 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
-# RUN: llc %s -mtriple=riscv64 -mattr=+f -run-pass=machine-combiner \
+# RUN: llc %s -o - -mtriple=riscv64 -mattr=+f -run-pass=machine-combiner \
 # RUN:   -verify-machineinstrs | FileCheck %s
 
 --- |
Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1659,6 +1659,9 @@
   bool Mul2IsKill = Mul2.isKill();
   bool AddendIsKill = Addend.isKill();
 
+  // We need to clear kill flags since we may be extending the live range past
+  // a kill. If the mul had kill flags, we can preserve those since we know
+  // where the previous range stopped.
   MRI.clearKillFlags(Mul1.getReg());
   MRI.clearKillFlags(Mul2.getReg());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155046.539408.patch
Type: text/x-patch
Size: 1119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/4a7add08/attachment.bin>


More information about the llvm-commits mailing list