[llvm] 5d3a864 - [GlobalISel] Move getOpcode() calls inside assert() to avoid (void)s. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 01:50:37 PST 2022


Author: Simon Pilgrim
Date: 2022-02-07T09:50:27Z
New Revision: 5d3a86489f8ff09734c81398d5c29969113132d1

URL: https://github.com/llvm/llvm-project/commit/5d3a86489f8ff09734c81398d5c29969113132d1
DIFF: https://github.com/llvm/llvm-project/commit/5d3a86489f8ff09734c81398d5c29969113132d1.diff

LOG: [GlobalISel] Move getOpcode() calls inside assert() to avoid (void)s. NFC.

Tidier solution to the unused variable warnings - we already do this in other places in this file.

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index ef5cb1c16309..8e72bdda481a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -4618,9 +4618,8 @@ bool CombinerHelper::matchMulOBy2(MachineInstr &MI, BuildFnTy &MatchInfo) {
 
 bool CombinerHelper::matchMulOBy0(MachineInstr &MI, BuildFnTy &MatchInfo) {
   // (G_*MULO x, 0) -> 0 + no carry out
-  unsigned Opc = MI.getOpcode();
-  (void)Opc;
-  assert(Opc == TargetOpcode::G_UMULO || Opc == TargetOpcode::G_SMULO);
+  assert(MI.getOpcode() == TargetOpcode::G_UMULO ||
+         MI.getOpcode() == TargetOpcode::G_SMULO);
   if (!mi_match(MI.getOperand(3).getReg(), MRI, m_SpecificICstOrSplat(0)))
     return false;
   Register Dst = MI.getOperand(0).getReg();
@@ -4637,9 +4636,8 @@ bool CombinerHelper::matchMulOBy0(MachineInstr &MI, BuildFnTy &MatchInfo) {
 
 bool CombinerHelper::matchAddOBy0(MachineInstr &MI, BuildFnTy &MatchInfo) {
   // (G_*ADDO x, 0) -> x + no carry out
-  unsigned Opc = MI.getOpcode();
-  (void)Opc;
-  assert(Opc == TargetOpcode::G_UADDO || Opc == TargetOpcode::G_SADDO);
+  assert(MI.getOpcode() == TargetOpcode::G_UADDO ||
+         MI.getOpcode() == TargetOpcode::G_SADDO);
   if (!mi_match(MI.getOperand(3).getReg(), MRI, m_SpecificICstOrSplat(0)))
     return false;
   Register Carry = MI.getOperand(1).getReg();


        


More information about the llvm-commits mailing list