[LLVMdev] Strange SetCond Behavior

Chris Lattner sabre at nondot.org
Sun May 9 17:19:01 PDT 2004

On Sun, 9 May 2004, Reid Spencer wrote:

> Before I file a bug, I thought I'd check to make sure something hasn't
> changed. Stacker used to work in 1.2, now it fails on six tests. All six
> tests pertain to use of the SetLT, SetGT, SetLE, and SetGE SetCondInst.
> In my test programs they all fail, regardless of the values.
> The *only* thing I've done to Stacker is to change the base type
> involved in the comparison from int to long. Is there something
> "different" about the comparison of longs?
> The code generated by Stacker Compiler is like:
> setle long %11, %16             ; <bool>:0 [#uses=1]
> cast bool %0 to long            ; <long>:24 [#uses=1]
> store long %24, long* %4
> The value stored into %4 is later retrieved and compared against zero.
> That test always fails if setle, setge, setlt, or setgt is used.
> However, it works correctly for seteq, and setne!

That sounds like a bug.  I'll look into it.  I assume you are seeing this
problem with the X86 backend?

> 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.

> I'm going to try and reduce the test case because I suspect something
> is broken in LLVM that only shows up in Stacker's usage. I'll let you
> know what I find. Please let me know if the above sounds like a known
> problem or usage issue.

Please do, I'll also try to some unit tests to make sure things are
working properly.



More information about the llvm-dev mailing list