[llvm][NFC] Dereferencing before cast-ing in ProfileSummaryInfoTest

Incorporated feedback from https://reviews.llvm.org/D78414
This commit is contained in:
Mircea Trofin 2020-04-18 17:47:37 -07:00
parent a5d161c119
commit 1586d0d382
1 changed files with 5 additions and 5 deletions

View File

@ -133,7 +133,7 @@ TEST_F(ProfileSummaryInfoTest, TestNoProfile) {
EXPECT_FALSE(PSI.isHotBlock(&BB0, &BFI));
EXPECT_FALSE(PSI.isColdBlock(&BB0, &BFI));
CallBase &CS1 = *cast<CallBase>(BB1->getFirstNonPHI());
CallBase &CS1 = cast<CallBase>(*BB1->getFirstNonPHI());
EXPECT_FALSE(PSI.isHotCallSite(CS1, &BFI));
EXPECT_FALSE(PSI.isColdCallSite(CS1, &BFI));
}
@ -227,9 +227,9 @@ TEST_F(ProfileSummaryInfoTest, InstrProf) {
EXPECT_TRUE(PSI.isColdBlockNthPercentile(10000, BB2, &BFI));
EXPECT_TRUE(PSI.isColdBlockNthPercentile(10000, BB3, &BFI));
CallBase &CS1 = *cast<CallBase>(BB1->getFirstNonPHI());
CallBase &CS1 = cast<CallBase>(*BB1->getFirstNonPHI());
auto *CI2 = BB2->getFirstNonPHI();
CallBase &CS2 = *cast<CallBase>(CI2);
CallBase &CS2 = cast<CallBase>(*CI2);
EXPECT_TRUE(PSI.isHotCallSite(CS1, &BFI));
EXPECT_FALSE(PSI.isHotCallSite(CS2, &BFI));
@ -322,14 +322,14 @@ TEST_F(ProfileSummaryInfoTest, SampleProf) {
EXPECT_TRUE(PSI.isColdBlockNthPercentile(10000, BB2, &BFI));
EXPECT_TRUE(PSI.isColdBlockNthPercentile(10000, BB3, &BFI));
CallBase &CS1 = *cast<CallBase>(BB1->getFirstNonPHI());
CallBase &CS1 = cast<CallBase>(*BB1->getFirstNonPHI());
auto *CI2 = BB2->getFirstNonPHI();
// Manually attach branch weights metadata to the call instruction.
SmallVector<uint32_t, 1> Weights;
Weights.push_back(1000);
MDBuilder MDB(M->getContext());
CI2->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights));
CallBase &CS2 = *cast<CallBase>(CI2);
CallBase &CS2 = cast<CallBase>(*CI2);
EXPECT_FALSE(PSI.isHotCallSite(CS1, &BFI));
EXPECT_TRUE(PSI.isHotCallSite(CS2, &BFI));