[llvm] e833e58 - [ValueLattice] Remove unused DataLayout parameter of mergeIn, NFC
Aaron Puchert via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 04:35:21 PDT 2020
Author: Aaron Puchert
Date: 2020-04-14T13:32:53+02:00
New Revision: e833e583000ec3f5f5ce85523aa49adae3355144
URL: https://github.com/llvm/llvm-project/commit/e833e583000ec3f5f5ce85523aa49adae3355144
DIFF: https://github.com/llvm/llvm-project/commit/e833e583000ec3f5f5ce85523aa49adae3355144.diff
LOG: [ValueLattice] Remove unused DataLayout parameter of mergeIn, NFC
Reviewed By: fhahn, echristo
Differential Revision: https://reviews.llvm.org/D78061
Added:
Modified:
llvm/include/llvm/Analysis/ValueLattice.h
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/lib/Transforms/Scalar/SCCP.cpp
llvm/unittests/Analysis/ValueLatticeTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ValueLattice.h b/llvm/include/llvm/Analysis/ValueLattice.h
index b9ee103eb606..1c4683857f98 100644
--- a/llvm/include/llvm/Analysis/ValueLattice.h
+++ b/llvm/include/llvm/Analysis/ValueLattice.h
@@ -321,7 +321,7 @@ class ValueLatticeElement {
/// Updates this object to approximate both this object and RHS. Returns
/// true if this object has been changed.
- bool mergeIn(const ValueLatticeElement &RHS, const DataLayout &DL) {
+ bool mergeIn(const ValueLatticeElement &RHS) {
if (RHS.isUnknown() || isOverdefined())
return false;
if (RHS.isOverdefined()) {
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 4ad1795f613d..c2d0de3f15a4 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -747,7 +747,7 @@ bool LazyValueInfoImpl::solveBlockValueNonLocal(ValueLatticeElement &BBLV,
// Explore that input, then return here
return false;
- Result.mergeIn(EdgeResult, DL);
+ Result.mergeIn(EdgeResult);
// If we hit overdefined, exit early. The BlockVals entry is already set
// to overdefined.
@@ -791,7 +791,7 @@ bool LazyValueInfoImpl::solveBlockValuePHINode(ValueLatticeElement &BBLV,
// Explore that input, then return here
return false;
- Result.mergeIn(EdgeResult, DL);
+ Result.mergeIn(EdgeResult);
// If we hit overdefined, exit early. The BlockVals entry is already set
// to overdefined.
@@ -989,8 +989,8 @@ bool LazyValueInfoImpl::solveBlockValueSelect(ValueLatticeElement &BBLV,
}
ValueLatticeElement Result; // Start Undefined.
- Result.mergeIn(TrueVal, DL);
- Result.mergeIn(FalseVal, DL);
+ Result.mergeIn(TrueVal);
+ Result.mergeIn(FalseVal);
BBLV = Result;
return true;
}
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 0551120daece..9cb7f0695484 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -409,7 +409,7 @@ class SCCPSolver : public InstVisitor<SCCPSolver> {
markOverdefined(IV, V);
return true;
}
- if (IV.mergeIn(MergeWithV, DL)) {
+ if (IV.mergeIn(MergeWithV)) {
pushToWorkList(IV, V);
LLVM_DEBUG(dbgs() << "Merged " << MergeWithV << " into " << *V << " : "
<< IV << "\n");
@@ -743,7 +743,7 @@ void SCCPSolver::visitPHINode(PHINode &PN) {
continue;
ValueLatticeElement &Res = getValueState(&PN);
- Changed |= Res.mergeIn(IV, DL);
+ Changed |= Res.mergeIn(IV);
if (Res.isOverdefined())
break;
}
@@ -909,8 +909,8 @@ void SCCPSolver::visitSelectInst(SelectInst &I) {
ValueLatticeElement TVal = getValueState(I.getTrueValue());
ValueLatticeElement FVal = getValueState(I.getFalseValue());
- bool Changed = ValueState[&I].mergeIn(TVal, DL);
- Changed |= ValueState[&I].mergeIn(FVal, DL);
+ bool Changed = ValueState[&I].mergeIn(TVal);
+ Changed |= ValueState[&I].mergeIn(FVal);
if (Changed)
pushToWorkListMsg(ValueState[&I], &I);
}
diff --git a/llvm/unittests/Analysis/ValueLatticeTest.cpp b/llvm/unittests/Analysis/ValueLatticeTest.cpp
index 10477ca0b574..8ee2cf1ba34a 100644
--- a/llvm/unittests/Analysis/ValueLatticeTest.cpp
+++ b/llvm/unittests/Analysis/ValueLatticeTest.cpp
@@ -23,9 +23,6 @@ namespace {
class ValueLatticeTest : public testing::Test {
protected:
LLVMContext Context;
- Module M;
-
- ValueLatticeTest() : M("", Context) {}
};
TEST_F(ValueLatticeTest, ValueLatticeGetters) {
@@ -66,26 +63,26 @@ TEST_F(ValueLatticeTest, MergeIn) {
// Merge to lattice values with equal integer constant.
auto LV1 = ValueLatticeElement::get(C1);
- EXPECT_FALSE(LV1.mergeIn(ValueLatticeElement::get(C1), M.getDataLayout()));
+ EXPECT_FALSE(LV1.mergeIn(ValueLatticeElement::get(C1)));
EXPECT_TRUE(LV1.isConstantRange());
EXPECT_EQ(LV1.asConstantInteger().getValue().getLimitedValue(), 1U);
// Merge LV1 with
diff erent integer constant.
- EXPECT_TRUE(LV1.mergeIn(ValueLatticeElement::get(ConstantInt::get(I32Ty, 99)),
- M.getDataLayout()));
+ EXPECT_TRUE(
+ LV1.mergeIn(ValueLatticeElement::get(ConstantInt::get(I32Ty, 99))));
EXPECT_TRUE(LV1.isConstantRange());
EXPECT_EQ(LV1.getConstantRange().getLower().getLimitedValue(), 1U);
EXPECT_EQ(LV1.getConstantRange().getUpper().getLimitedValue(), 100U);
// Merge constant range with same constant range.
- EXPECT_FALSE(LV1.mergeIn(LV1, M.getDataLayout()));
+ EXPECT_FALSE(LV1.mergeIn(LV1));
EXPECT_TRUE(LV1.isConstantRange());
EXPECT_EQ(LV1.getConstantRange().getLower().getLimitedValue(), 1U);
EXPECT_EQ(LV1.getConstantRange().getUpper().getLimitedValue(), 100U);
// Merge LV1 in undefined value.
ValueLatticeElement LV2;
- EXPECT_TRUE(LV2.mergeIn(LV1, M.getDataLayout()));
+ EXPECT_TRUE(LV2.mergeIn(LV1));
EXPECT_TRUE(LV1.isConstantRange());
EXPECT_EQ(LV1.getConstantRange().getLower().getLimitedValue(), 1U);
EXPECT_EQ(LV1.getConstantRange().getUpper().getLimitedValue(), 100U);
@@ -94,13 +91,11 @@ TEST_F(ValueLatticeTest, MergeIn) {
EXPECT_EQ(LV2.getConstantRange().getUpper().getLimitedValue(), 100U);
// Merge LV1 with overdefined.
- EXPECT_TRUE(
- LV1.mergeIn(ValueLatticeElement::getOverdefined(), M.getDataLayout()));
+ EXPECT_TRUE(LV1.mergeIn(ValueLatticeElement::getOverdefined()));
EXPECT_TRUE(LV1.isOverdefined());
// Merge overdefined with overdefined.
- EXPECT_FALSE(
- LV1.mergeIn(ValueLatticeElement::getOverdefined(), M.getDataLayout()));
+ EXPECT_FALSE(LV1.mergeIn(ValueLatticeElement::getOverdefined()));
EXPECT_TRUE(LV1.isOverdefined());
}
@@ -165,8 +160,7 @@ TEST_F(ValueLatticeTest, getCompareFloat) {
EXPECT_TRUE(LV1.getCompare(CmpInst::FCMP_OGT, I1Ty, LV2)->isZeroValue());
EXPECT_TRUE(
- LV1.mergeIn(ValueLatticeElement::get(ConstantFP::get(FloatTy, 2.2)),
- M.getDataLayout()));
+ LV1.mergeIn(ValueLatticeElement::get(ConstantFP::get(FloatTy, 2.2))));
EXPECT_EQ(LV1.getCompare(CmpInst::FCMP_OEQ, I1Ty, LV2), nullptr);
EXPECT_EQ(LV1.getCompare(CmpInst::FCMP_OGE, I1Ty, LV2), nullptr);
EXPECT_EQ(LV1.getCompare(CmpInst::FCMP_OLE, I1Ty, LV2), nullptr);
More information about the llvm-commits
mailing list