SampleProfile pass needs to be performed after InstructionCombiningPass, which helps eliminate un-inlinable function calls.
Details
Diff Detail
Event Timeline
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.
test/Transforms/SampleProfile/cov-zero-samples.ll | ||
---|---|---|
3 | Why did the discriminators change here? Was this because of instcombine? What did it do? | |
test/Transforms/SampleProfile/inline-coverage.ll | ||
19 | Likewise here. Why did the discriminators change? |
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?
test/Transforms/SampleProfile/cov-zero-samples.ll | ||
---|---|---|
3 | This is not changing discriminator but column number. | |
test/Transforms/SampleProfile/inline-coverage.ll | ||
19 | Same as above. |
With the patch, the AutoFDO compile time for the entire clang increased from 190min to 192min (user time), the it's ~1% increase
Why did the discriminators change here? Was this because of instcombine? What did it do?