[llvm] 0e24c32 - [SCCP] Avoid some uses of SCCPSolver::isOverdefined (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 08:15:15 PDT 2024
Author: Nikita Popov
Date: 2024-08-26T17:15:07+02:00
New Revision: 0e24c32a6d6659fb4aa61ad52f068dbf6cb685c7
URL: https://github.com/llvm/llvm-project/commit/0e24c32a6d6659fb4aa61ad52f068dbf6cb685c7
DIFF: https://github.com/llvm/llvm-project/commit/0e24c32a6d6659fb4aa61ad52f068dbf6cb685c7.diff
LOG: [SCCP] Avoid some uses of SCCPSolver::isOverdefined (NFCI)
This is a confusingly named helper than means "is not unknown,
undef or constant". Prefer the more obvious ValueLattice API
instead. Most of these checks are for values which are forced to
overdefined by undef resolution, in which case only actual
overdefined values are relevant.
Added:
Modified:
llvm/lib/Transforms/Utils/SCCPSolver.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index 670d88ac7cf8fa..c6f355a07d9c7f 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -1364,7 +1364,7 @@ void SCCPInstVisitor::visitInsertValueInst(InsertValueInst &IVI) {
// resolvedUndefsIn might mark I as overdefined. Bail out, even if we would
// discover a concrete value later.
- if (SCCPSolver::isOverdefined(ValueState[&IVI]))
+ if (ValueState[&IVI].isOverdefined())
return (void)markOverdefined(&IVI);
// If this has more than one index, we can't handle it, drive all results to
@@ -1436,7 +1436,7 @@ void SCCPInstVisitor::visitUnaryOperator(Instruction &I) {
ValueLatticeElement &IV = ValueState[&I];
// resolvedUndefsIn might mark I as overdefined. Bail out, even if we would
// discover a concrete value later.
- if (SCCPSolver::isOverdefined(IV))
+ if (IV.isOverdefined())
return (void)markOverdefined(&I);
// If something is unknown/undef, wait for it to resolve.
@@ -1461,7 +1461,7 @@ void SCCPInstVisitor::visitFreezeInst(FreezeInst &I) {
ValueLatticeElement &IV = ValueState[&I];
// resolvedUndefsIn might mark I as overdefined. Bail out, even if we would
// discover a concrete value later.
- if (SCCPSolver::isOverdefined(IV))
+ if (IV.isOverdefined())
return (void)markOverdefined(&I);
// If something is unknown/undef, wait for it to resolve.
@@ -1541,7 +1541,7 @@ void SCCPInstVisitor::visitBinaryOperator(Instruction &I) {
void SCCPInstVisitor::visitCmpInst(CmpInst &I) {
// Do not cache this lookup, getValueState calls later in the function might
// invalidate the reference.
- if (SCCPSolver::isOverdefined(ValueState[&I]))
+ if (ValueState[&I].isOverdefined())
return (void)markOverdefined(&I);
Value *Op1 = I.getOperand(0);
@@ -1571,7 +1571,7 @@ void SCCPInstVisitor::visitCmpInst(CmpInst &I) {
// Handle getelementptr instructions. If all operands are constants then we
// can turn this into a getelementptr ConstantExpr.
void SCCPInstVisitor::visitGetElementPtrInst(GetElementPtrInst &I) {
- if (SCCPSolver::isOverdefined(ValueState[&I]))
+ if (ValueState[&I].isOverdefined())
return (void)markOverdefined(&I);
SmallVector<Constant *, 8> Operands;
@@ -1582,9 +1582,6 @@ void SCCPInstVisitor::visitGetElementPtrInst(GetElementPtrInst &I) {
if (State.isUnknownOrUndef())
return; // Operands are not resolved yet.
- if (SCCPSolver::isOverdefined(State))
- return (void)markOverdefined(&I);
-
if (Constant *C = getConstant(State, I.getOperand(i)->getType())) {
Operands.push_back(C);
continue;
More information about the llvm-commits
mailing list