From 3b439a71e552f859a5cc4e890edd3883b84d31f2 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 12 May 2025 10:42:02 +0100 Subject: [PATCH] [IR] Strip dead code post ConstExpr removals (NFC) Strip dead code in Operator.h related to the removal of several constant expressions. Note that PossiblyExactOperator can no longer be a ConstantExpr. --- llvm/include/llvm/IR/Operator.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h index 4d77860be994e..38f84647ec74e 100644 --- a/llvm/include/llvm/IR/Operator.h +++ b/llvm/include/llvm/IR/Operator.h @@ -134,9 +134,7 @@ class OverflowingBinaryOperator : public Operator { } static bool classof(const ConstantExpr *CE) { return CE->getOpcode() == Instruction::Add || - CE->getOpcode() == Instruction::Sub || - CE->getOpcode() == Instruction::Mul || - CE->getOpcode() == Instruction::Shl; + CE->getOpcode() == Instruction::Sub; } static bool classof(const Value *V) { return (isa(V) && classof(cast(V))) || @@ -150,7 +148,7 @@ struct OperandTraits DEFINE_TRANSPARENT_OPERAND_ACCESSORS(OverflowingBinaryOperator, Value) -/// A udiv or sdiv instruction, which can be marked as "exact", +/// A udiv, sdiv, lshr, or ashr instruction, which can be marked as "exact", /// indicating that no bits are destroyed. class PossiblyExactOperator : public Operator { public: @@ -182,15 +180,11 @@ class PossiblyExactOperator : public Operator { OpC == Instruction::LShr; } - static bool classof(const ConstantExpr *CE) { - return isPossiblyExactOpcode(CE->getOpcode()); - } static bool classof(const Instruction *I) { return isPossiblyExactOpcode(I->getOpcode()); } static bool classof(const Value *V) { - return (isa(V) && classof(cast(V))) || - (isa(V) && classof(cast(V))); + return (isa(V) && classof(cast(V))); } };