Currently we didn't support multiple return type, we work around to use error_code to represent:
- The dangling probe.
- Ignore the weight of non-probe instruction
While merging the instructions' weight for the whole BB, it will filter out the error code. But If all instructions of the BB give error_code, the outside logic will mark it as a BB requiring the inference algorithm to infer its weight. This is different from the zero value which will be treated as a cold block.
Fix one place that if we can't find the FunctionSamples in the profile data which indicates the BB is cold, we choose to return zero.
Also refine the comments.
Given it more thought, perhaps whether this is 0 or error_code is subject to something like profile-sample-accurate? I.e. with that flag, it means cold, otherwise it means unknown (error_code)?
The default behavior for getInstWeight the AutoFDO counterpart is returning error_code here. We don't have to do it now, but may be both AutoFDO and CSSPGO can check profile-sample-accurate here to decide between 0 or error_code? @wmi what do you think about AutoFDO?