[LLVMdev] bug of tail call optimization on x86 target

Tim Northover t.p.northover at gmail.com
Fri Aug 2 11:58:32 PDT 2013


Hi Katsuhiro,

Thanks very much for taking the time to dig into this and produce a
patch. Is there any chance you could make a couple of tweaks?

> This bug is due to wrong computation of stack object indices by the
> x86 backend.  The attached patch indicates the wrong points.  Due to
> integral promotion, explicit conversion to signed integer is needed
> at those points.

I'm not convinced that's the best solution, at least conceptually.
SlotSize really is an unsigned quantity, and though it's unlikely we'd
like 0x80000000 to be interpreted as positive, rather than negative if
it ever does occur.

Also, CreateFixedObject seems to take an int64_t

I'd suggest:
+ ISelLowering line 2459: cast FPDiff to int64_t.
+ ISelLowering line 3327: cast SlotSize to int64_t.
+ FrameLowering: declare TailCallReturnAddrDelta as int64_t and
subtract SlotSize?

It would also be really good if you could convert your IR into a
test-case (like the others in "test/CodeGen/X86/"). We like to have a
test-case for every commit if it's humanly possible.

Cheers.

Tim.



More information about the llvm-dev mailing list