[PATCH] D17742: Perform InstructioinCombiningPass before SampleProfile pass.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 11:39:56 PST 2016


danielcdh added a comment.

In http://reviews.llvm.org/D17742#365240, @dnovillo wrote:

> Could you give me a bit more context?  A C/C++ motivating example would be great.  I think I follow what the intent is, but I'd like to make sure and leave it documented in the commit log.
>
> Thanks.


This is observed from compiling clang (FoldingSet) itself. The function is llvm::FoldingSetNodeID::~FoldingSetNodeID()

opt -S FoldingSet.bc |grep "call.*bit"
======================================

  call void bitcast (void (%"class.llvm::SmallVectorImpl"*)* @_ZN4llvm15SmallVectorImplIjED2Ev to void (%"class.llvm::SmallVector"*)*)(%"class.llvm::SmallVector"* %3) #7, !dbg !4175

I just spent ~2 hours to generate a small C++ file to produce this "call with bitcast" pattern, but whatever I tried, front end will not give me exactly the same pattern. Shall I just keep the record in the commit log about how to reproduce with FoldingSet.bc?


================
Comment at: test/Transforms/SampleProfile/cov-zero-samples.ll:3
@@ -2,3 +2,3 @@
 ;
-; CHECK: remark: cov-zero-samples.cc:9:25: Applied 404065 samples from profile (offset: 2.1)
+; CHECK: remark: cov-zero-samples.cc:9:29: Applied 404065 samples from profile (offset: 2.1)
 ; CHECK: remark: cov-zero-samples.cc:10:9: Applied 443089 samples from profile (offset: 3)
----------------
dnovillo wrote:
> Why did the discriminators change here?  Was this because of instcombine?  What did it do?
This is not changing discriminator but column number.
inst-combine optimized the code to combine some instructions together and used the LOC of one instruction as the new instruction's LOC.

================
Comment at: test/Transforms/SampleProfile/inline-coverage.ll:19
@@ -18,3 +18,3 @@
 ; CHECK: remark: coverage.cc:10:12: inlined hot callee '_Z3fool' with 172746 samples into 'main'
-; CHECK: remark: coverage.cc:9:19: Applied 23478 samples from profile (offset: 2.1)
+; CHECK: remark: coverage.cc:9:21: Applied 23478 samples from profile (offset: 2.1)
 ; CHECK: remark: coverage.cc:10:16: Applied 23478 samples from profile (offset: 3)
----------------
dnovillo wrote:
> Likewise here.  Why did the discriminators change?
Same as above.


http://reviews.llvm.org/D17742





More information about the llvm-commits mailing list