[LLVMdev] How to decide whether a function is executed or not
Renato Golin
renato.golin at linaro.org
Tue May 20 08:26:13 PDT 2014
On 20 May 2014 16:08, RICHARD STUCKEY <richard.stuckey at virgin.net> wrote:
> Consider a function which contains an infinite loop: any algorithm which
> could determine whether that function is called or not would effectively be
> an algorithm that could determine whether the program containing that
> function halts or not. Equally, deciding whether the function contains an
> infinite loop or not is itself an instance of the Halting Problem.
A more conservative approach, bailing out on any loops or
complication, would scan the BB flow graph in between any two nodes
(between fully dominating / fully dominated) would return { no, maybe,
yes }. I'd guess that it'd return maybe much more often that yes/no
for the interesting cases, limiting the possibilities of this
approach.
Do you have a concrete use in mind? DCE for the "no" cases? Hoisting
for the "yes" cases? Wouldn't you have to track the arguments as well?
That can quickly get out of hand...
cheers,
--renato
More information about the llvm-dev
mailing list