Closed sharaelong closed 1 year ago
I found that usage of both heap2stack
and functioninline
pass makes runtime error in matmul2
.
Today, we found out that error was due to two reason. First returning :all in heap2stack passed incorrect analysis to other pass. Second spilled register in main function are accessed by the sp register but heap2stack update the sp so this caused incorrect output. This can be fixed by changing heap2stack to allocated stack memory at the beginning of the program.
Fairly simple logic(detecting block graph structure then inlining), so I have no doubt about this implementation.
LGTM!
I fixed bug that found on offline session: matmul2
main logic function is inlined even it is bigger than my threshold.
Fairly simple logic(detecting block graph structure then inlining), so I have no doubt about this implementation.
LGTM!
Actually, there was a bug!! haha... but it was subtle =)
Overview
This pull request implements function inline pass. Inliner pass is implemented in llvm already, but I tried to add architecture-dependent conditions for deciding whether this function has to be inlined or not. Specifically I considered these 3 properties:
Implementation
First iterate through all functions in module. Check basic inlining conditions and above criteria.
isInlineViable
to check callee can be inlinedNoInline
attribute, don't inline it.Unit tests
malloc_upto_8
. First tests is responsible for this.functionA
andfunctionB
calls each other.max
callsfact
internally. So onlymax
has to be inlined inmain
function.