If I have: %x = call @externalFunc ... ; other codes where %x is not used ret ; assume void function and use dce optimization, will the call gets eliminated? -- View this message in context: http://old.nabble.com/DCE-and-external-function-tp29932485p29932485.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Hi leledumbo,> If I have: > > %x = call @externalFunc > ... ; other codes where %x is not used > ret ; assume void function > > and use dce optimization, will the call gets eliminated?only if the compiler can prove that the called function has no side effects (such as modifying some global variables or causing the program to exit). Ciao, Duncan.
> only if the compiler can prove that the called function has > no side effects (such as modifying some global variables or > causing the program to exit).can it prove if the function resides in a shared library? -- View this message in context: http://old.nabble.com/DCE-and-external-function-tp29932485p29942236.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Hi, On Mon, Oct 11, 2010 at 3:46 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi leledumbo, > >> If I have: >> >> %x = call @externalFunc >> ... ; other codes where %x is not used >> ret ; assume void function >> >> and use dce optimization, will the call gets eliminated? > > only if the compiler can prove that the called function has > no side effects (such as modifying some global variables or > causing the program to exit).Wasn't there some efforts/investigation to support marking of (body-less) functions as 'pure'? Is this on the roadmap? Cheers, -Mahadevan.