a strange emit of llvm-g++

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

a strange emit of llvm-g++

Seung Jae Lee
I tested a simple function shown as follows for for llvm-g++:
-------------------------------------------------------------
void f_loop(long* c, long sz) {

   long i;
   for (i = 0; i < sz; i++) {
      long offset = i * sz;
      long* out = c + offset;
      out[i] = 0;
   }
}
-------------------------------------------------------------

LLVM assembly was emitted out as follows:
-------------------------------------------------------------
void %_Z6f_loopPll(int* %c, int %sz) {
entry:
        %sz = cast int %sz to uint              ; <uint> [#uses=1]
        %tmp18 = setgt int %sz, 0               ; <bool> [#uses=1]
...
...
...
-------------------------------------------------------------
The function name is strange.. Hmmm...

llvm-gcc emitted normally as shown like this:
-------------------------------------------------------------
void %f_loop(int* %c, int %sz) {
entry:
        %sz = cast int %sz to uint              ; <uint> [#uses=1]
        %tmp18 = setgt int %sz, 0               ; <bool> [#uses=1]
...
...
...
-------------------------------------------------------------
Is this a bug?
(?_?)

Thanks,
Seung J. Lee
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: a strange emit of llvm-g++

Chris Lattner
On Wed, 4 Jul 2007, Seung Jae Lee wrote:
> -------------------------------------------------------------
> Is this a bug?

This is a feature of C++, which allows overloading to work with standard
linkers.  It isn't a bug.  If you compile your code with gcc vs g++ you'll
see the same thing.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev