[cfe-dev] Devirtualization of calls

Matthieu Monrocq matthieu.monrocq at gmail.com
Sat Sep 3 07:00:07 PDT 2011


2011/9/3 Anton Korobeynikov <anton at korobeynikov.info>

> Hello
>
> > $ clang -emit-llvm devirtualize.cpp -o devirtualize.o
> > clang: error: 'i686-pc-mingw32': unable to pass LLVM bit-code files to
> > linker
> >
> > How could I get the LLVM IR ? (under textual representation, but I can
> use
> > llvm-dis if I get bytecode I think)
> You forgot to add -c cmdline option
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>

D'oh!

Well, I can now confirm that the issue still exists with a recent snapshot
(from today):

$ clang -emit-llvm -O2 -c devirtualize.cpp -o - | llvm-dis
define void @_Z14nodevirtualizev() {
entry:
  %call = tail call %struct.C* @_Z6GetRefv()
  %a = getelementptr inbounds %struct.C* %call, i32 0, i32 0
  %0 = bitcast %struct.C* %call to void (%struct.A*)***
  %vtable = load void (%struct.A*)*** %0, align 4
  %1 = load void (%struct.A*)** %vtable, align 4
  tail call void %1(%struct.A* %a)
  ret void
}

Thanks Anton!

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110903/43e5aa71/attachment.html>


More information about the cfe-dev mailing list