Hi all, I'm looking for some program analysis techniques which help me to find potential functions to execute next, from the current executing function. I want to decision based on compile time information. I consider LLVM IR is too low-level to make such analysis. So, I using call graph representation of module. I figured out the probability of function which execute next based on the branch predictor, Call instruction distance from the entry of function. I believe that many attributes can be derived from higher level program representation. Is there any similar work done like this? LLVM already support analysis for this? -- Have a great day! PreeJackie -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190328/625a8648/attachment.html>
Bekket McClane via llvm-dev
2019-Mar-28 18:46 UTC
[llvm-dev] Higher level program analysis
Hi PreeJackie, I still have difficulties associating ‘higher level program analysis’ with the possible candidate functions that will be executed next. Call graph will definitely be your tools(and actually it’s usually not considered ‘high level’), and function attributes might help. But AFAIC, there is little ‘high level’ language constructions that can help us determinate the possible functions executed next. Maybe you can give us some examples? Best, Bekket> On Mar 27, 2019, at 8:55 PM, preejackie via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi all, > > I'm looking for some program analysis techniques which help me to find potential functions to execute next, from the current executing function. I want to decision based on compile time information. I consider LLVM IR is too low-level to make such analysis. So, I using call graph representation of module. I figured out the probability of function which execute next based on the branch predictor, Call instruction distance from the entry of function. I believe that many attributes can be derived from higher level program representation. Is there any similar work done like this? LLVM already support analysis for this? > > -- > Have a great day! > PreeJackie > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190328/58f9e8f4/attachment.html>
Devirtualization is an example of predicting calls and is much more easily done on a higher-level representation. It is simply easier to reason about certain things given information that is lost during translation to LLVM IR. The MLIR project makes similar arguments. It would be helpful to know what's being attempted here. I'm not sure what the (hardware?) branch predictor has to do with making decisions based compile-time information, unless some kind of PGO is being used. I could imagine something that takes branch probabilities and guesses the most likely path through a function, thus predicting certain calls will happen over others. -David Bekket McClane via llvm-dev <llvm-dev at lists.llvm.org> writes:> Hi PreeJackie, > > I still have difficulties associating ‘higher level program analysis’ with the possible candidate functions that will be executed next. > Call graph will definitely be your tools(and actually it’s usually not considered ‘high level’), and function attributes might help. But AFAIC, there is little ‘high level’ > language constructions that can help us determinate the possible functions executed next. > Maybe you can give us some examples? > > Best, > Bekket > > On Mar 27, 2019, at 8:55 PM, preejackie via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi all, > > I'm looking for some program analysis techniques which help me to find potential functions to execute next, from the current executing function. I want to > decision based on compile time information. I consider LLVM IR is too low-level to make such analysis. So, I using call graph representation of module. I > figured out the probability of function which execute next based on the branch predictor, Call instruction distance from the entry of function. I believe that > many attributes can be derived from higher level program representation. Is there any similar work done like this? LLVM already support analysis for this?