[llvm] 1586d0d - [llvm][NFC] Dereferencing before cast-ing in ProfileSummaryInfoTest
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 17:49:46 PDT 2020
Author: Mircea Trofin
Date: 2020-04-18T17:47:37-07:00
New Revision: 1586d0d38253be72e90b8494a57f546bd4e23b0f
URL: https://github.com/llvm/llvm-project/commit/1586d0d38253be72e90b8494a57f546bd4e23b0f
DIFF: https://github.com/llvm/llvm-project/commit/1586d0d38253be72e90b8494a57f546bd4e23b0f.diff
LOG: [llvm][NFC] Dereferencing before cast-ing in ProfileSummaryInfoTest
Incorporated feedback from https://reviews.llvm.org/D78414
Added:
Modified:
llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp
Removed:
################################################################################
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<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));
More information about the llvm-commits
mailing list