Profiling problems in the main function #114
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During profiling, LLFI tries to inject endProfiling callback functions at the end of the main function.
In the original codes, LLFI obtains the last instruction in the last basic block and injects endProfiling before the last instruction. It's generally true in most cases but in some cases the return/unreachable instruction is not always in the last instruction in the last basic block.
In my case, the return instruction is in the BB that is before the last BB in the main function. Therefore, to handle this problem, we'll check if the instruction obtained is return or unreachable instruction. If it's not, then iterate through all the functions in main() to find the real return/unreachable instruction.
One issue occurred after the modification is not yet solved.
When we turn on the "tracingPropagation" option in input.yaml and run the instrumentation, there will be error regarding to the violation of SSA form in LLVM.