Skip to content

[IR] Strip dead code post ConstExpr removals (NFC) #139524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions llvm/include/llvm/IR/Operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Instruction>(V) && classof(cast<Instruction>(V))) ||
Expand All @@ -150,7 +148,7 @@ struct OperandTraits<OverflowingBinaryOperator>

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:
Expand Down Expand Up @@ -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<Instruction>(V) && classof(cast<Instruction>(V))) ||
(isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
return (isa<Instruction>(V) && classof(cast<Instruction>(V)));
}
};

Expand Down