[LLVMbugs] [Bug 2667] New: Legalize Types - Crash in soften float UINT_TO_FP result.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Aug 11 19:26:11 PDT 2008


           Summary: Legalize Types - Crash in soften float UINT_TO_FP
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bruno.cardoso at gmail.com
                CC: baldrick at free.fr, llvmbugs at cs.uiuc.edu

Created an attachment (id=1918)
 --> (http://llvm.org/bugs/attachment.cgi?id=1918)
bytecode from newlib lcong48.c

The problem occurs when we have, for example a i16,ch = load... followed by an
f64 = uint_to_fp... 

$ mips-llc lib_a-erand48.bc -f -enable-legalize-types -debug
Promote integer result: 0xf54748: i16,ch = load 0xf52a48, 0xf52448, 0xf52b48
<0xf39510:0> alignment=2
Soften float result 0: 0xf54848: f64 = uint_to_fp 0xf54748
mips-llc: /p/llvm/svn/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:290:
llvm::SDValue llvm::DAGTypeLegalizer::SoftenFloatRes_UINT_TO_FP(llvm::SDNode*):
Assertion `LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported UINT_TO_FP!"' failed.

The problem here, is that in method
the helper RTLIB::getUINTTOFP doesn't know how to soften i16 -> f64. This
happens because the i16 load result is promoted, but it only replaces the chain
Uses, not the i16 ones, and since the uint_to_fp result is legalized before its
operands, we get this crash.

All targets with native support for f64 doesnt crash, since they dont legalize
the result, but only the operand.

One quick hack is to replace the unsupported types (in this case i16) Uses with
the new promoted type in PromoteIntRes_LOAD, but this break PromoteOp for other
test cases, and IMHO, considering the LegalizeTypes design, it doesnt seems
like the right approach.

It's worth mentioning that this bug doesn't exist when legalize types is

I volunteer to fix this, I would just appreciate some opinions.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list