[llvm] [IR] Strip dead code post ConstExpr removals (NFC) (PR #139524)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 03:06:33 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
Strip dead code in Operator.h related to the removal of several constant expressions. Note that PossiblyExactOperator can no longer be a ConstantExpr.
---
Full diff: https://github.com/llvm/llvm-project/pull/139524.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/Operator.h (+3-9)
``````````diff
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<Instruction>(V) && classof(cast<Instruction>(V))) ||
@@ -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:
@@ -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)));
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/139524
More information about the llvm-commits
mailing list