[LLVMdev] Strange SetCond Behavior

Reid Spencer reid at x10sys.com
Sun May 9 18:17:01 PDT 2004


Bug 337 has been filed.

Here's the simplest test case I could find that reproduces the bug:

> %global_long_1 = linkonce global long 7
> %global_long_2 = linkonce global long 49
>                                                                                                                                             
> implementation   ; Functions:
>                                                                                                                                             
> declare void %exit(int)
>                                                                                                                                             
> int %main() {
>         %long_1 = getelementptr long* %global_long_1, long 0
>         %long_2 = getelementptr long* %global_long_2, long 0
>                                                                                                                                             
>         %l1 = load long* %long_1
>         %l2 = load long* %long_2
>                                                                                                                                             
>         %cond = setle long %l1, %l2
>         %cast2 = cast bool %cond to int
>         ret int %cast2
> }


On Sun, 2004-05-09 at 15:39, Reid Spencer wrote:
> On Sun, 2004-05-09 at 15:25, Chris Lattner wrote:
> 
> > That sounds like a bug.  I'll look into it.  I assume you are seeing this
> > problem with the X86 backend?
> > 
> 
> Yes.
> 
> > > Perhaps the cast from bool to long doesn't work the same as for bool
> > > to int? Should it?
> > 
> > Yes, you should get a long 0 or 1.
> 
> That's what I thought.
> 
> 
> > Please do, I'll also try to some unit tests to make sure things are
> > working properly.
> 
> Working on it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040509/d11aec94/attachment.sig>


More information about the llvm-dev mailing list