[PATCH] D141188: [MergeICmps] Adapt to non-eq comparisons
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 04:57:00 PST 2023
Allen added a comment.
For the runtime fails of unittests/ProfileData/ProfileDataTests, there is 2 points important
- a) build without -g fall as it transform code (From function _ZN12_GLOBAL__N_152CoverageMappingTest_test_line_coverage_iterator_Test8TestBodyEv)
_ZNK4llvm14iterator_rangeINS_8coverage20LineCoverageIteratorEE3endEv.exit: ; preds = %_ZNK4llvm14iterator_rangeINS_8coverage20LineCoverageIteratorEE5beginEv.exit, %if.then.i.i.i294
%Stats.i.i295 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 6
%Stats4.i.i296 = getelementptr inbounds %"class.llvm::iterator_range", ptr %ref.tmp32, i64 0, i32 1, i32 6
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %Stats.i.i295, ptr noundef nonnull align 8 dereferenceable(40) %Stats4.i.i296, i64 40, i1 false), !tbaa.struct !339
%Next.i.i299 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 2
%Next3.i.i = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 2
%Ended.i.i301 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 3
%Ended4.i.i = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 3
%Line.i = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 6, i32 3
%message_.i320 = getelementptr inbounds %"class.testing::AssertionResult", ptr %gtest_ar35, i64 0, i32 1
%message_.i386 = getelementptr inbounds %"class.testing::AssertionResult", ptr %gtest_ar55, i64 0, i32 1
br label %for.cond
for.cond: ; preds = %_ZN7testing15AssertionResultD2Ev.exit392, %_ZNK4llvm14iterator_rangeINS_8coverage20LineCoverageIteratorEE3endEv.exit
%340 = load ptr, ptr %__begin1, align 8, !tbaa !340
%341 = load ptr, ptr %__end1, align 8, !tbaa !340
%cmp.i.i298 = icmp eq ptr %340, %341
br i1 %cmp.i.i298, label %land.lhs.true.i.i, label %_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit
land.lhs.true.i.i: ; preds = %for.cond
%342 = load ptr, ptr %Next.i.i299, align 8, !tbaa !48
%343 = load ptr, ptr %Next3.i.i, align 8, !tbaa !48
%cmp.i.i.i300 = icmp eq ptr %342, %343
br i1 %cmp.i.i.i300, label %land.rhs.i.i, label %_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit
land.rhs.i.i: ; preds = %land.lhs.true.i.i
%344 = load i8, ptr %Ended.i.i301, align 8, !tbaa !333, !range !18, !noundef !19
%345 = load i8, ptr %Ended4.i.i, align 8, !tbaa !333, !range !18, !noundef !19
%cmp7.i.i = icmp ne i8 %344, %345
br label %_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit
_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit: ; preds = %for.cond, %land.lhs.true.i.i, %land.rhs.i.i
%lnot.i = phi i1 [ true, %land.lhs.true.i.i ], [ true, %for.cond ], [ %cmp7.i.i, %land.rhs.i.i ]
br i1 %lnot.i, label %for.body, label %for.end.critedge
into a %memcmp, and the detail code shows as following
_ZNK4llvm14iterator_rangeINS_8coverage20LineCoverageIteratorEE3endEv.exit: ; preds = %_ZNK4llvm14iterator_rangeINS_8coverage20LineCoverageIteratorEE5beginEv.exit, %if.then.i.i.i294
%Stats.i.i295 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 6
%Stats4.i.i296 = getelementptr inbounds %"class.llvm::iterator_range", ptr %ref.tmp32, i64 0, i32 1, i32 6
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %Stats.i.i295, ptr noundef nonnull align 8 dereferenceable(40) %Stats4.i.i296, i64 40, i1 false), !tbaa.struct !339
%Next.i.i299 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 2
%Next3.i.i = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 2
%Ended.i.i301 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 3
%Ended4.i.i = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 3
%Line.i = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 6, i32 3
%message_.i320 = getelementptr inbounds %"class.testing::AssertionResult", ptr %gtest_ar35, i64 0, i32 1
%message_.i386 = getelementptr inbounds %"class.testing::AssertionResult", ptr %gtest_ar55, i64 0, i32 1
br label %for.cond582
for.cond582: ; preds = %_ZNK4llvm14iterator_rangeINS_8coverage20LineCoverageIteratorEE3endEv.exit, %_ZN7testing15AssertionResultD2Ev.exit392
%338 = load ptr, ptr %__begin1, align 8
%339 = load ptr, ptr %__end1, align 8
%340 = icmp ne ptr %338, %339
br i1 %340, label %"land.lhs.true.i.i+land.rhs.i.i", label %_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit
"land.lhs.true.i.i+land.rhs.i.i": ; preds = %for.cond582
%341 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__begin1, i64 0, i32 2
%342 = getelementptr inbounds %"class.llvm::coverage::LineCoverageIterator", ptr %__end1, i64 0, i32 2
%memcmp = call i32 @memcmp(ptr %341, ptr %342, i64 9)
%343 = icmp ne i32 %memcmp, 0
br label %_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit
_ZNK4llvm20iterator_facade_baseINS_8coverage20LineCoverageIteratorESt20forward_iterator_tagKNS1_17LineCoverageStatsElPS5_RS5_EneERKS2_.exit: ; preds = %for.cond582, %"land.lhs.true.i.i+land.rhs.i.i"
%lnot.i = phi i1 [ %343, %"land.lhs.true.i.i+land.rhs.i.i" ], [ false, %for.cond582 ]
br i1 %lnot.i, label %for.body, label %for.end.critedge
2. b) build with out -g is because **Comparison->doesOtherWork()** in function BCECmpChain::BCECmpChain return false as some **call void @llvm.dbg.value**, which is not exist when build without -g.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141188/new/
https://reviews.llvm.org/D141188
More information about the llvm-commits
mailing list