[LLVMdev] Call to address 0 gets removed

Marius Wachtler malloc at inode.at
Mon Jun 8 16:48:28 PDT 2009


Hello

If I optimize (opt -std-compile-opts ) the following .ll

; ModuleID = 'call0.ll'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-mingw32"

define i32 @t(i32 %a) nounwind {
entry:
    %0 = tail call i32 inttoptr (i32 0 to i32 (i32)*)(i32 %a) nounwind
    ; <i32> [#uses=1]
    ret i32 %0
}

The call to address 0 gets removed.

define i32 @t(i32 %a) noreturn nounwind readnone {
entry:
    unreachable
}

How can I prevent that the call is removed, without making the function addr
volatile?
Does anyone know which optimization removes it?

Thanks,
Marius Wachtler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090609/14641775/attachment.html>


More information about the llvm-dev mailing list