[llvm] 9d9bd76 - [RISCV] Check dead flag on VL def op in RISCVCoalesceVSETVLI. NFC (#91168)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 09:02:46 PDT 2024


Author: Luke Lau
Date: 2024-05-07T00:02:42+08:00
New Revision: 9d9bd76458ebc7c842c200982cfa0a490ccbe8cf

URL: https://github.com/llvm/llvm-project/commit/9d9bd76458ebc7c842c200982cfa0a490ccbe8cf
DIFF: https://github.com/llvm/llvm-project/commit/9d9bd76458ebc7c842c200982cfa0a490ccbe8cf.diff

LOG: [RISCV] Check dead flag on VL def op in RISCVCoalesceVSETVLI. NFC (#91168)

Because LiveVariables has been run, we no longer need to lookup the
users in MachineRegisterInfo anymore and can instead just check for the
dead flag.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 216dc78085204e..eaebdc2e54bef4 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -1600,9 +1600,7 @@ bool RISCVCoalesceVSETVLI::coalesceVSETVLIs(MachineBasicBlock &MBB) {
       continue;
     }
 
-    Register RegDef = MI.getOperand(0).getReg();
-    assert(RegDef == RISCV::X0 || RegDef.isVirtual());
-    if (RegDef != RISCV::X0 && !MRI->use_nodbg_empty(RegDef))
+    if (!MI.getOperand(0).isDead())
       Used.demandVL();
 
     if (NextMI) {


        


More information about the llvm-commits mailing list