[llvm] 6f69f8c - [IR] Use Instruction::isBinaryOp to simplify code. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 4 22:42:22 PST 2025


Author: Craig Topper
Date: 2025-01-04T22:33:10-08:00
New Revision: 6f69f8c9fe57a44939fd111f52b6d8e267a46602

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

LOG: [IR] Use Instruction::isBinaryOp to simplify code. NFC

Added: 
    

Modified: 
    llvm/lib/IR/ConstantsContext.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index aaaab0b7a918a4..08bf3f9dff5e66 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -491,8 +491,7 @@ struct ConstantExprKeyType {
     default:
       if (Instruction::isCast(Opcode))
         return new CastConstantExpr(Opcode, Ops[0], Ty);
-      if ((Opcode >= Instruction::BinaryOpsBegin &&
-           Opcode < Instruction::BinaryOpsEnd))
+      if (Instruction::isBinaryOp(Opcode))
         return new BinaryConstantExpr(Opcode, Ops[0], Ops[1],
                                       SubclassOptionalData);
       llvm_unreachable("Invalid ConstantExpr!");


        


More information about the llvm-commits mailing list