LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1071 - X86 can generate movb al, eax ?
Summary: X86 can generate movb al, eax ?
Status: RESOLVED INVALID
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2007-01-02 22:52 PST by Reid Spencer
Modified: 2010-02-22 12:52 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Reid Spencer 2007-01-02 22:52:02 PST
While testing this function:

define bool i32() { ret bool true; }

I noticed that it is possible for the X86 backend to generate:

movb al, eax

which doesn't assemble. 

To make this happen, go to CodeGen/SelectionISel.cpp in the visitRetInst
function and make it *not* do an extend (of any kind) for boolean. This will
cause the Legalizer to apply an ANY_EXTEND which, presumably, means that not
doing an extend is okay.  While that change is not correct, the X86 backend
shouldn't generate incorrect instructions either.
Comment 1 Evan Cheng 2007-01-02 23:59:44 PST
Looks like legalizer isn't inserting an anyext to i32 so we ended up with a movb
with a 32-bit register destination.

If you let visitRet insert the anyext node, then it will not generate this
illegal instruction.