1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[ValueLattice] Remove unused DataLayout parameter of mergeIn, NFC

Reviewed By: fhahn, echristo

Differential Revision: https://reviews.llvm.org/D78061
This commit is contained in:
Aaron Puchert 2020-04-14 13:32:43 +02:00
parent 180c8196c1
commit ac540cb0fe
4 changed files with 17 additions and 23 deletions

View File

@ -321,7 +321,7 @@ public:
/// 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()) {

View File

@ -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;
}

View File

@ -409,7 +409,7 @@ private:
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);
}

View File

@ -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 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 @@ 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);