[llvm] ec5ba35 - [Hexagon][NFC] Remove redundant condition

Adam Balogh via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 00:02:13 PDT 2020


Author: Adam Balogh
Date: 2020-07-01T09:04:26+02:00
New Revision: ec5ba353fab79d2201f63485117682756da31d46

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

LOG: [Hexagon][NFC] Remove redundant condition

Condition `secondReg` is checked both in an outer and in an inner `if`
statement in static function `canCompareBeNewValueJump()` in file
`HexagonNewValueJump.cpp`. This patch removes the redundant inner check.

The issue was found using `clang-tidy` check under review
`misc-redundant-condition`. See https://reviews.llvm.org/D81272.

Differential Revision: https://reviews.llvm.org/D82556

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp b/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp
index e3579dfa9ba9..8dc1113194a8 100644
--- a/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp
@@ -291,7 +291,7 @@ static bool canCompareBeNewValueJump(const HexagonInstrInfo *QII,
     // at machine code level, we don't need this, but if we decide
     // to move new value jump prior to RA, we would be needing this.
     MachineRegisterInfo &MRI = MF.getRegInfo();
-    if (secondReg && !Register::isPhysicalRegister(cmpOp2)) {
+    if (!Register::isPhysicalRegister(cmpOp2)) {
       MachineInstr *def = MRI.getVRegDef(cmpOp2);
       if (def->getOpcode() == TargetOpcode::COPY)
         return false;


        


More information about the llvm-commits mailing list