Skip to content

Commit 2804643

Browse files
authored
[IR] Strip dead code post ConstExpr removals (NFC) (#139524)
Strip dead code in Operator.h related to the removal of several constant expressions. Note that PossiblyExactOperator can no longer be a ConstantExpr.
1 parent 5c084a1 commit 2804643

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/include/llvm/IR/Operator.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ class OverflowingBinaryOperator : public Operator {
134134
}
135135
static bool classof(const ConstantExpr *CE) {
136136
return CE->getOpcode() == Instruction::Add ||
137-
CE->getOpcode() == Instruction::Sub ||
138-
CE->getOpcode() == Instruction::Mul ||
139-
CE->getOpcode() == Instruction::Shl;
137+
CE->getOpcode() == Instruction::Sub;
140138
}
141139
static bool classof(const Value *V) {
142140
return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
@@ -150,7 +148,7 @@ struct OperandTraits<OverflowingBinaryOperator>
150148

151149
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(OverflowingBinaryOperator, Value)
152150

153-
/// A udiv or sdiv instruction, which can be marked as "exact",
151+
/// A udiv, sdiv, lshr, or ashr instruction, which can be marked as "exact",
154152
/// indicating that no bits are destroyed.
155153
class PossiblyExactOperator : public Operator {
156154
public:
@@ -182,15 +180,11 @@ class PossiblyExactOperator : public Operator {
182180
OpC == Instruction::LShr;
183181
}
184182

185-
static bool classof(const ConstantExpr *CE) {
186-
return isPossiblyExactOpcode(CE->getOpcode());
187-
}
188183
static bool classof(const Instruction *I) {
189184
return isPossiblyExactOpcode(I->getOpcode());
190185
}
191186
static bool classof(const Value *V) {
192-
return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
193-
(isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
187+
return (isa<Instruction>(V) && classof(cast<Instruction>(V)));
194188
}
195189
};
196190

0 commit comments

Comments
 (0)