[llvm-dev] LLVM 3.9 RC2's SCCP pass removing calls to external functions?!

Félix Cloutier via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 23 23:21:53 PDT 2016


Hi,

I've been porting a project to LLVM 3.9 and found that the SCCP pass may remove calls to external functions if their return type is declared to be an empty struct. For instance:

> %empty = type {}
> 
> declare %empty @foo()
> 
> define i32 @main() {
>   %1 = call %empty @foo()
>   ret i32 0
> }


opt -sccp -S file.ll returns:

> %empty = type {}
> 
> declare %empty @foo()
> 
> define i32 @main() {
>   ret i32 0
> }


It doesn't look right to remove a call to an external function (especially since the call isn't removed if `@foo` returns a `void` instead). It didn't happen with LLVM 3.8.

I'm using the Mac OS X prebuilt binaries for RC2.

Assuming that this is a bug, what are the next steps?

Félix

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160823/fb482883/attachment.html>


More information about the llvm-dev mailing list