diff --git a/llvm/include/llvm/Analysis/ValueLattice.h b/llvm/include/llvm/Analysis/ValueLattice.h --- a/llvm/include/llvm/Analysis/ValueLattice.h +++ b/llvm/include/llvm/Analysis/ValueLattice.h @@ -321,7 +321,7 @@ /// 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 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -747,7 +747,7 @@ // 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 @@ // 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 @@ } 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 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -409,7 +409,7 @@ 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 @@ continue; ValueLatticeElement &Res = getValueState(&PN); - Changed |= Res.mergeIn(IV, DL); + Changed |= Res.mergeIn(IV); if (Res.isOverdefined()) break; } @@ -909,8 +909,8 @@ 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 --- a/llvm/unittests/Analysis/ValueLatticeTest.cpp +++ b/llvm/unittests/Analysis/ValueLatticeTest.cpp @@ -23,9 +23,6 @@ class ValueLatticeTest : public testing::Test { protected: LLVMContext Context; - Module M; - - ValueLatticeTest() : M("", Context) {} }; TEST_F(ValueLatticeTest, ValueLatticeGetters) { @@ -66,26 +63,26 @@ // 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 different 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 @@ 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 @@ 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);