From 1586d0d38253be72e90b8494a57f546bd4e23b0f Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Sat, 18 Apr 2020 17:47:37 -0700 Subject: [PATCH] [llvm][NFC] Dereferencing before cast-ing in ProfileSummaryInfoTest Incorporated feedback from https://reviews.llvm.org/D78414 --- llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp b/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp index e3f2446fc395..ae60c4143548 100644 --- a/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp +++ b/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp @@ -133,7 +133,7 @@ TEST_F(ProfileSummaryInfoTest, TestNoProfile) { EXPECT_FALSE(PSI.isHotBlock(&BB0, &BFI)); EXPECT_FALSE(PSI.isColdBlock(&BB0, &BFI)); - CallBase &CS1 = *cast(BB1->getFirstNonPHI()); + CallBase &CS1 = cast(*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(BB1->getFirstNonPHI()); + CallBase &CS1 = cast(*BB1->getFirstNonPHI()); auto *CI2 = BB2->getFirstNonPHI(); - CallBase &CS2 = *cast(CI2); + CallBase &CS2 = cast(*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(BB1->getFirstNonPHI()); + CallBase &CS1 = cast(*BB1->getFirstNonPHI()); auto *CI2 = BB2->getFirstNonPHI(); // Manually attach branch weights metadata to the call instruction. SmallVector Weights; Weights.push_back(1000); MDBuilder MDB(M->getContext()); CI2->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); - CallBase &CS2 = *cast(CI2); + CallBase &CS2 = cast(*CI2); EXPECT_FALSE(PSI.isHotCallSite(CS1, &BFI)); EXPECT_TRUE(PSI.isHotCallSite(CS2, &BFI));